Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpin fsspec in dev requirements #342

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions ome_zarr/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,27 +159,45 @@ def get_json(self, subpath: str) -> JSONDict:
return {}

def parts(self) -> List[str]:
if self.__store.fs.protocol == "file":
if self._isfile():
return list(Path(self.__path).parts)
else:
return self.__path.split("/")

def subpath(self, subpath: str = "") -> str:
if self.__store.fs.protocol == "file":
if self._isfile():
filename = Path(self.__path) / subpath
filename = filename.resolve()
return str(filename)
if self.__store.fs.protocol in ["http", "https"]:
elif self._ishttp():
url = str(self.__path)
if not url.endswith("/"):
url = f"{url}/"
return urljoin(url, subpath)
else:
# Might require a warning
if self.__path.endswith("/"):
return f"{self.__path}{subpath}"
else:
return f"{self.__path}/{subpath}"

def _isfile(self) -> bool:
"""
Return whether the current underlying implementation
points to a local file or not.
"""
return self.__store.fs.protocol == "file" or self.__store.fs.protocol == (
"file",
"local",
)

def _ishttp(self) -> bool:
"""
Return whether the current underlying implementation
points to a URL
"""
return self.__store.fs.protocol in ["http", "https"]


def parse_url(
path: Union[Path, str], mode: str = "r", fmt: Format = CurrentFormat()
Expand Down
2 changes: 1 addition & 1 deletion requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fsspec==2023.6.0
fsspec
black
cython >= 0.29.16
numpy >= 1.16.0
Expand Down
Loading