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

Method to drop query keys #898

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

hongquan
Copy link

@hongquan hongquan commented Jun 23, 2023

What do these changes do?

Add a method, drop_query_keys to drop some keys from query part.
For example, dropping "b" in "a=1&b=2&c=3", we get "a=1&c=3".

Are there changes in behavior for the user?

No.

Related issue number

#774

Checklist

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • Add a new news fragment into the CHANGES folder
    • name it <issue_id>.<type> (e.g. 588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the PR
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: Fix issue with non-ascii contents in doctest text files.

@codecov
Copy link

codecov bot commented Jul 16, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (85b53c9) 99.74% compared to head (ebe8b19) 99.74%.
Report is 54 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #898   +/-   ##
=======================================
  Coverage   99.74%   99.74%           
=======================================
  Files           4        4           
  Lines         772      781    +9     
  Branches      219      221    +2     
=======================================
+ Hits          770      779    +9     
  Misses          2        2           
Flag Coverage Δ
unit 99.61% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mjpieters
Copy link
Contributor

I really do appreciate that you put in the work for a PR here, but I'd like to first see more discussion about what the API should look like. Can you please first propose this API change in the issue?

(I'm not 100% convinced that the name drop_query_keys() is right here; perhaps without_query_keys() is better as you are returning a new URL rather than mutating the existing URL in-place).

@hongquan
Copy link
Author

Thanks. I think without_query_keys is a better name.

@mjpieters mjpieters requested a review from asvetlov July 16, 2023 18:41
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Aug 30, 2023
docs/api.rst Outdated Show resolved Hide resolved
CHANGES/898.feature.rst Outdated Show resolved Hide resolved
tests/test_url_query.py Outdated Show resolved Hide resolved
yarl/_url.py Outdated Show resolved Hide resolved
@webknjaz
Copy link
Member

@mjpieters @hongquan how would you feel about URL.without_query_params()? The RFCs usually use this term...

@webknjaz webknjaz linked an issue Nov 20, 2023 that may be closed by this pull request
1 task
@hongquan
Copy link
Author

Agree with without_query_params name.

CHANGES/898.feature.rst Outdated Show resolved Hide resolved
yarl/_url.py Outdated Show resolved Hide resolved
yarl/_url.py Outdated Show resolved Hide resolved
yarl/_url.py Outdated Show resolved Hide resolved
yarl/_url.py Outdated Show resolved Hide resolved
@hongquan
Copy link
Author

hongquan commented Dec 4, 2023

The lint job in CI/CD failed because it is setup incorrectly. It doesn't use the proposed code, so it breaks when cannot find the symbols that is proposed to add..

yarl/_url.py Show resolved Hide resolved
yarl/_url.py Outdated Show resolved Hide resolved
@hongquan
Copy link
Author

@webknjaz I have updated.

@webknjaz
Copy link
Member

Looks like type stubs need updating..

@hongquan
Copy link
Author

@webknjaz I updated type stub.

@hongquan
Copy link
Author

hongquan commented Feb 6, 2024

The "Timeline protection" checking job is wrong. It looks for "news" whereas the PR template tells to put to CHANGES.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot:chronographer:provided There is a change note present in this PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to remove a query value while retaining others
4 participants