diff --git a/brainglobe_utils/general/pathlib.py b/brainglobe_utils/general/pathlib.py index 0f5845d..1f90e85 100644 --- a/brainglobe_utils/general/pathlib.py +++ b/brainglobe_utils/general/pathlib.py @@ -1,4 +1,10 @@ -def append_to_pathlib_stem(path, string_to_append): +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from pathlib import Path + + +def append_to_pathlib_stem(path: "Path", string_to_append): """ Appends a string to the stem of a pathlib object. diff --git a/brainglobe_utils/general/string.py b/brainglobe_utils/general/string.py index b7702de..7663ad3 100644 --- a/brainglobe_utils/general/string.py +++ b/brainglobe_utils/general/string.py @@ -1,15 +1,20 @@ +from typing import TYPE_CHECKING, Optional + from natsort import natsorted from brainglobe_utils.general import list +if TYPE_CHECKING: + from pathlib import Path + def get_text_lines( - file, - return_lines=None, - rstrip=True, - sort=False, - remove_empty_lines=True, - encoding="utf8", + file: "Path", + return_lines: Optional[int] = None, + rstrip: Optional[bool] = True, + sort: Optional[bool] = False, + remove_empty_lines: Optional[bool] = True, + encoding: Optional[str] = "utf8", ): """ Return only the nth line of a text file.