Repository navigation
chore: use urlunparse instead of string replace - #2221
Merged
nejch merged 1 commit into
main from
jlvillal/unparse
Aug 4, 2022
Merged
Conversation
Copy link
Copy Markdown
Member
Use the urlunparse() function to reconstruct the URL without the
query parameters.
chore: use urlunparse instead of string replace
6d1b62d
Use the `urlunparse()` function to reconstruct the URL without the
query parameters.
Copy link
Copy Markdown
Member
Copy link
Copy Markdown
Member
Author
@JohnVillalovos this uses a private interface, see my comment at #2219 (comment) .
It is documented in the official docs, which to me means it is supposed to be used.
https://docs.python.org/3/library/urllib.parse.html
As is the case with all named tuples, the subclass has a few additional methods and attributes that are particularly useful. One such method is _replace(). The _replace() method will return a new ParseResult object replacing specified fields with new values.
|
Copy link
Copy Markdown
|
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.45%. Comparing base (d263f57 ) to head (6d1b62d ).
⚠️ Report is 825 commits behind head on main.
Additional details and impacted files
@@ Coverage Diff @@
## main #2221 +/- ##
=======================================
Coverage 95.45% 95.45%
=======================================
Files 81 81
Lines 5368 5368
=======================================
Hits 5124 5124
Misses 244 244
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
- ❄️ Test Analytics : Detect flaky tests, report on failures, and find test suite problems.
|
Copy link
Copy Markdown
Member
Author
|
My theory is that because the urllib.parse.ParseResult is a namedtuple they preface functions with underscores. I don't think it is required but maybe it is "best practice" 🤷♂️
The namedtuple documentation sort-of mentions that: https://docs.python.org/3/library/collections.html#collections.namedtuple
In addition to the methods inherited from tuples, named tuples support three additional methods and two attributes. To prevent conflicts with field names, the method and attribute names start with an underscore.
|
Copy link
Copy Markdown
Member
|
Ok, I will begrudgingly merge this 🐱
|
nejch
merged commit
9e0b60f
into
main
Aug 4, 2022
nejch
deleted the
jlvillal/unparse
branch
August 4, 2022 16:06
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment
Labels
None yet
3 participants