Skip to content
Merged
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
28 changes: 21 additions & 7 deletions upath/implementations/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@
class CloudPath(UPath):
__slots__ = ()

def __init__(
self, *args, protocol: str | None = None, **storage_options: Any
) -> None:
super().__init__(*args, protocol=protocol, **storage_options)
if not self.drive and len(self.parts) > 1:
raise ValueError("non key-like path provided (bucket/container missing)")

@classmethod
def _transform_init_args(
cls,
Expand Down Expand Up @@ -71,6 +64,13 @@ def relative_to(self, other, /, *_deprecated, walk_up=False):
class GCSPath(CloudPath):
__slots__ = ()

def __init__(
self, *args, protocol: str | None = None, **storage_options: Any
) -> None:
super().__init__(*args, protocol=protocol, **storage_options)
if not self.drive and len(self.parts) > 1:
raise ValueError("non key-like path provided (bucket/container missing)")

def mkdir(
self, mode: int = 0o777, parents: bool = False, exist_ok: bool = False
) -> None:
Expand All @@ -84,6 +84,20 @@ def mkdir(
class S3Path(CloudPath):
__slots__ = ()

def __init__(
self, *args, protocol: str | None = None, **storage_options: Any
) -> None:
super().__init__(*args, protocol=protocol, **storage_options)
if not self.drive and len(self.parts) > 1:
raise ValueError("non key-like path provided (bucket/container missing)")


class AzurePath(CloudPath):
__slots__ = ()

def __init__(
self, *args, protocol: str | None = None, **storage_options: Any
) -> None:
super().__init__(*args, protocol=protocol, **storage_options)
if not self.drive and len(self.parts) > 1:
raise ValueError("non key-like path provided (bucket/container missing)")