Skip to content

Commit

Permalink
Enforce str for super method has_magic()
Browse files Browse the repository at this point in the history
  • Loading branch information
khsrali committed Jul 14, 2024
1 parent f7519a4 commit 8ebe531
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions aiida_firecrest/transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,10 +451,7 @@ def listdir(
:param recursive: If True, list directories recursively
"""
path_abs = self._cwd.joinpath(path)
names = [
p.relpath(path_abs).as_posix()
for p in path_abs.iterdir(recursive=recursive)
]
names = [p.relpath(path_abs) for p in path_abs.iterdir(recursive=recursive)]
if pattern is not None:
names = fnmatch.filter(names, pattern)
return names
Expand Down Expand Up @@ -582,7 +579,7 @@ def copy(
"Dereferencing not implemented in FirecREST server"
)

if self.has_magic(remotesource): # type: ignore
if self.has_magic(str(remotesource)): # type: ignore
for item in self.iglob(remotesource): # type: ignore
# item is of str type, so we need to split it to get the file name
filename = item.split("/")[-1] if self.isfile(item) else ""
Expand Down Expand Up @@ -833,7 +830,7 @@ def get(
self.gettree(remote, localpath)
elif remote.is_file():
self.getfile(remote, localpath)
elif self.has_magic(remotepath): # type: ignore
elif self.has_magic(str(remotepath)): # type: ignore
for item in self.iglob(remotepath): # type: ignore
# item is of str type, so we need to split it to get the file name
filename = item.split("/")[-1] if self.isfile(item) else ""
Expand Down Expand Up @@ -1046,7 +1043,7 @@ def put(
if not local.is_absolute():
raise ValueError("The localpath must be an absolute path")

if self.has_magic(localpath): # type: ignore
if self.has_magic(str(localpath)): # type: ignore
for item in self.iglob(localpath): # type: ignore
# item is of str type, so we need to split it to get the file name
filename = item.split("/")[-1] if self.isfile(item) else ""
Expand Down

0 comments on commit 8ebe531

Please sign in to comment.