diff --git a/cvat-cli/src/cvat_cli/__main__.py b/cvat-cli/src/cvat_cli/__main__.py index eb7f6ca30b21..3d89935fc2d0 100755 --- a/cvat-cli/src/cvat_cli/__main__.py +++ b/cvat-cli/src/cvat_cli/__main__.py @@ -6,7 +6,6 @@ import argparse import logging import sys -from typing import List import urllib3.exceptions from cvat_sdk import exceptions @@ -18,7 +17,7 @@ logger = logging.getLogger(__name__) -def main(args: List[str] = None): +def main(args: list[str] = None): parser = argparse.ArgumentParser(description=COMMANDS.description) configure_common_arguments(parser) COMMANDS.configure_parser(parser) diff --git a/cvat-cli/src/cvat_cli/_internal/command_base.py b/cvat-cli/src/cvat_cli/_internal/command_base.py index c6b96802dbee..ec6ccbbcd47f 100644 --- a/cvat-cli/src/cvat_cli/_internal/command_base.py +++ b/cvat-cli/src/cvat_cli/_internal/command_base.py @@ -4,7 +4,8 @@ import argparse import types -from typing import Callable, Dict, Mapping, Protocol +from collections.abc import Mapping +from typing import Callable, Protocol class Command(Protocol): @@ -21,7 +22,7 @@ def execute(self) -> Callable[..., None]: ... class CommandGroup: def __init__(self, *, description: str) -> None: - self._commands: Dict[str, Command] = {} + self._commands: dict[str, Command] = {} self.description = description def command_class(self, name: str): diff --git a/cvat-cli/src/cvat_cli/_internal/commands.py b/cvat-cli/src/cvat_cli/_internal/commands.py index b4a355ec1d41..e86ef3b6350f 100644 --- a/cvat-cli/src/cvat_cli/_internal/commands.py +++ b/cvat-cli/src/cvat_cli/_internal/commands.py @@ -9,8 +9,9 @@ import importlib.util import json import textwrap +from collections.abc import Sequence from pathlib import Path -from typing import Any, Dict, List, Optional, Sequence +from typing import Any, Optional import cvat_sdk.auto_annotation as cvataa from attr.converters import to_bool @@ -203,7 +204,7 @@ def execute( client, *, name: str, - labels: List[Dict[str, str]], + labels: list[dict[str, str]], resources: Sequence[str], resource_type: ResourceType, annotation_path: str, @@ -469,7 +470,7 @@ def execute( task_id: int, function_module: Optional[str] = None, function_file: Optional[Path] = None, - function_parameters: Dict[str, Any], + function_parameters: dict[str, Any], clear_existing: bool = False, allow_unmatched_labels: bool = False, ) -> None: diff --git a/cvat-cli/src/cvat_cli/_internal/parsers.py b/cvat-cli/src/cvat_cli/_internal/parsers.py index c49fabb83b90..a66710a09f47 100644 --- a/cvat-cli/src/cvat_cli/_internal/parsers.py +++ b/cvat-cli/src/cvat_cli/_internal/parsers.py @@ -6,7 +6,7 @@ import argparse import json import os.path -from typing import Any, Tuple +from typing import Any from attr.converters import to_bool from cvat_sdk.core.proxies.tasks import ResourceType @@ -28,7 +28,7 @@ def parse_label_arg(s): return json.loads(s) -def parse_function_parameter(s: str) -> Tuple[str, Any]: +def parse_function_parameter(s: str) -> tuple[str, Any]: key, sep, type_and_value = s.partition("=") if not sep: