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

match_files with negated path spec #80

Closed
oprypin opened this issue May 18, 2023 · 5 comments
Closed

match_files with negated path spec #80

oprypin opened this issue May 18, 2023 · 5 comments

Comments

@oprypin
Copy link

oprypin commented May 18, 2023

Hi. Thanks for the project.

The path spec concept seems to be inspired by gitignore, but I can't find a convenient way to use it as an actual ignore pattern.
That is, write a spec, and then find all files under a directory that do not match it

@oprypin
Copy link
Author

oprypin commented May 18, 2023

Some ideas on how it could be achieved:

  1. Add a method to PathSpec to negate the whole spec and return a spec with everything flipped.
    A bit similar to

    def __add__(self: Self, other: "PathSpec") -> Self:

  2. Add a method to PathSpec to negate the whole spec and return a wrapper object that has a negated match_file method. (note: until this functionality is in the library, making such a wrapper myself seems quite feasible in the meantime)

  3. Add a "negate" parameter to match_tree_files
    https://github.com/cpburnz/python-pathspec/blob/933dd7da982551300a584c98570993402a56bc27/pathspec/pathspec.py#L267-L268C19
    pass it on to match_files and negate the condition accordingly

    if self._match_file(use_patterns, norm_file):

@oprypin
Copy link
Author

oprypin commented May 18, 2023

  1. Add a "negate" parameter to from_lines which flips the include of each parsed line

@cpburnz
Copy link
Owner

cpburnz commented May 18, 2023

The most convenient way to find files under a directory, and exclude some based upon gitignore patterns is to treat the files as sets, and perform operations from there:

import pathspec
import pathspec.util

ignore_spec = pathspec.GitIgnoreSpec.from_lines([
    "*.txt",
    # ...
])

all_files = set(pathspec.util.iter_tree_files("/some/directory"))
ignore_files = set(ignore_spec.match_files(all_files))
keep_files = all_files - ignore_files

I think your 3rd suggestion of adding a negate parameter to PathSpec.match_tree_files() would be the safest way to make this easier. Gitignore has peculiar edge cases that I don't think would behave properly if every match was simply negated. Implementing the logic at the tree level would allow using the file iterator intelligently without having to consume the whole thing in 2 or 3 sets.

@oprypin
Copy link
Author

oprypin commented May 19, 2023

Yes, a negate parameter seems to be the right approach, and indeed I was running into all kinds of edge cases otherwise.

The current approach with scanning the directory tree twice does not seem optimal to me :(

Meanwhile I also realized that there is a decently convenient way in the current state as well, without pulling too much of internals with it:

def match_files_negated(exclude: pathspec.PathSpec, root: str) -> Iterable[str]:
    for path in pathspec.util.iter_tree_files(root):
        if not exclude.match_file(path):
            yield path

@cpburnz
Copy link
Owner

cpburnz commented Jul 29, 2023

The negate parameter for PathSpec.match_files() and related methods has been implemented and is in the new v0.11.2 release.

@cpburnz cpburnz closed this as completed Jul 29, 2023
VadVergasov referenced this issue in VadVergasov/MailRedirector Aug 1, 2023
Bumps [pathspec](https://github.com/cpburnz/python-pathspec) from 0.11.1
to 0.11.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/releases">pathspec's
releases</a>.</em></p>
<blockquote>
<h2>v0.11.2</h2>
<p>Release v0.11.2. See <a
href="https://github.com/cpburnz/python-pathspec/blob/v0.11.2/CHANGES.rst">CHANGES.rst</a>.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst">pathspec's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.2 (2023-07-28)</h2>
<p>New features:</p>
<ul>
<li><code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>_:
match_files with negated path spec.
<code>pathspec.PathSpec.match_*()</code> now have a <code>negate</code>
parameter to make using <em>.gitignore</em> logic easier and more
efficient.</li>
</ul>
<p>Bug fixes:</p>
<ul>
<li><code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>_: Add
edge case: patterns that end with an escaped space</li>
<li><code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code><em>/<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code></em>:
Negate with caret symbol as with the exclamation mark.</li>
</ul>
<p>.. _<code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/76">cpburnz/python-pathspec#76</a>
.. _<code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/77">cpburnz/python-pathspec#77</a>
.. _<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/78/">cpburnz/python-pathspec#78</a>
.. _<code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/80">cpburnz/python-pathspec#80</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/878be226c5324a4c5470c2ff86034d27c0734d70"><code>878be22</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/c0aca9fa0fe4aaa7967beb717f726ed36d9ab2fe"><code>c0aca9f</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/fb2246c0b50b95803b8abee2b2bfbdca39850918"><code>fb2246c</code></a>
Implement issue 80</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/933dd7da982551300a584c98570993402a56bc27"><code>933dd7d</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/dfb630b7bd42956bdd6834c651806d010e01e5f6"><code>dfb630b</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/cebf13fe5c986178d277bc7e01baa28fd10742d2"><code>cebf13f</code></a>
Merge pull request <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/78">#78</a>
from tomruk/caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/518db79aa414816ac41b752e94ddb1b25850304d"><code>518db79</code></a>
Merge branch 'master' into caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/57fbd3ed69597d35a50c56446d60e2c17ab04baf"><code>57fbd3e</code></a>
Pass caret negation</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/6b58e23b6038051fb2d690691912bca3dffcde97"><code>6b58e23</code></a>
Negate with caret symbol as with the exclamation mark</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/b9a014e560af033591d8cfe7734deb929cc52f67"><code>b9a014e</code></a>
Update CHANGES</li>
<li>Additional commits viewable in <a
href="https://github.com/cpburnz/python-pathspec/compare/v0.11.1...v0.11.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pathspec&package-manager=pip&previous-version=0.11.1&new-version=0.11.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
VadVergasov referenced this issue in VadVergasov/HometaskBot Aug 1, 2023
Bumps [pathspec](https://github.com/cpburnz/python-pathspec) from 0.11.1
to 0.11.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/releases">pathspec's
releases</a>.</em></p>
<blockquote>
<h2>v0.11.2</h2>
<p>Release v0.11.2. See <a
href="https://github.com/cpburnz/python-pathspec/blob/v0.11.2/CHANGES.rst">CHANGES.rst</a>.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst">pathspec's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.2 (2023-07-28)</h2>
<p>New features:</p>
<ul>
<li><code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>_:
match_files with negated path spec.
<code>pathspec.PathSpec.match_*()</code> now have a <code>negate</code>
parameter to make using <em>.gitignore</em> logic easier and more
efficient.</li>
</ul>
<p>Bug fixes:</p>
<ul>
<li><code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>_: Add
edge case: patterns that end with an escaped space</li>
<li><code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code><em>/<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code></em>:
Negate with caret symbol as with the exclamation mark.</li>
</ul>
<p>.. _<code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/76">cpburnz/python-pathspec#76</a>
.. _<code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/77">cpburnz/python-pathspec#77</a>
.. _<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/78/">cpburnz/python-pathspec#78</a>
.. _<code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/80">cpburnz/python-pathspec#80</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/878be226c5324a4c5470c2ff86034d27c0734d70"><code>878be22</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/c0aca9fa0fe4aaa7967beb717f726ed36d9ab2fe"><code>c0aca9f</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/fb2246c0b50b95803b8abee2b2bfbdca39850918"><code>fb2246c</code></a>
Implement issue 80</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/933dd7da982551300a584c98570993402a56bc27"><code>933dd7d</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/dfb630b7bd42956bdd6834c651806d010e01e5f6"><code>dfb630b</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/cebf13fe5c986178d277bc7e01baa28fd10742d2"><code>cebf13f</code></a>
Merge pull request <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/78">#78</a>
from tomruk/caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/518db79aa414816ac41b752e94ddb1b25850304d"><code>518db79</code></a>
Merge branch 'master' into caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/57fbd3ed69597d35a50c56446d60e2c17ab04baf"><code>57fbd3e</code></a>
Pass caret negation</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/6b58e23b6038051fb2d690691912bca3dffcde97"><code>6b58e23</code></a>
Negate with caret symbol as with the exclamation mark</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/b9a014e560af033591d8cfe7734deb929cc52f67"><code>b9a014e</code></a>
Update CHANGES</li>
<li>Additional commits viewable in <a
href="https://github.com/cpburnz/python-pathspec/compare/v0.11.1...v0.11.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pathspec&package-manager=pip&previous-version=0.11.1&new-version=0.11.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
VadVergasov referenced this issue in VadVergasov/vkparserbot Aug 1, 2023
Bumps [pathspec](https://github.com/cpburnz/python-pathspec) from 0.11.1
to 0.11.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/releases">pathspec's
releases</a>.</em></p>
<blockquote>
<h2>v0.11.2</h2>
<p>Release v0.11.2. See <a
href="https://github.com/cpburnz/python-pathspec/blob/v0.11.2/CHANGES.rst">CHANGES.rst</a>.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst">pathspec's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.2 (2023-07-28)</h2>
<p>New features:</p>
<ul>
<li><code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>_:
match_files with negated path spec.
<code>pathspec.PathSpec.match_*()</code> now have a <code>negate</code>
parameter to make using <em>.gitignore</em> logic easier and more
efficient.</li>
</ul>
<p>Bug fixes:</p>
<ul>
<li><code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>_: Add
edge case: patterns that end with an escaped space</li>
<li><code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code><em>/<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code></em>:
Negate with caret symbol as with the exclamation mark.</li>
</ul>
<p>.. _<code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/76">cpburnz/python-pathspec#76</a>
.. _<code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/77">cpburnz/python-pathspec#77</a>
.. _<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/78/">cpburnz/python-pathspec#78</a>
.. _<code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/80">cpburnz/python-pathspec#80</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/878be226c5324a4c5470c2ff86034d27c0734d70"><code>878be22</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/c0aca9fa0fe4aaa7967beb717f726ed36d9ab2fe"><code>c0aca9f</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/fb2246c0b50b95803b8abee2b2bfbdca39850918"><code>fb2246c</code></a>
Implement issue 80</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/933dd7da982551300a584c98570993402a56bc27"><code>933dd7d</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/dfb630b7bd42956bdd6834c651806d010e01e5f6"><code>dfb630b</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/cebf13fe5c986178d277bc7e01baa28fd10742d2"><code>cebf13f</code></a>
Merge pull request <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/78">#78</a>
from tomruk/caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/518db79aa414816ac41b752e94ddb1b25850304d"><code>518db79</code></a>
Merge branch 'master' into caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/57fbd3ed69597d35a50c56446d60e2c17ab04baf"><code>57fbd3e</code></a>
Pass caret negation</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/6b58e23b6038051fb2d690691912bca3dffcde97"><code>6b58e23</code></a>
Negate with caret symbol as with the exclamation mark</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/b9a014e560af033591d8cfe7734deb929cc52f67"><code>b9a014e</code></a>
Update CHANGES</li>
<li>Additional commits viewable in <a
href="https://github.com/cpburnz/python-pathspec/compare/v0.11.1...v0.11.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pathspec&package-manager=pip&previous-version=0.11.1&new-version=0.11.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
stujfiter referenced this issue in slalombuild/secureli Aug 2, 2023
Bumps [pathspec](https://github.com/cpburnz/python-pathspec) from 0.11.1
to 0.11.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/releases">pathspec's
releases</a>.</em></p>
<blockquote>
<h2>v0.11.2</h2>
<p>Release v0.11.2. See <a
href="https://github.com/cpburnz/python-pathspec/blob/v0.11.2/CHANGES.rst">CHANGES.rst</a>.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst">pathspec's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.2 (2023-07-28)</h2>
<p>New features:</p>
<ul>
<li><code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>_:
match_files with negated path spec.
<code>pathspec.PathSpec.match_*()</code> now have a <code>negate</code>
parameter to make using <em>.gitignore</em> logic easier and more
efficient.</li>
</ul>
<p>Bug fixes:</p>
<ul>
<li><code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>_: Add
edge case: patterns that end with an escaped space</li>
<li><code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code><em>/<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code></em>:
Negate with caret symbol as with the exclamation mark.</li>
</ul>
<p>.. _<code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/76">cpburnz/python-pathspec#76</a>
.. _<code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/77">cpburnz/python-pathspec#77</a>
.. _<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/78/">cpburnz/python-pathspec#78</a>
.. _<code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/80">cpburnz/python-pathspec#80</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/878be226c5324a4c5470c2ff86034d27c0734d70"><code>878be22</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/c0aca9fa0fe4aaa7967beb717f726ed36d9ab2fe"><code>c0aca9f</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/fb2246c0b50b95803b8abee2b2bfbdca39850918"><code>fb2246c</code></a>
Implement issue 80</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/933dd7da982551300a584c98570993402a56bc27"><code>933dd7d</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/dfb630b7bd42956bdd6834c651806d010e01e5f6"><code>dfb630b</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/cebf13fe5c986178d277bc7e01baa28fd10742d2"><code>cebf13f</code></a>
Merge pull request <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/78">#78</a>
from tomruk/caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/518db79aa414816ac41b752e94ddb1b25850304d"><code>518db79</code></a>
Merge branch 'master' into caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/57fbd3ed69597d35a50c56446d60e2c17ab04baf"><code>57fbd3e</code></a>
Pass caret negation</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/6b58e23b6038051fb2d690691912bca3dffcde97"><code>6b58e23</code></a>
Negate with caret symbol as with the exclamation mark</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/b9a014e560af033591d8cfe7734deb929cc52f67"><code>b9a014e</code></a>
Update CHANGES</li>
<li>Additional commits viewable in <a
href="https://github.com/cpburnz/python-pathspec/compare/v0.11.1...v0.11.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pathspec&package-manager=pip&previous-version=0.11.1&new-version=0.11.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: stujfiter <korey.earl@gmail.com>
ianlewis referenced this issue in ianlewis/todos Aug 18, 2023
Bumps [pathspec](https://github.com/cpburnz/python-pathspec) from 0.11.1
to 0.11.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/releases">pathspec's
releases</a>.</em></p>
<blockquote>
<h2>v0.11.2</h2>
<p>Release v0.11.2. See <a
href="https://github.com/cpburnz/python-pathspec/blob/v0.11.2/CHANGES.rst">CHANGES.rst</a>.</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/cpburnz/python-pathspec/blob/master/CHANGES.rst">pathspec's
changelog</a>.</em></p>
<blockquote>
<h2>0.11.2 (2023-07-28)</h2>
<p>New features:</p>
<ul>
<li><code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>_:
match_files with negated path spec.
<code>pathspec.PathSpec.match_*()</code> now have a <code>negate</code>
parameter to make using <em>.gitignore</em> logic easier and more
efficient.</li>
</ul>
<p>Bug fixes:</p>
<ul>
<li><code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>_: Add
edge case: patterns that end with an escaped space</li>
<li><code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code><em>/<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code></em>:
Negate with caret symbol as with the exclamation mark.</li>
</ul>
<p>.. _<code>Pull
[#76](https://github.com/cpburnz/python-pathspec/issues/76)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/76">cpburnz/python-pathspec#76</a>
.. _<code>Issue
[#77](https://github.com/cpburnz/python-pathspec/issues/77)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/77">cpburnz/python-pathspec#77</a>
.. _<code>Pull
[#78](https://github.com/cpburnz/python-pathspec/issues/78)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/pull/78/">cpburnz/python-pathspec#78</a>
.. _<code>Issue
[#80](https://github.com/cpburnz/python-pathspec/issues/80)</code>: <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/80">cpburnz/python-pathspec#80</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/878be226c5324a4c5470c2ff86034d27c0734d70"><code>878be22</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/c0aca9fa0fe4aaa7967beb717f726ed36d9ab2fe"><code>c0aca9f</code></a>
Release v0.11.2</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/fb2246c0b50b95803b8abee2b2bfbdca39850918"><code>fb2246c</code></a>
Implement issue 80</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/933dd7da982551300a584c98570993402a56bc27"><code>933dd7d</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/dfb630b7bd42956bdd6834c651806d010e01e5f6"><code>dfb630b</code></a>
Update CHANGES</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/cebf13fe5c986178d277bc7e01baa28fd10742d2"><code>cebf13f</code></a>
Merge pull request <a
href="https://redirect.github.com/cpburnz/python-pathspec/issues/78">#78</a>
from tomruk/caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/518db79aa414816ac41b752e94ddb1b25850304d"><code>518db79</code></a>
Merge branch 'master' into caret-symbol</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/57fbd3ed69597d35a50c56446d60e2c17ab04baf"><code>57fbd3e</code></a>
Pass caret negation</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/6b58e23b6038051fb2d690691912bca3dffcde97"><code>6b58e23</code></a>
Negate with caret symbol as with the exclamation mark</li>
<li><a
href="https://github.com/cpburnz/python-pathspec/commit/b9a014e560af033591d8cfe7734deb929cc52f67"><code>b9a014e</code></a>
Update CHANGES</li>
<li>Additional commits viewable in <a
href="https://github.com/cpburnz/python-pathspec/compare/v0.11.1...v0.11.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pathspec&package-manager=pip&previous-version=0.11.1&new-version=0.11.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
ramonpetgrave64 referenced this issue in slsa-framework/slsa-github-generator May 16, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [pathspec](https://togithub.com/cpburnz/python-pathspec) | `==0.11.1`
-> `==0.12.1` |
[![age](https://developer.mend.io/api/mc/badges/age/pypi/pathspec/0.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/pypi/pathspec/0.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/pypi/pathspec/0.11.1/0.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/pypi/pathspec/0.11.1/0.12.1?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>cpburnz/python-pathspec (pathspec)</summary>

###
[`v0.12.1`](https://togithub.com/cpburnz/python-pathspec/blob/HEAD/CHANGES.rst#0121-2023-12-10)

[Compare
Source](https://togithub.com/cpburnz/python-pathspec/compare/v0.12.0...v0.12.1)

Bug fixes:

- `Issue #&#8203;84`\_: PathSpec.match_file() returns None since 0.12.0.

.. \_`Issue #&#8203;84`:
[https://github.com/cpburnz/python-pathspec/issues/84](https://togithub.com/cpburnz/python-pathspec/issues/84)

###
[`v0.12.0`](https://togithub.com/cpburnz/python-pathspec/blob/HEAD/CHANGES.rst#0120-2023-12-09)

[Compare
Source](https://togithub.com/cpburnz/python-pathspec/compare/v0.11.2...v0.12.0)

Major changes:

-   Dropped support of EOL Python 3.7. See `Pull #&#8203;82`\_.

API changes:

- Signature of protected method
`pathspec.pathspec.PathSpec._match_file()` (with a leading underscore)
has been changed from `def _match_file(patterns: Iterable[Pattern],
file: str) -> bool` to `def _match_file(patterns: Iterable[Tuple[int,
Pattern]], file: str) -> Tuple[Optional[bool], Optional[int]]`.

New features:

- Added `pathspec.pathspec.PathSpec.check_*()` methods. These methods
behave similarly to `.match_*()` but return additional information in
the `pathspec.util.CheckResult` objects (e.g., `CheckResult.index`
indicates the index of the last pattern that matched the file).
- Added `pathspec.pattern.RegexPattern.pattern` attribute which stores
the original, uncompiled pattern.

Bug fixes:

-   `Issue #&#8203;81`\_: GitIgnoreSpec behaviors differ from git.
-   `Pull #&#8203;83`\_: Fix ReadTheDocs builds.

Improvements:

-   Mark Python 3.12 as supported. See `Pull #&#8203;82`\_.
-   Improve test debugging.
- Improve type hint on *on_error* parameter on
`pathspec.pathspec.PathSpec.match_tree_entries()`.
- Improve type hint on *on_error* parameter on
`pathspec.util.iter_tree_entries()`.

.. \_`Issue #&#8203;81`:
[https://github.com/cpburnz/python-pathspec/issues/81](https://togithub.com/cpburnz/python-pathspec/issues/81)
.. \_`Pull #&#8203;82`:
[https://github.com/cpburnz/python-pathspec/pull/82](https://togithub.com/cpburnz/python-pathspec/pull/82)
.. \_`Pull #&#8203;83`:
[https://github.com/cpburnz/python-pathspec/pull/83](https://togithub.com/cpburnz/python-pathspec/pull/83)

###
[`v0.11.2`](https://togithub.com/cpburnz/python-pathspec/blob/HEAD/CHANGES.rst#0112-2023-07-28)

[Compare
Source](https://togithub.com/cpburnz/python-pathspec/compare/v0.11.1...v0.11.2)

New features:

- `Issue #&#8203;80`\_: match_files with negated path spec.
`pathspec.PathSpec.match_*()` now have a `negate` parameter to make
using *.gitignore* logic easier and more efficient.

Bug fixes:

- `Pull #&#8203;76`\_: Add edge case: patterns that end with an escaped
space
- `Issue #&#8203;77`*/`Pull #&#8203;78`*: Negate with caret symbol as
with the exclamation mark.

.. \_`Pull #&#8203;76`:
[https://github.com/cpburnz/python-pathspec/pull/76](https://togithub.com/cpburnz/python-pathspec/pull/76)
.. \_`Issue #&#8203;77`:
[https://github.com/cpburnz/python-pathspec/issues/77](https://togithub.com/cpburnz/python-pathspec/issues/77)
.. \_`Pull #&#8203;78`:
[https://github.com/cpburnz/python-pathspec/pull/78](https://togithub.com/cpburnz/python-pathspec/pull/78)/
.. \_`Issue #&#8203;80`:
[https://github.com/cpburnz/python-pathspec/issues/80](https://togithub.com/cpburnz/python-pathspec/issues/80)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on the first day of the
month" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/slsa-framework/slsa-github-generator).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNjMuNSIsInVwZGF0ZWRJblZlciI6IjM3LjM2My41IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Signed-off-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: Ramon Petgrave <32398091+ramonpetgrave64@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants