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

Path.glob has different behavior from standard pathlib.Path #235

Closed
disktnk opened this issue Nov 10, 2021 · 0 comments
Closed

Path.glob has different behavior from standard pathlib.Path #235

disktnk opened this issue Nov 10, 2021 · 0 comments
Labels
cat:bug Bug report or fix.
Milestone

Comments

@disktnk
Copy link
Member

disktnk commented Nov 10, 2021

  • pfio's Path get paths recursively when set * because of using fnmatch and pattern matching
  • returning type is str

Example:

$ tree tmp
tmp
├── test.txt
└── tmp
    └── test.txt
$ python
Python 3.8.6 (default, Oct  9 2020, 13:24:27)
[Clang 11.0.0 (clang-1100.0.33.17)] on darwin
>>> from pathlib import Path
>>> p = Path('tmp')
>>> list(p.glob('*'))
[PosixPath('tmp/test.txt'), PosixPath('tmp/tmp')]
>>> list(p.glob('**/*'))
[PosixPath('tmp/test.txt'), PosixPath('tmp/tmp'), PosixPath('tmp/tmp/test.txt')]
>>>
>>> from pfio.v2.pathlib import Path as Path2
>>> pp = Path2('tmp')
>>> list(pp.glob('*'))
['test.txt', 'tmp/', 'tmp/test.txt']
>>> list(pp.glob('**/*'))
['tmp/', 'tmp/test.txt']
>>>
>>> type(list(p.glob('*'))[0])
<class 'pathlib.PosixPath'>
>>> type(list(pp.glob('*'))[0])
<class 'str'>
@kuenishi kuenishi added this to the 2.0.1 milestone Dec 21, 2021
@kuenishi kuenishi added the cat:bug Bug report or fix. label Dec 21, 2021
@kuenishi kuenishi mentioned this issue Dec 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat:bug Bug report or fix.
Projects
None yet
Development

No branches or pull requests

2 participants