Skip to content

Commit

Permalink
Fix typings in ImageNet format (#1563)
Browse files Browse the repository at this point in the history
  • Loading branch information
itrushkin authored Jul 10, 2024
1 parent b2b8533 commit b8c0482
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/datumaro/plugins/data_formats/imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging as log
import os
from pathlib import Path
from typing import List
from typing import List, Optional, Union

from datumaro.components.annotation import AnnotationType, Label, LabelCategories
from datumaro.components.dataset_base import DatasetItem, SubsetBase
Expand All @@ -30,10 +30,10 @@ def __init__(
self,
path: str,
*,
subset: str | None = None,
ctx: ImportContext | None = None,
min_depth: int | None = None,
max_depth: int | None = None,
subset: Optional[str] = None,
ctx: Optional[ImportContext] = None,
min_depth: Optional[int] = None,
max_depth: Optional[int] = None,
):
if not Path(path).is_dir():
raise NotADirectoryError(errno.ENOTDIR, "Can't find dataset directory", path)
Expand Down Expand Up @@ -136,7 +136,7 @@ def detect(cls, context: FormatDetectionContext) -> FormatDetectionConfidence:
return super().detect(context)

@classmethod
def contains_only_images(cls, path: str | Path):
def contains_only_images(cls, path: Union[str, Path]):
for _, dirnames, filenames in walk(path, cls._MAX_DEPTH, cls._MIN_DEPTH):
if filenames:
for filename in filenames:
Expand Down

0 comments on commit b8c0482

Please sign in to comment.