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

Used pathlib parts instead of custom function. #536

Merged
merged 2 commits into from
Jul 23, 2019

Conversation

gabrieldemarmiesse
Copy link
Collaborator

With Pathlib:

>>> import pathlib
>>> pathlib.Path('foo/bar/baz.py').parts
('foo', 'bar', 'baz.py')
>>> pathlib.Path('/absolute/path.py').parts
('/', 'absolute', 'path.py')
>>> pathlib.Path('./relative/path.py').parts
('relative', 'path.py')
>>> pathlib.Path('../relative/path.py').parts
('..', 'relative', 'path.py')

Without Pathlib:

>>> import sacred
>>> from sacred.dependencies import splitall
>>> splitall('foo/bar/baz.py')
['foo', 'bar', 'baz.py']
>>> splitall('/absolute/path.py')
['/', 'absolute', 'path.py']
>>> splitall('./relative/path.py')
['.', 'relative', 'path.py']
>>> splitall('../relative/path.py')
['..', 'relative', 'path.py']

There is a slight difference if the path starts with './' but I don't think it's going to be a problem. The pathlib behavior actually makes more sense.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) to 85.506% when pulling 4e760b1 on gabrieldemarmiesse:simpler_path_handling into f455864 on IDSIA:master.

@JarnoRFB JarnoRFB merged commit 985567b into IDSIA:master Jul 23, 2019
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

Successfully merging this pull request may close these issues.

None yet

3 participants