55from __future__ import annotations
66
77from collections import namedtuple
8- from typing import Dict , Generic , Iterator , Optional , Tuple , TypeVar
8+ from collections .abc import Iterator
9+ from typing import Generic , TypeVar
910from urllib .parse import urlparse
1011
1112from obspec import Get
@@ -76,8 +77,8 @@ class PathEntry(Generic[T]):
7677 """
7778
7879 def __init__ (self ) -> None :
79- self .store : Optional [ T ] = None
80- self .children : Dict [str , " PathEntry[T]" ] = {}
80+ self .store : T | None = None
81+ self .children : dict [str , PathEntry [T ]] = {}
8182
8283 def iter_stores (self ) -> Iterator [T ]:
8384 """Iterate over all stores in this entry and its children."""
@@ -86,7 +87,7 @@ def iter_stores(self) -> Iterator[T]:
8687 for child in self .children .values ():
8788 yield from child .iter_stores ()
8889
89- def lookup (self , to_resolve : str ) -> Optional [ Tuple [ T , int ]] :
90+ def lookup (self , to_resolve : str ) -> tuple [ T , int ] | None :
9091 """
9192 Lookup a store based on URL path
9293
@@ -200,7 +201,7 @@ def __init__(self, stores: dict[Url, T] | None = None) -> None:
200201 ```
201202 """
202203 # Mapping from UrlKey (containing scheme and netlocs) to PathEntry
203- self .map : Dict [UrlKey , PathEntry [T ]] = {}
204+ self .map : dict [UrlKey , PathEntry [T ]] = {}
204205 stores = stores or {}
205206 for url , store in stores .items ():
206207 self .register (url , store )
@@ -250,7 +251,7 @@ def register(self, url: Url, store: T) -> None:
250251 # Update the store
251252 entry .store = store
252253
253- def resolve (self , url : Url ) -> Tuple [T , Path ]:
254+ def resolve (self , url : Url ) -> tuple [T , Path ]:
254255 """
255256 Resolve a URL within the [ObjectStoreRegistry][obspec_utils.registry.ObjectStoreRegistry].
256257
0 commit comments