Skip to content

Commit 96d3dae

Browse files
fix: Address review comments on types and storage
- Remove unused RowList and PrimaryKeyList type aliases - Change list to list[Any] in Restriction type - Use TYPE_CHECKING instead of 'if False:' for conditional import - Remove redundant isinstance check in is_remote_url (type annotation guarantees str) Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent f824af2 commit 96d3dae

File tree

2 files changed

+3
-11
lines changed

2 files changed

+3
-11
lines changed

src/datajoint/storage.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,6 @@ def is_remote_url(path: str) -> bool:
4242
bool
4343
True if path starts with a supported remote protocol.
4444
"""
45-
if not isinstance(path, str):
46-
return False
4745
return path.lower().startswith(REMOTE_PROTOCOLS)
4846

4947

src/datajoint/types.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,16 @@
99

1010
from __future__ import annotations
1111

12-
from typing import Any, TypeAlias
12+
from typing import TYPE_CHECKING, Any, TypeAlias
1313

1414
# Primary key types
1515
PrimaryKey: TypeAlias = dict[str, Any]
1616
"""A dictionary mapping attribute names to values that uniquely identify an entity."""
1717

18-
PrimaryKeyList: TypeAlias = list[dict[str, Any]]
19-
"""A list of primary key dictionaries."""
20-
2118
# Row/record types
2219
Row: TypeAlias = dict[str, Any]
2320
"""A single row/record as a dictionary mapping attribute names to values."""
2421

25-
RowList: TypeAlias = list[dict[str, Any]]
26-
"""A list of rows/records."""
27-
2822
# Attribute types
2923
AttributeName: TypeAlias = str
3024
"""Name of a table attribute/column."""
@@ -47,7 +41,7 @@
4741
"""Mapping of child_attr -> (parent_table, parent_attr) for foreign keys."""
4842

4943
# Restriction types
50-
Restriction: TypeAlias = str | dict[str, Any] | bool | "QueryExpression" | list | None
44+
Restriction: TypeAlias = str | dict[str, Any] | bool | "QueryExpression" | list[Any] | None
5145
"""Valid restriction types for query operations."""
5246

5347
# Fetch result types
@@ -56,5 +50,5 @@
5650

5751

5852
# For avoiding circular imports
59-
if False: # TYPE_CHECKING equivalent that's always False
53+
if TYPE_CHECKING:
6054
from .expression import QueryExpression

0 commit comments

Comments
 (0)