Commit graph

9 commits

Author SHA1 Message Date
b288cca519
Rewrite a lot of pathclass, spinal.walk using tuple-based Path.
I was inspired by the idea of "making impossible states impossible"
and using a data model that accurately represents what we intend for
it to represent. Instead of storing the path as a string where "it's
a string but actually you're supposed to know that the parts between
os.seps are different parts and the first one is special and...", we
can use a data model that directly says that. Storing the path as a
tuple of (Drive, Part, Part) helps me focus on the semantics of the
Path as a collection of parts joined by the os.sep.

Furthermore, storing the path as a string made some operations slow.
Every time we call one of the os.path functions with a string, it
has to do a lot of normalization and edge-case handling even when we
know it wouldn't be needed. By storing the path as a tuple, we can
instantly get the drive name, parent dir name, and basename without
asking os.path to split it for us every single time. It also makes
relative path / common ancestor checks a lot easier to understand.
Fewer operations need to go into the slow functions.
2021-11-30 21:16:47 -08:00
85ea9ec660
Add winglob.glob_many. 2021-09-23 22:34:34 -07:00
51bbe54f2d
Improve winglob docstring.
Clarify that "right results" really means consistent with windows
behavior.
2021-01-25 02:45:07 -08:00
8ff596a95e Add function is_glob. 2020-12-05 20:04:51 -08:00
f8c0d46c5e Alphabetize these functions. 2020-12-05 15:07:04 -08:00
Ethan Dalool
f599d7e394 Match Python glob's argument signature. 2020-01-28 17:40:30 -08:00
Ethan Dalool
2af2389b8d Add winglob.fnmatch. 2020-01-28 17:35:49 -08:00
Ethan Dalool
e3f080b74f Update winglob module docstring. 2020-01-11 01:37:33 -08:00
Ethan Dalool
b0b0464fdc Add winglob.py. 2020-01-05 23:28:53 -08:00