GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GH-101112: Provide pattern overview for `Path.glob` by jugmac00 · Pull Request #101223 · python/cpython

Conversation

@jugmac00

@jugmac00 jugmac00 commented Jan 21, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Provide an overview of available patterns for Path.glob and reference it from Path.rglob and Path.match.

  • Issue: Path.rglob -> documentation does not specify what pattern is #101112

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@jugmac00
jugmac00 requested a review from barneygale as a code owner January 21, 2023 15:39
@bedevere-bot bedevere-bot added the awaiting review label Jan 21, 2023
@bedevere-bot bedevere-bot mentioned this pull request Jan 21, 2023
Path.rglob -> documentation does not specify what pattern is #101112
Closed
@bedevere-bot bedevere-bot added docs Documentation in the Doc dir skip news labels Jan 21, 2023
@jugmac00
jugmac00 force-pushed the show-syntax-table-for-path-pattern branch from 9365d78 to 8510576 Compare January 21, 2023 15:39
@jugmac00 jugmac00 changed the title GH-101112: Provide pattern overview for Path.glob GH-101112: Provide pattern overview for Path.glob Jan 21, 2023
@jugmac00 jugmac00 mentioned this pull request Jan 21, 2023
GH-101112: Specify type of pattern for Path.rglob #101132
Merged
@barneygale

barneygale commented Jan 21, 2023

Copy link
Copy Markdown
Contributor

Thanks for the PR, this will be very helpful.

The table isn't quite right:

  • ** doesn't match everything - it matches any number of nested directories.
  • The other wildcards (*, [seq], [!seq]) never match directory separators. They only match parts of file or directory names.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jugmac00
jugmac00 force-pushed the show-syntax-table-for-path-pattern branch from 55b0bb1 to 23b12d4 Compare January 21, 2023 16:52
@jugmac00

jugmac00 commented Jan 21, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor Author

@barneygale Thanks for catching. I copied the fnmatch table for the layout and missed to update it with the information you provided. Sorry for that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

barneygale
barneygale requested changes Jan 21, 2023
View reviewed changes
Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread Doc/library/pathlib.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added awaiting core review and removed awaiting review labels Jan 21, 2023
@jugmac00
jugmac00 force-pushed the show-syntax-table-for-path-pattern branch from 7062317 to ab1f568 Compare January 21, 2023 19:49
@jugmac00

jugmac00 commented Jan 21, 2023

Copy link
Copy Markdown
Contributor Author

@barneygale Thanks for being patient and driving me through this PR.

I applied your requested changes, but I think I am a bit lost regarding the fine details. I probably misinterpreted your comment in #101112 (comment) where you mentioned that that fnmatch reference is not correct.

I am happy to further update this PR, but feel free to directly push to it if you see anything to be improved to get this PR moved forwards.

Thanks a lot for your time!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jugmac00 @barneygale
pythonGH-101112: Provide pattern overview for Path.glob
6fc4c85
Provide an overview of available patterns for `Path.glob` and reference
it from `Path.rglob` and `Path.match`.

Co-authored-by: Barney Gale <[email protected]>
@jugmac00
jugmac00 force-pushed the show-syntax-table-for-path-pattern branch from ab1f568 to 6fc4c85 Compare January 21, 2023 20:04
@barneygale
barneygale self-requested a review January 27, 2023 03:34
@barneygale
Merge branch 'main' into show-syntax-table-for-path-pattern
e6eb316
barneygale
barneygale requested changes Jun 2, 2023
View reviewed changes
Comment thread Doc/library/pathlib.rst
Match this path against the provided glob-style pattern. Return ``True``
if matching is successful, ``False`` otherwise.
Match this path against the provided glob-style pattern. The pattern uses
the same format as in :func:`Path.glob`. Return ``True`` if matching is

@barneygale barneygale Jun 2, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the same format as in :func:`Path.glob`. Return ``True`` if matching is
the same format as in :meth:`Path.glob`. Return ``True`` if matching is

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread Doc/library/pathlib.rst
Glob the given relative *pattern* recursively. This is like calling
:func:`Path.glob` with "``**/``" added in front of the *pattern*, where
*patterns* are the same as for :mod:`fnmatch`::
:func:`Path.glob` with "``**/``" added in front of the *pattern*::

@barneygale barneygale Jun 2, 2023

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
:func:`Path.glob` with "``**/``" added in front of the *pattern*::
:meth:`~Path.glob` with "``**/``" added in front of the *pattern*::

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-bot bedevere-bot added awaiting changes and removed awaiting core review labels Jun 2, 2023
@bedevere-bot

bedevere-bot commented Jun 2, 2023

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale

barneygale commented Jun 2, 2023

Copy link
Copy Markdown
Contributor

Sorry for the long delay. PurePath.match() now supports **/ tokens, so I've removed the bit about it being different to glob().

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale barneygale added the topic-pathlib label Jun 2, 2023
@barneygale barneygale mentioned this pull request Jul 14, 2023
Glob behavior is inconsistent across libraries #106747
Closed
@barneygale

barneygale commented Feb 26, 2024

Copy link
Copy Markdown
Contributor

Issue was fixed in #114030, so I'm closing this PR. Thanks all the same.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@barneygale barneygale closed this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@barneygale barneygale barneygale requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting changes docs Documentation in the Doc dir skip news topic-pathlib

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jugmac00 @barneygale @bedevere-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.