1- from __future__ import annotations
2-
31from io import BytesIO
4- from typing import List
2+ from typing import List , Optional , Union
53
64# NOTE aliasing the imports with 'as' makes them public in the eyes
75# of static code checkers. Thus we avoid listing them with __all__ = ...
1311try :
1412 import importlib .metadata as importlib_metadata
1513except ImportError :
16- import importlib_metadata
14+ import importlib_metadata # type: ignore
1715
1816__version__ = importlib_metadata .version ("object-store-python" )
1917
20- PathLike = str | List [str ] | Path
21- BytesLike = bytes | BytesIO
18+ PathLike = Union [ str , List [str ], Path ]
19+ BytesLike = Union [ bytes , BytesIO ]
2220
2321DELIMITER = "/"
2422
@@ -98,7 +96,7 @@ def delete(self, location: PathLike) -> None:
9896 """
9997 return super ().delete (_as_path (location ))
10098
101- def list (self , prefix : PathLike | None = None ) -> list [ObjectMeta ]:
99+ def list (self , prefix : Optional [ PathLike ] = None ) -> list [ObjectMeta ]:
102100 """List all the objects with the given prefix.
103101
104102 Prefixes are evaluated on a path segment basis, i.e. `foo/bar/` is a prefix
@@ -113,7 +111,7 @@ def list(self, prefix: PathLike | None = None) -> list[ObjectMeta]:
113111 prefix_ = _as_path (prefix ) if prefix else None
114112 return super ().list (prefix_ )
115113
116- def list_with_delimiter (self , prefix : PathLike | None = None ) -> ListResult :
114+ def list_with_delimiter (self , prefix : Optional [ PathLike ] = None ) -> ListResult :
117115 """List objects with the given prefix and an implementation specific
118116 delimiter. Returns common prefixes (directories) in addition to object
119117 metadata.
0 commit comments