-
Notifications
You must be signed in to change notification settings - Fork 90
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
Raise a TypeError if wrong type given to fix_url #2936
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #2936 +/- ##
==========================================
+ Coverage 38.35% 38.36% +0.01%
==========================================
Files 778 778
Lines 34366 34374 +8
Branches 5219 5424 +205
==========================================
+ Hits 13180 13188 +8
+ Misses 20643 20007 -636
- Partials 543 1179 +636
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
It could be worth looking up functions that use |
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.
I'm not yet sure whether we should touch fix_url()
, but there are some thoughts:
- supporting
PathLike
is a good idea - do we have some tests with
PathLike
? - When we know that a value is a path, but not a URL, I think it's preferred to use
PhysicalKey.from_path()
rather thanPhysicalKey.from_url()
like here:
quilt/api/python/quilt3/packages.py
Lines 844 to 847 in 5f2ec40
if path: src = PhysicalKey.from_url(fix_url(path)) else: src = PhysicalKey.from_path(lkey)
So it might make sense to check whetherpath
is instance ofPathLike
and usePhysicalKey.from_path()
in that case.
@sir-sigurd Ran across something. (master) This is a weird behavior: >>> p = Package()
>>> p.set_dir('example')
>>> p.set_dir('')
# Result: Package is set to PWD.
>>> p = Package()
>>> p.set_dir('')
>>> p.set_dir('example')
# Result: Package is set to PWD. That seems like buggy behavior. Is it actually intentional? Extended example: >>> p = Package()
>>> p.set_dir('')
(local Package)
└─bar
└─example/
└─baz
└─bing
└─foo
>>> p.set_dir('example')
(local Package)
└─bar
└─example/
└─baz
└─bing
└─foo
>>> p = Package()
>>> p.set_dir('example')
(local Package)
└─example/
└─baz
└─bing
>>> p.set_dir('')
(local Package)
└─bar
└─example/
└─baz
└─bing
└─foo I'd imagine that it should Can you specify what the behavior should be? I'm working on that chunk of code, and may as well fix this if it's a bug. |
I don't understand what's unexpected. From docs:
Does this make sense? |
Nevermind, I was thinking of |
Description
This is in relation to "Package.set_dir() should be more restrictive to path".
Note that I've modified
fix_url
instead ofset_dir()
.fix_url()
is the centralized place for checking local-style paths. All tests passed with this small change, but it could cause people to need to adapt, if they have code dependent on the previous behavior.If changing this here is considered too broad, I can shift it into
set_dir
.TODO
build.py
for new docstrings