Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accept pathlib.Path as arguments #34

Merged
merged 9 commits into from
Mar 2, 2020
Merged
Prev Previous commit
Next Next commit
Update docstrings
  • Loading branch information
pykong committed Feb 26, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit ef9b0a2aa6c557211ff91ee142237a4162ee3e59
8 changes: 4 additions & 4 deletions pathspec/util.py
Original file line number Diff line number Diff line change
@@ -262,7 +262,7 @@ def normalize_file(file, separators=None):
"""
Normalizes the file path to use the POSIX path separator (i.e., ``'/'``).

*file* (:class:`str` or :class: `Path`) is the file path.
*file* (:class:`str`; or :class: `Path`) is the file path.

*separators* (:class:`~collections.abc.Collection` of :class:`str`; or
:data:`None`) optionally contains the path separators to normalize.
@@ -276,7 +276,7 @@ def normalize_file(file, separators=None):
# Normalize path separators.
if separators is None:
separators = NORMALIZE_PATH_SEPS
norm_file = str(file)
norm_file = str(file) # stringify pathlib.Path
for sep in separators:
norm_file = norm_file.replace(sep, posixpath.sep)

@@ -290,8 +290,8 @@ def normalize_files(files, separators=None):
"""
Normalizes the file paths to use the POSIX path separator.

*files* (:class:`~collections.abc.Iterable` of :class:`str`) contains
the file paths to be normalized.
*files* (:class:`~collections.abc.Iterable` of :class:`str`;
or :class: `Path`) contains the file paths to be normalized.

*separators* (:class:`~collections.abc.Collection` of :class:`str`; or
:data:`None`) optionally contains the path separators to normalize.