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

Replace all Optional with Union #1095

Merged
merged 8 commits into from
Sep 6, 2024
Merged

Replace all Optional with Union #1095

merged 8 commits into from
Sep 6, 2024

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Sep 4, 2024

What do these changes do?

Replace all Optional with Union

We have both in this project: Optional[int] on port and Union[int, None] on explict_port is not so great. This is a short lived change since pyupgrade is going to change them all to type | None once we remove support for older python.

Are there changes in behavior for the user?

no

Related issue number

#1084 (comment)
#1112 (comment)

@bdraco bdraco changed the title Replace Optional str with Union of str and None Replace all Optional[str] with Union[str, None] Sep 4, 2024
@bdraco bdraco mentioned this pull request Sep 4, 2024
@bdraco
Copy link
Member Author

bdraco commented Sep 4, 2024

Not sure what kind of changelog message this should get.

Also near midnight here so I'll have to pick this up tomorrow.

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.02%. Comparing base (f8ba967) to head (5dec476).
Report is 301 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1095   +/-   ##
=======================================
  Coverage   95.02%   95.02%           
=======================================
  Files          30       30           
  Lines        4459     4459           
  Branches      392      392           
=======================================
  Hits         4237     4237           
  Misses        196      196           
  Partials       26       26           
Flag Coverage Δ
CI-GHA 94.97% <100.00%> (ø)
MyPy 39.89% <95.83%> (ø)
OS-Linux 99.35% <100.00%> (ø)
OS-Windows 99.45% <100.00%> (ø)
OS-macOS 99.04% <100.00%> (ø)
Py-3.10.11 98.93% <100.00%> (ø)
Py-3.10.14 99.18% <100.00%> (ø)
Py-3.11.9 99.18% <100.00%> (ø)
Py-3.12.5 99.18% <100.00%> (ø)
Py-3.13.0-rc.1 99.18% <100.00%> (ø)
Py-3.8.10 98.87% <100.00%> (ø)
Py-3.8.18 99.12% <100.00%> (ø)
Py-3.9.13 98.87% <100.00%> (ø)
Py-3.9.19 99.12% <100.00%> (ø)
Py-pypy7.3.11 99.18% <100.00%> (ø)
Py-pypy7.3.16 99.18% <100.00%> (ø)
Py-pypy7.3.17 99.21% <100.00%> (ø)
VM-macos-latest 99.04% <100.00%> (ø)
VM-ubuntu-latest 99.35% <100.00%> (ø)
VM-windows-latest 99.45% <100.00%> (ø)
pytest 99.35% <100.00%> (ø)

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.

@webknjaz
Copy link
Member

webknjaz commented Sep 5, 2024

Not sure what kind of changelog message this should get.

I'd say “contrib” since it's improving the readability for contributors w/o any influence on how the type checkers would perceive this.

yarl/_url.py Outdated Show resolved Hide resolved
@bdraco bdraco changed the title Replace all Optional[str] with Union[str, None] Replace all Optional with Union Sep 6, 2024
@psf-chronographer psf-chronographer bot added the bot:chronographer:provided There is a change note present in this PR label Sep 6, 2024
CHANGES/1095.contrib.rst Outdated Show resolved Hide resolved
Co-authored-by: Sviatoslav Sydorenko (Святослав Сидоренко) <[email protected]>
CHANGES/1095.contrib.rst Outdated Show resolved Hide resolved
@bdraco bdraco marked this pull request as ready for review September 6, 2024 16:35
@bdraco bdraco merged commit 9c61453 into master Sep 6, 2024
48 of 50 checks passed
@bdraco bdraco deleted the union_str_none branch September 6, 2024 16:36
bdraco added a commit that referenced this pull request Sep 6, 2024
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.

2 participants