Skip to content

Commit

Permalink
chore: typing
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Oct 8, 2024
1 parent 94d593a commit 65230bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion mknodes/utils/classhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def iter_classes(
"""
mod = to_module(module)
if not mod:
return []
return
if recursive:
# seen = _seen or set()
for submod in get_submodules(mod):
Expand Down
14 changes: 7 additions & 7 deletions mknodes/utils/pathhelpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def write_file(content: str | bytes, output_path: str | os.PathLike):
output_p.parent.mkdir(parents=True, exist_ok=True)
mode = "wb" if isinstance(content, bytes) else "w"
encoding = None if "b" in mode else "utf-8"
with output_p.open(mode=mode, encoding=encoding) as f:
with output_p.open(mode=mode, encoding=encoding) as f: # type: ignore[call-overload]
f.write(content)


Expand All @@ -119,7 +119,7 @@ def write_files(mapping: Mapping[str | os.PathLike, str | bytes]):

def find_cfg_for_folder(
filename: str | pathlib.Path,
folder: os.PathLike | str = ".",
folder: os.PathLike[str] | str = ".",
) -> pathlib.Path | None:
"""Search for a file with given name in folder and its parent folders.
Expand All @@ -139,7 +139,7 @@ def find_cfg_for_folder(


@functools.cache
def load_file_cached(path: str | os.PathLike) -> str:
def load_file_cached(path: str | os.PathLike[str]) -> str:
if "://" in str(path):
return fsspec_get(str(path))
return pathlib.Path(path).read_text(encoding="utf-8")
Expand All @@ -148,10 +148,10 @@ def load_file_cached(path: str | os.PathLike) -> str:
def download_from_github(
org: str,
repo: str,
path: str | os.PathLike,
destination: str | os.PathLike,
username=None,
token=None,
path: str | os.PathLike[str],
destination: str | os.PathLike[str],
username: str | None = None,
token: str | None = None,
recursive: bool = False,
):
import fsspec
Expand Down

0 comments on commit 65230bb

Please sign in to comment.