Skip to content

Commit

Permalink
CLI: remove imports that were deprecated in Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
SpecLad committed Nov 4, 2024
1 parent 67f9afd commit 45968bf
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cvat-cli/src/cvat_cli/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import argparse
import logging
import sys
from typing import List

import urllib3.exceptions
from cvat_sdk import exceptions
Expand All @@ -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)
Expand Down
5 changes: 3 additions & 2 deletions cvat-cli/src/cvat_cli/_internal/command_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down
7 changes: 4 additions & 3 deletions cvat-cli/src/cvat_cli/_internal/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions cvat-cli/src/cvat_cli/_internal/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 45968bf

Please sign in to comment.