From 937ec7b188f14a837693df03f11ebca4279bbc18 Mon Sep 17 00:00:00 2001 From: Kyle Barron Date: Fri, 28 Feb 2025 14:28:53 -0500 Subject: [PATCH] Reuse obstore.store type hinting (#38) --- .gitmodules | 3 +++ python/_obstore | 1 + python/python/async_tiff/__init__.py | 5 +++++ python/python/async_tiff/_tiff.pyi | 5 ++--- python/python/async_tiff/store | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 python/_obstore create mode 120000 python/python/async_tiff/store diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..0ed58d8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "python/obstore"] + path = python/_obstore + url = https://github.com/developmentseed/obstore diff --git a/python/_obstore b/python/_obstore new file mode 160000 index 0000000..aaa8d6a --- /dev/null +++ b/python/_obstore @@ -0,0 +1 @@ +Subproject commit aaa8d6a0de646b532dc74a81f4adbd8ecf9de026 diff --git a/python/python/async_tiff/__init__.py b/python/python/async_tiff/__init__.py index 0973927..7ed52b8 100644 --- a/python/python/async_tiff/__init__.py +++ b/python/python/async_tiff/__init__.py @@ -1,4 +1,9 @@ +from typing import TYPE_CHECKING + from ._async_tiff import * from ._async_tiff import ___version +if TYPE_CHECKING: + from . import store + __version__: str = ___version() diff --git a/python/python/async_tiff/_tiff.pyi b/python/python/async_tiff/_tiff.pyi index f534ec3..fb059f1 100644 --- a/python/python/async_tiff/_tiff.pyi +++ b/python/python/async_tiff/_tiff.pyi @@ -1,11 +1,10 @@ -from typing import Any - from ._ifd import ImageFileDirectory +from .store import ObjectStore class TIFF: @classmethod async def open( - cls, path: str, *, store: Any, prefetch: int | None = 16384 + cls, path: str, *, store: ObjectStore, prefetch: int | None = 16384 ) -> TIFF: ... @property def ifds(self) -> list[ImageFileDirectory]: ... diff --git a/python/python/async_tiff/store b/python/python/async_tiff/store new file mode 120000 index 0000000..e177177 --- /dev/null +++ b/python/python/async_tiff/store @@ -0,0 +1 @@ +../../_obstore/obstore/python/obstore/store \ No newline at end of file