Skip to content

added bytes conversion#582

Merged
asvetlov merged 4 commits intoaio-libs:masterfrom
ChristianMertes:master
Oct 5, 2021
Merged

added bytes conversion#582
asvetlov merged 4 commits intoaio-libs:masterfrom
ChristianMertes:master

Conversation

@ChristianMertes
Copy link
Copy Markdown
Contributor

What do these changes do?

Added __bytes__() magic method so that bytes(url) will work and use optimal ASCII encoding, as URL string representations are always encoded already.

While I was at it, I fixed some typos I saw and I had to add a mypy ignore for the tests to work for me. There is one test that fails for me (test_semicolon_as_separator) because I was using a Python > 3.9.2 and parse_qsl() changed its behavior.

Are there changes in behavior for the user?

Existing functionality shouldn't be affected.

Related issue number

n/a

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.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label May 11, 2021
@ChristianMertes ChristianMertes marked this pull request as ready for review May 11, 2021 22:28
@codecov
Copy link
Copy Markdown

codecov bot commented May 28, 2021

Codecov Report

Merging #582 (1afed29) into master (3745b3d) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #582   +/-   ##
=======================================
  Coverage   99.72%   99.72%           
=======================================
  Files           4        4           
  Lines         737      739    +2     
  Branches      165      165           
=======================================
+ Hits          735      737    +2     
  Misses          2        2           
Flag Coverage Δ
unit 99.45% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
yarl/_url.py 99.64% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3745b3d...1afed29. Read the comment docs.

@ChristianMertes
Copy link
Copy Markdown
Contributor Author

It is interesting that said test also fails for the other Python versions. I am not convinced this has anything to do with the proposed changes, however....

Comment thread yarl/_url.py
@asvetlov asvetlov closed this Oct 5, 2021
@asvetlov asvetlov reopened this Oct 5, 2021
Comment thread setup.cfg Outdated
@asvetlov asvetlov changed the title added bytes conversion, fixed some typos and mypy ignore for multidict added bytes conversion Oct 5, 2021
@asvetlov
Copy link
Copy Markdown
Member

asvetlov commented Oct 5, 2021

Suggested typos are applied to master in a separate commit, thanks

@asvetlov asvetlov merged commit 248f242 into aio-libs:master Oct 5, 2021
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.

4 participants