Skip to content

Commit 55a28fc

Browse files
committed
Fix possible import issues
1 parent 515ca6c commit 55a28fc

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mdio/api/io.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def _normalize_storage_options(path: UPath) -> dict[str, Any] | None:
4040
- Automatically redirects gs:// URLs to a local fake-GCS endpoint
4141
when testing (localhost:4443).
4242
"""
43-
import gcsfs
4443

4544
# Start with any existing options from UPath
4645
storage_options = dict(path.storage_options) if len(path.storage_options) else {}
4746

4847
# Redirect gs:// to local fake-GCS server for testing
4948
if str(path).startswith("gs://"):
49+
import gcsfs
5050
fs = gcsfs.GCSFileSystem(
5151
endpoint_url="http://localhost:4443",
5252
token="anon",
@@ -104,14 +104,14 @@ def to_mdio(
104104
compute: bool = True,
105105
region: Mapping[str, slice | Literal["auto"]] | Literal["auto"] | None = None,):
106106
"""Write dataset contents to an MDIO output_path."""
107-
import gcsfs
108107
import zarr
109108

110109
output_path = _normalize_path(output_path)
111110
zarr_format = zarr.config.get("default_zarr_format")
112111

113112
# For GCS paths, create FSMap for fake GCS server
114113
if str(output_path).startswith("gs://"):
114+
import gcsfs
115115
fs = gcsfs.GCSFileSystem(
116116
endpoint_url="http://localhost:4443",
117117
token="anon",

0 commit comments

Comments
 (0)