Skip to content

Commit 097809a

Browse files
committed
Apply black v2024
1 parent 50482ea commit 097809a

File tree

6 files changed

+15
-17
lines changed

6 files changed

+15
-17
lines changed

datumaro/components/dataset_generator.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,4 @@ def generate(cls, output_dir, count, shape, **options):
1818
return generator.generate_dataset()
1919

2020
@abstractmethod
21-
def generate_dataset(self):
22-
...
21+
def generate_dataset(self): ...

datumaro/components/format_detection.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ def __call__(
445445
format_name: str,
446446
reason: RejectionReason,
447447
human_message: str,
448-
) -> Any:
449-
...
448+
) -> Any: ...
450449

451450

452451
def detect_dataset_format(

datumaro/plugins/cityscapes_format.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -442,9 +442,11 @@ def apply(self):
442442
compiled_mask = CompiledMask.from_instance_masks(
443443
masks,
444444
instance_ids=[
445-
self._label_id_mapping(m.label)
446-
if m.attributes.get("is_crowd", False)
447-
else self._label_id_mapping(m.label) * 1000 + (m.id or (i + 1))
445+
(
446+
self._label_id_mapping(m.label)
447+
if m.attributes.get("is_crowd", False)
448+
else self._label_id_mapping(m.label) * 1000 + (m.id or (i + 1))
449+
)
448450
for i, m in enumerate(masks)
449451
],
450452
instance_labels=[self._label_id_mapping(m.label) for m in masks],

datumaro/plugins/coco_format/converter.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -566,9 +566,8 @@ def _split_tasks_string(s):
566566

567567
@classmethod
568568
def build_cmdline_parser(cls, **kwargs):
569-
kwargs[
570-
"description"
571-
] = """
569+
kwargs["description"] = (
570+
"""
572571
Segmentation mask modes ('--segmentation-mode'):|n
573572
- '{sm.guess.name}': guess the mode for each instance,|n
574573
|s|suse 'is_crowd' attribute as hint|n
@@ -592,7 +591,8 @@ def build_cmdline_parser(cls, **kwargs):
592591
directory, otherwise they are saved in separate directories
593592
by subsets.
594593
""".format(
595-
sm=SegmentationMode
594+
sm=SegmentationMode
595+
)
596596
)
597597
parser = super().build_cmdline_parser(**kwargs)
598598
parser.add_argument(

datumaro/plugins/coco_format/extractor.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,10 @@ def _get_label_id(self, ann):
292292
return label_id
293293

294294
@overload
295-
def _parse_field(self, ann: Dict[str, Any], key: str, cls: Type[T]) -> T:
296-
...
295+
def _parse_field(self, ann: Dict[str, Any], key: str, cls: Type[T]) -> T: ...
297296

298297
@overload
299-
def _parse_field(self, ann: Dict[str, Any], key: str, cls: Tuple[Type, ...]) -> Any:
300-
...
298+
def _parse_field(self, ann: Dict[str, Any], key: str, cls: Tuple[Type, ...]) -> Any: ...
301299

302300
def _parse_field(
303301
self, ann: Dict[str, Any], key: str, cls: Union[Type[T], Tuple[Type, ...]]

datumaro/plugins/tf_detection_api_format/converter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ def apply(self):
7373
os.makedirs(self._save_dir, exist_ok=True)
7474

7575
label_categories = self._extractor.categories().get(AnnotationType.label, LabelCategories())
76-
get_label = (
77-
lambda label_id: label_categories.items[label_id].name if label_id is not None else ""
76+
get_label = lambda label_id: (
77+
label_categories.items[label_id].name if label_id is not None else ""
7878
)
7979
label_ids = OrderedDict(
8080
(label.name, 1 + idx) for idx, label in enumerate(label_categories.items)

0 commit comments

Comments
 (0)