[issue37578] Change Glob: Allow Recursion for Hidden Files

2021-12-16 Thread Isaac Muse


Isaac Muse  added the comment:

If this was to be done, you'd want to make sure character sequences also match 
hidden files: [.]. Just * and ? would be incomplete. If allowing ** to match a 
leading dot, it would not match . or ..

--
nosy: +Isaac Muse

___
Python tracker 
<https://bugs.python.org/issue37578>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44380] glob.glob handling of * (asterisk) wildcard is broken

2021-06-10 Thread Isaac Muse


Isaac Muse  added the comment:

Sadly, this because pathlib glob and glob.glob use different implementations. 
And glob.glob does not provide something equivalent to a DOTALL flag allowing a 
user to glob hidden files without explicitly defining the leading dot in the 
pattern.

--
nosy: +Isaac Muse

___
Python tracker 
<https://bugs.python.org/issue44380>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue29249] Pathlib glob ** bug

2020-01-31 Thread Isaac Muse


Isaac Muse  added the comment:

I think the idea of adding a globmatch function is a decent idea.

That is what I did in a library I wrote to get more out of glob than what 
Python offered out of the box: 
https://facelessuser.github.io/wcmatch/pathlib/#purepathglobmatch. 

Specifically the differences are globmatch is just a pure match of a path, it 
doesn't do the implied `**` at the beginning of a pattern like match does. 
While it doesn't enable `**` by default, such features are controlled by flags

>>> pathlib.Path("a/b/c/d/e.txt").match('a/*/**/*', flags=pathlib.GLOBSTAR)
True

This isn't to promote my library, but more to say, as a user, I found such 
functionality worth adding. I think it would be generally nice to have such 
functionality in some form in Python by default. Maybe something called 
`globmatch` that offers that could be worthwhile.

--
nosy: +Isaac Muse

___
Python tracker 
<https://bugs.python.org/issue29249>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39532] Pathlib: handling of `.` in paths and patterns creates unmatchable paths

2020-02-02 Thread Isaac Muse


New submission from Isaac Muse :

It appears that the pathlib library strips out `.` in glob paths when they 
represent a directory. This is kind of a naive approach in my opinion, but I 
understand what was trying to be achieved.

When a path is given to pathlib, it normalizes it by stripping out 
non-essential things like `.` that represent directories, and strips out 
trailing `/` to give a path without unnecessary parts (the stripping of 
trailing `/` is another discussion).

But there is a small twist, when given an empty string or just a dot, you need 
to have something as the directory, so it allows a `.`.

So, it appears the idea was since this normalization is applied to paths, why 
not apply it to the glob patterns as well, so it does. But the special logic 
that ensures you don't have an empty string to match does not get applied to 
the glob patterns. This creates unmatchable paths:

>>> import pathlib
>>> str(pathlib.Path('.'))
'.'
>>> pathlib.Path('.').match('.')
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python36\lib\pathlib.py", line 939, in match
raise ValueError("empty pattern")
ValueError: empty pattern

I wonder if it is appropriate to apply this `.` stripping to glob patterns. 
Personally, I think the glob pattern, except for slash normalization, should 
remain unchanged, but if it is to be normalized above and beyond this, at the 
very least should use the exact same logic that is applied to the paths.

--
components: Library (Lib)
messages: 361259
nosy: Isaac Muse
priority: normal
severity: normal
status: open
title: Pathlib: handling of `.` in paths and patterns creates unmatchable paths
type: behavior
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue39532>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39532] Pathlib: handling of `.` in paths and patterns creates unmatchable paths

2020-02-02 Thread Isaac Muse


Isaac Muse  added the comment:

The more I think about this, I think the normalization of paths is actually 
fine, it is the normalization of the patterns that is problematic, or more the 
difference in normalization. I could live with the pattern normalization of `.` 
and trailing `/` if it was at least consistent with what happens in paths. I 
still find the modification of the glob pattern in this manner surprising, but 
at least it wouldn't' cause cases like this to fail.

--

___
Python tracker 
<https://bugs.python.org/issue39532>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39682] pathlib.Path objects can be used as context managers

2020-03-05 Thread Isaac Muse


Isaac Muse  added the comment:

Brace expansion does not currently exist in Python's glob. You'd have to use a 
third party module to expand the braces and then run glob on each returned 
pattern, or use a third party module that implements a glob that does it for 
you.

Shameless plug:

Brace expansion: https://github.com/facelessuser/bracex

Glob that does it for you (when the feature is enabled): 
https://github.com/facelessuser/wcmatch

Now whether Python should integrate such behavior by default is another 
question.

--
nosy: +Isaac Muse

___
Python tracker 
<https://bugs.python.org/issue39682>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39682] pathlib.Path objects can be used as context managers

2020-03-05 Thread Isaac Muse


Isaac Muse  added the comment:

Wrong thread sorry

--

___
Python tracker 
<https://bugs.python.org/issue39682>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue39856] glob : some 'unix style' glob items are not supported

2020-03-05 Thread Isaac Muse


Isaac Muse  added the comment:

Brace expansion does not currently exist in Python's glob. You'd have to use a 
third party module to expand the braces and then run glob on each returned 
pattern, or use a third party module that implements a glob that does it for 
you.

Shameless plug:

Brace expansion: https://github.com/facelessuser/bracex

Glob that does it for you (when the feature is enabled): 
https://github.com/facelessuser/wcmatch

Now whether Python should integrate such behavior by default is another 
question.

--
nosy: +Isaac Muse

___
Python tracker 
<https://bugs.python.org/issue39856>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com