diff --git a/dandi/cli/tests/test_cmd_ls.py b/dandi/cli/tests/test_cmd_ls.py index 68b299d28..e8468895e 100644 --- a/dandi/cli/tests/test_cmd_ls.py +++ b/dandi/cli/tests/test_cmd_ls.py @@ -11,7 +11,7 @@ from dandi.tests.skip import mark -from ..ls import ls +from ..cmd_ls import ls from ...utils import yaml_load diff --git a/dandi/cli/tests/test_command.py b/dandi/cli/tests/test_command.py index 4b95ac8c8..e03e4e926 100644 --- a/dandi/cli/tests/test_command.py +++ b/dandi/cli/tests/test_command.py @@ -6,9 +6,9 @@ from click.testing import CliRunner import pytest +from ..cmd_ls import ls +from ..cmd_validate import validate from ..command import __all_commands__ -from ..ls import ls -from ..validate import validate @pytest.mark.parametrize("command", (ls, validate)) diff --git a/dandi/cli/tests/test_download.py b/dandi/cli/tests/test_download.py index c1b50025d..164860c46 100644 --- a/dandi/cli/tests/test_download.py +++ b/dandi/cli/tests/test_download.py @@ -5,7 +5,7 @@ from click.testing import CliRunner import pytest -from ..download import download +from ..cmd_download import download from ...consts import dandiset_metadata_file, known_instances diff --git a/dandi/cli/tests/test_instances.py b/dandi/cli/tests/test_instances.py index 06d45b46c..4e058db28 100644 --- a/dandi/cli/tests/test_instances.py +++ b/dandi/cli/tests/test_instances.py @@ -2,7 +2,7 @@ from click.testing import CliRunner -from ..instances import instances +from ..cmd_instances import instances def test_cmd_instances(monkeypatch): diff --git a/dandi/cli/tests/test_move.py b/dandi/cli/tests/test_move.py index 6242ab484..9eca9545a 100644 --- a/dandi/cli/tests/test_move.py +++ b/dandi/cli/tests/test_move.py @@ -7,7 +7,7 @@ import pytest from pytest_mock import MockerFixture -from ..move import move +from ..cmd_move import move @pytest.mark.parametrize( diff --git a/dandi/cli/tests/test_service_scripts.py b/dandi/cli/tests/test_service_scripts.py index da8c59ce8..852261c91 100644 --- a/dandi/cli/tests/test_service_scripts.py +++ b/dandi/cli/tests/test_service_scripts.py @@ -16,7 +16,7 @@ from dandi import __version__ from dandi.tests.fixtures import SampleDandiset -from ..service_scripts import service_scripts +from ..cmd_service_scripts import service_scripts DATA_DIR = Path(__file__).with_name("data") diff --git a/dandi/consts.py b/dandi/consts.py index d8e47350d..23964483f 100644 --- a/dandi/consts.py +++ b/dandi/consts.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from enum import Enum import os +from typing import Union #: A list of metadata fields which dandi extracts from .nwb files. #: Additional fields (such as ``number_of_*``) might be added by @@ -98,7 +99,9 @@ class EmbargoStatus(Enum): @dataclass(frozen=True) class DandiInstance: name: str - gui: str | None + # This class is used as an attribute of ParsedDandiURL, a Pydantic class, + # and thus we need non-future annotations: + gui: Union[str, None] api: str @property diff --git a/dandi/dandiapi.py b/dandi/dandiapi.py index c0f86a064..4c2ad220c 100644 --- a/dandi/dandiapi.py +++ b/dandi/dandiapi.py @@ -13,7 +13,7 @@ import re from time import sleep, time from types import TracebackType -from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional +from typing import TYPE_CHECKING, Any, ClassVar, Dict, FrozenSet, List, Optional from urllib.parse import quote_plus, urlparse, urlunparse import click @@ -621,7 +621,7 @@ class APIBase(BaseModel): detail; do not rely on it. """ - JSON_EXCLUDE: ClassVar[frozenset[str]] = frozenset(["client"]) + JSON_EXCLUDE: ClassVar[FrozenSet[str]] = frozenset(["client"]) def json_dict(self) -> dict[str, Any]: """ diff --git a/dandi/dandiarchive.py b/dandi/dandiarchive.py index 3bed6549e..fd4736da9 100644 --- a/dandi/dandiarchive.py +++ b/dandi/dandiarchive.py @@ -33,7 +33,7 @@ import posixpath import re from time import sleep -from typing import Any +from typing import Any, Union from urllib.parse import unquote as urlunquote from pydantic import AnyHttpUrl, BaseModel, parse_obj_as @@ -70,11 +70,11 @@ class ParsedDandiURL(ABC, BaseModel): #: The Dandi Archive instance that the URL points to instance: DandiInstance #: The ID of the Dandiset given in the URL - dandiset_id: str | None + dandiset_id: Union[str, None] #: The version of the Dandiset, if specified. If this is not set, the #: version will be defaulted using the rules described under #: `DandiAPIClient.get_dandiset()`. - version_id: str | None = None + version_id: Union[str, None] = None @property def api_url(self) -> AnyHttpUrl: diff --git a/dandi/tests/fixtures.py b/dandi/tests/fixtures.py index 4c3b355e8..84d9fa74b 100644 --- a/dandi/tests/fixtures.py +++ b/dandi/tests/fixtures.py @@ -30,7 +30,7 @@ from .skip import skipif from .. import get_logger -from ..cli.organize import organize +from ..cli.cmd_organize import organize from ..consts import ( DandiInstance, dandiset_metadata_file, diff --git a/dandi/tests/test_organize.py b/dandi/tests/test_organize.py index 01c2994f0..224d7605e 100644 --- a/dandi/tests/test_organize.py +++ b/dandi/tests/test_organize.py @@ -10,7 +10,7 @@ import pytest import ruamel.yaml -from ..cli.organize import organize +from ..cli.cmd_organize import organize from ..consts import dandiset_metadata_file, file_operation_modes from ..organize import ( _sanitize_value,