Skip to content

Commit

Permalink
some more type hints for cloudpath
Browse files Browse the repository at this point in the history
  • Loading branch information
chbehrens committed Aug 19, 2022
1 parent 6ec1652 commit 3d455b3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions cloudpathlib/cloudpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def exists(self) -> bool:
def fspath(self) -> str:
return self.__fspath__()

def _glob_checks(self, pattern):
def _glob_checks(self, pattern: str):
if ".." in pattern:
raise CloudPathNotImplementedError(
"Relative paths with '..' not supported in glob patterns."
Expand All @@ -346,15 +346,15 @@ def _glob(self, selector):
for p in selector.select_from(root):
yield self.client.CloudPath(f"{self.cloud_prefix}{self.drive}{p}")

def glob(self, pattern):
def glob(self, pattern: str):
self._glob_checks(pattern)

pattern_parts = PurePosixPath(pattern).parts
selector = _make_selector(tuple(pattern_parts), _posix_flavour)

yield from self._glob(selector)

def rglob(self, pattern):
def rglob(self, pattern: str):
self._glob_checks(pattern)

pattern_parts = PurePosixPath(pattern).parts
Expand Down Expand Up @@ -566,7 +566,7 @@ def relative_to(self, other):
)
return self._path.relative_to(other._path)

def is_relative_to(self, other):
def is_relative_to(self, other) -> bool:
try:
self.relative_to(other)
return True
Expand Down Expand Up @@ -612,10 +612,10 @@ def suffix(self):
def suffixes(self):
return self._dispatch_to_path("suffixes")

def with_name(self, name):
def with_name(self, name: str):
return self._dispatch_to_path("with_name", name)

def with_suffix(self, suffix):
def with_suffix(self, suffix: str):
return self._dispatch_to_path("with_suffix", suffix)

# ====================== DISPATCHED TO LOCAL CACHE FOR CONCRETE PATHS ======================
Expand Down Expand Up @@ -1001,7 +1001,7 @@ def _filter_children(self, rel_to):
}

@staticmethod
def _is_relative_to(maybe_child, maybe_parent):
def _is_relative_to(maybe_child, maybe_parent) -> bool:
try:
maybe_child.relative_to(maybe_parent)
return True
Expand Down

0 comments on commit 3d455b3

Please sign in to comment.