Skip to content

Commit

Permalink
Add limited feature for #65
Browse files Browse the repository at this point in the history
  • Loading branch information
cpburnz committed Dec 10, 2022
1 parent 0ce4533 commit 5cd8392
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
4 changes: 3 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ Change History
==============


0.10.3 (TBD)
0.10.3 (TDB)
------------

Improvements:

- `Issue #65`_: Checking directories via match_file() does not work on Path objects.
- `Issue #66`_/`Pull #67`_: Package not marked as py.typed.
- `Issue #68`_: Exports are considered private.
- `Issue #70`_/`Pull #71`_: 'Self' string literal type is Unknown in pyright.


.. _`Issue #65`: https://github.com/cpburnz/python-pathspec/issues/65
.. _`Issue #66`: https://github.com/cpburnz/python-pathspec/issues/66
.. _`Pull #67`: https://github.com/cpburnz/python-pathspec/pull/67
.. _`Issue #68`: https://github.com/cpburnz/python-pathspec/issues/68
Expand Down
19 changes: 19 additions & 0 deletions pathspec/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import os
import os.path
import pathlib
import posixpath
import stat
import warnings
Expand Down Expand Up @@ -48,6 +49,24 @@
"""


def append_dir_sep(path: pathlib.Path) -> str:
"""
Appends the path separator to the path if the path is a directory.
This can be used to aid in distinguishing between directories and
files on the file-system by relying on the presence of a trailing path
separator.
*path* (:class:`pathlib.path`) is the path to use.
Returns the path (:class:`str`).
"""
str_path = str(path)
if path.is_dir():
str_path += os.sep

return str_path


def detailed_match_files(
patterns: Iterable[Pattern],
files: Iterable[str],
Expand Down

0 comments on commit 5cd8392

Please sign in to comment.