File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change 22from copy import copy , deepcopy
33from dataclasses import asdict
44from pathlib import Path
5- from typing import Dict , List , Union
5+ from typing import Dict , List , Optional , Union
66from urllib .parse import parse_qs , urlparse
77
88import json_merge_patch
1111from httpx import URL
1212
1313from tiled .client .context import Context
14+ from tiled .structures .root import Structure
1415
1516from ..structures .core import STRUCTURE_TYPES , Spec , StructureFamily
1617from ..structures .data_source import DataSource
@@ -131,8 +132,8 @@ def __init__(
131132 * ,
132133 item ,
133134 structure_clients ,
134- structure = None ,
135- include_data_sources = False ,
135+ structure : Optional [ Structure ] = None ,
136+ include_data_sources : bool = False ,
136137 ):
137138 self ._context = context
138139 self ._item = item
Original file line number Diff line number Diff line change 1010from pydantic_core import PydanticCustomError
1111from typing_extensions import Annotated , TypedDict
1212
13+ from tiled .structures .root import Structure
14+
1315from ..structures .array import ArrayStructure
1416from ..structures .awkward import AwkwardStructure
1517from ..structures .core import STRUCTURE_TYPES , StructureFamily
2426DataT = TypeVar ("DataT" )
2527LinksT = TypeVar ("LinksT" )
2628MetaT = TypeVar ("MetaT" )
27- StructureT = TypeVar ("StructureT" )
29+ StructureT = TypeVar ("StructureT" , bound = Structure )
2830
2931
3032MAX_ALLOWED_SPECS = 20
Original file line number Diff line number Diff line change 99from dataclasses import asdict , dataclass
1010from typing import Dict , Optional
1111
12+ from tiled .structures .root import Structure
13+
1214from ..utils import OneShotCachedMap
1315
1416
@@ -47,8 +49,7 @@ def dict(self) -> Dict[str, Optional[str]]:
4749 model_dump = dict # For easy interoperability with pydantic 2.x models
4850
4951
50- # TODO: make type[Structure] after #1036
51- STRUCTURE_TYPES = OneShotCachedMap [StructureFamily , type ](
52+ STRUCTURE_TYPES = OneShotCachedMap [StructureFamily , type [Structure ]](
5253 {
5354 StructureFamily .array : lambda : importlib .import_module (
5455 "...structures.array" , StructureFamily .__module__
You can’t perform that action at this time.
0 commit comments