Skip to content

Commit

Permalink
Update pathlib references in the general module
Browse files Browse the repository at this point in the history
  • Loading branch information
willGraham01 committed Apr 10, 2024
1 parent d15d80e commit fa80834
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
8 changes: 7 additions & 1 deletion brainglobe_utils/general/pathlib.py
Original file line number Diff line number Diff line change
@@ -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

Check warning on line 4 in brainglobe_utils/general/pathlib.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_utils/general/pathlib.py#L4

Added line #L4 was not covered by tests


def append_to_pathlib_stem(path: "Path", string_to_append):
"""
Appends a string to the stem of a pathlib object.
Expand Down
17 changes: 11 additions & 6 deletions brainglobe_utils/general/string.py
Original file line number Diff line number Diff line change
@@ -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

Check warning on line 8 in brainglobe_utils/general/string.py

View check run for this annotation

Codecov / codecov/patch

brainglobe_utils/general/string.py#L8

Added line #L8 was not covered by tests


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.
Expand Down

0 comments on commit fa80834

Please sign in to comment.