From 3d455b3b9be21a4567d92ba7fbce87a79f318170 Mon Sep 17 00:00:00 2001 From: Christian Behrens Date: Fri, 19 Aug 2022 19:49:02 +0200 Subject: [PATCH] some more type hints for cloudpath --- cloudpathlib/cloudpath.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cloudpathlib/cloudpath.py b/cloudpathlib/cloudpath.py index be93bbc0..ce732035 100644 --- a/cloudpathlib/cloudpath.py +++ b/cloudpathlib/cloudpath.py @@ -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." @@ -346,7 +346,7 @@ 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 @@ -354,7 +354,7 @@ def glob(self, pattern): yield from self._glob(selector) - def rglob(self, pattern): + def rglob(self, pattern: str): self._glob_checks(pattern) pattern_parts = PurePosixPath(pattern).parts @@ -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 @@ -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 ====================== @@ -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