Skip to content

Commit

Permalink
typing: fix errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ap-- committed Aug 27, 2023
1 parent 7900461 commit 59cff68
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions upath/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ def protocol(self) -> str:
is backed by fsspec or '' if it's backed by stdlib pathlib. For
both `fsspec.get_filesystem_class` returns `LocalFileSystem`.
"""
if self._url is None:
return ""
return self._url.scheme

@property
Expand Down
2 changes: 2 additions & 0 deletions upath/implementations/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def joinpath(self, *args):

@property
def path(self) -> str:
if self._url is None:
raise RuntimeError(str(self))
return f"{self._url.netloc}{super()._path}"


Expand Down
2 changes: 2 additions & 0 deletions upath/implementations/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,6 @@ def resolve(
@property
def path(self) -> str:
# http filesystems use the full url as path
if self._url is None:
raise RuntimeError(str(self))
return urlunsplit(self._url)
4 changes: 4 additions & 0 deletions upath/implementations/webdav.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,14 @@ def _sub_path(self, name):

@property
def protocol(self) -> str:
if self._url is None:
raise RuntimeError(str(self))
return self._url.scheme.split("+")[0]

@property
def storage_options(self) -> dict[str, Any]:
if self._url is None:
raise RuntimeError(str(self))
sopts = super().storage_options
http_protocol = self._url.scheme.split("+")[1]
assert http_protocol in {"http", "https"}
Expand Down

0 comments on commit 59cff68

Please sign in to comment.