← Winnitude! Search  ·  Reader Mode (876 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 45 LINKS

chore: use `urlunparse` instead of string replace by JohnVillalovos · Pull Request #2221 · python-gitlab/python-gitlab

Repository navigation

chore: use urlunparse instead of string replace - #2221


Merged
nejch merged 1 commit into main from jlvillal/unparse Aug 4, 2022
Merged

chore: use urlunparse instead of string replace #2221 nejch merged 1 commit into main from jlvillal/unparse

Conversation

JohnVillalovos commented Aug 4, 2022



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.

nejch commented Aug 4, 2022



Copy link Copy Markdown
Member

@JohnVillalovos this uses a private interface, see my comment at #2219 (comment) .

JohnVillalovos commented Aug 4, 2022



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.

codecov-commenter commented Aug 4, 2022 · edited by codecov
Bot
Loading



Copy link Copy Markdown

Codecov Report

✅ 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           
Flag Coverage Δ
api_func_v4 81.35% <100.00%> (ø)
cli_func_v4 82.91% <100.00%> (-0.12%) ⬇️
unit 87.29% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
gitlab/client.py 98.75% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics : Detect flaky tests, report on failures, and find test suite problems.

JohnVillalovos commented Aug 4, 2022 · edited Loading



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.

nejch commented Aug 4, 2022



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