diff --git a/datumaro/cli/commands/add.py b/datumaro/cli/commands/add.py index c43936ec81..4f12975aca 100644 --- a/datumaro/cli/commands/add.py +++ b/datumaro/cli/commands/add.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import - from ..contexts.source import build_add_parser as build_parser + +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/create.py b/datumaro/cli/commands/create.py index 1396d5f9ed..bc3a6de7fe 100644 --- a/datumaro/cli/commands/create.py +++ b/datumaro/cli/commands/create.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_create_parser as build_parser -from ..contexts.project import build_create_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/diff.py b/datumaro/cli/commands/diff.py index a50c8f0a4e..3c4ce32714 100644 --- a/datumaro/cli/commands/diff.py +++ b/datumaro/cli/commands/diff.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_diff_parser as build_parser -from ..contexts.project import build_diff_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/ediff.py b/datumaro/cli/commands/ediff.py index ac5ba8c467..e835d2e58f 100644 --- a/datumaro/cli/commands/ediff.py +++ b/datumaro/cli/commands/ediff.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_ediff_parser as build_parser -from ..contexts.project import build_ediff_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/export.py b/datumaro/cli/commands/export.py index 1efb506459..52bf5505e6 100644 --- a/datumaro/cli/commands/export.py +++ b/datumaro/cli/commands/export.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_export_parser as build_parser -from ..contexts.project import build_export_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/filter.py b/datumaro/cli/commands/filter.py index 0b0d28cb9f..13468665a6 100644 --- a/datumaro/cli/commands/filter.py +++ b/datumaro/cli/commands/filter.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_filter_parser as build_parser -from ..contexts.project import build_filter_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/import_.py b/datumaro/cli/commands/import_.py index 74c47ab3cc..0d6ef829c0 100644 --- a/datumaro/cli/commands/import_.py +++ b/datumaro/cli/commands/import_.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_import_parser as build_parser -from ..contexts.project import build_import_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/info.py b/datumaro/cli/commands/info.py index fa2af5ddd9..e6c693bbf3 100644 --- a/datumaro/cli/commands/info.py +++ b/datumaro/cli/commands/info.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_info_parser as build_parser -from ..contexts.project import build_info_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/remove.py b/datumaro/cli/commands/remove.py index 3ea0bbffa9..003c36f800 100644 --- a/datumaro/cli/commands/remove.py +++ b/datumaro/cli/commands/remove.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.source import build_remove_parser as build_parser -from ..contexts.source import build_remove_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/stats.py b/datumaro/cli/commands/stats.py index cb54eec394..fdbb75bbae 100644 --- a/datumaro/cli/commands/stats.py +++ b/datumaro/cli/commands/stats.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_stats_parser as build_parser -from ..contexts.project import build_stats_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/transform.py b/datumaro/cli/commands/transform.py index 474d6a2128..ff4d509486 100644 --- a/datumaro/cli/commands/transform.py +++ b/datumaro/cli/commands/transform.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import +from ..contexts.project import build_transform_parser as build_parser -from ..contexts.project import build_transform_parser as build_parser \ No newline at end of file +__all__ = [ + 'build_parser', +] diff --git a/datumaro/cli/commands/validate.py b/datumaro/cli/commands/validate.py index 13794187a7..94ed9c6232 100644 --- a/datumaro/cli/commands/validate.py +++ b/datumaro/cli/commands/validate.py @@ -2,6 +2,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import - from ..contexts.project import build_validate_parser as build_parser + +__all__ = [ + 'build_parser', +] diff --git a/datumaro/util/__init__.py b/datumaro/util/__init__.py index 3280eb4e1c..7d1af4031a 100644 --- a/datumaro/util/__init__.py +++ b/datumaro/util/__init__.py @@ -1,18 +1,20 @@ -# Copyright (C) 2019-2020 Intel Corporation +# Copyright (C) 2019-2021 Intel Corporation # # SPDX-License-Identifier: MIT from contextlib import ExitStack -from distutils.util import strtobool as str_to_bool # pylint: disable=unused-import from functools import partial, wraps from itertools import islice from typing import Iterable, Tuple -import attr +import distutils.util +import attr NOTSET = object() +str_to_bool = distutils.util.strtobool + def find(iterable, pred=lambda x: True, default=None): return next((x for x in iterable if pred(x)), default) diff --git a/datumaro/util/image.py b/datumaro/util/image.py index 2f8c6056e6..514d74f052 100644 --- a/datumaro/util/image.py +++ b/datumaro/util/image.py @@ -3,9 +3,8 @@ # # SPDX-License-Identifier: MIT -# pylint: disable=unused-import - from enum import Enum, auto +import importlib from io import BytesIO from typing import Any, Callable, Iterator, Iterable, Optional, Tuple, Union import os @@ -18,7 +17,7 @@ class _IMAGE_BACKENDS(Enum): _IMAGE_BACKEND = None _image_loading_errors = (FileNotFoundError, ) try: - import cv2 + importlib.import_module('cv2') _IMAGE_BACKEND = _IMAGE_BACKENDS.cv2 except ImportError: import PIL