From 5f702c9a2797e79e01d8c2afdf40934a11df52d2 Mon Sep 17 00:00:00 2001 From: Yoann Schneider <yschneider@teklia.com> Date: Mon, 15 Apr 2024 20:03:27 +0200 Subject: [PATCH] Introduce UP014 --- .../documents/management/commands/move_lines_to_parent.py | 8 +++++--- ruff.toml | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arkindex/documents/management/commands/move_lines_to_parent.py b/arkindex/documents/management/commands/move_lines_to_parent.py index 2927bc6b39..42229e194b 100644 --- a/arkindex/documents/management/commands/move_lines_to_parent.py +++ b/arkindex/documents/management/commands/move_lines_to_parent.py @@ -7,9 +7,11 @@ from arkindex.documents.models import ElementType from arkindex.project.argparse import CorpusArgument # x and y of top left and bottom right points -BBox = NamedTuple( - "BBox", [("left", int), ("top", int), ("right", int), ("bottom", int)] -) +class BBox(NamedTuple): + left: int + top: int + right: int + bottom: int def compute_polygon_area(polygon: BBox): diff --git a/ruff.toml b/ruff.toml index bbd5b4c341..66759351ff 100644 --- a/ruff.toml +++ b/ruff.toml @@ -29,6 +29,8 @@ select = [ "UP004", # unnecessary-encode-utf8 "UP012", + # convert-named-tuple-functional-to-class + "UP014", ] ignore = ["E501", "RET502", "RET503"] -- GitLab