FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Added inline type annotations to Babel by DenverCoder1 · Pull Request #934 · python-babel/babel · GitHub

Repository navigation

Added inline type annotations to Babel - #934

Merged
akx merged 34 commits into
python-babel:masterfrom
DenverCoderOne:typing
Jan 11, 2023
Merged

akx merged 34 commits into
python-babel:masterfrom
DenverCoderOne:typing

Conversation

DenverCoder1 commented Dec 4, 2022 •
edited
Loading

Copy link
Copy Markdown
Contributor

This PR adds inline type annotations to the public methods and classes in Babel.

This PR tries to focus on only adding correct type annotations. There are still some Pyright warnings due to non-type-safe implementations which can be fixed at a later time.

Most of the annotations have already been reviewed and approved by typeshed.

Tested on Python 3.7 - 3.11

DenverCoder1 marked this pull request as draft December 4, 2022 21:27

codecov Bot commented Dec 4, 2022 •
edited
Loading

Copy link
Copy Markdown

Codecov Report

Merging #934 (c17f6c5) into master (6109784) will increase coverage by 0.15%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #934      +/-   ##
==========================================
+ Coverage   91.63%   91.78%   +0.15%     
==========================================
  Files          23       23              
  Lines        4279     4348      +69     
==========================================
+ Hits         3921     3991      +70     
+ Misses        358      357       -1     
Impacted Files Coverage Δ
babel/core.py 96.78% <100.00%> (+0.38%) ⬆️
babel/dates.py 92.44% <100.00%> (+0.04%) ⬆️
babel/languages.py 100.00% <100.00%> (ø)
babel/lists.py 100.00% <100.00%> (ø)
babel/localedata.py 95.96% <100.00%> (+0.09%) ⬆️
babel/localtime/__init__.py 63.15% <100.00%> (-0.95%) ⬇️
babel/localtime/_unix.py 24.13% <100.00%> (ø)
babel/localtime/_win32.py 62.26% <100.00%> (+1.47%) ⬆️
babel/messages/catalog.py 95.52% <100.00%> (+0.05%) ⬆️
babel/messages/checkers.py 80.48% <100.00%> (+0.48%) ⬆️
... and 10 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

DenverCoder1 marked this pull request as ready for review December 4, 2022 21:38
DenverCoder1 changed the title Added type annotations for most modules Added inline type annotations to Babel Jan 6, 2023
Comment thread babel/core.py Outdated
Comment thread babel/core.py Outdated
Comment thread babel/core.py Outdated
Comment thread babel/core.py Outdated
Comment thread babel/localedata.py Outdated
Comment thread babel/numbers.py Outdated
Comment thread babel/numbers.py Outdated
Comment thread babel/plural.py Outdated
Comment thread babel/plural.py Outdated
Comment thread babel/plural.py Outdated

akx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for putting this work in!

I made a bunch of suggestions around readability (you can probably use GitHub's "commit suggestions in batch" thing to apply them), and then there were some somewhat suspect types wrt. docstrings.

Comment thread babel/support.py Outdated
Comment thread babel/support.py Outdated
Comment thread babel/support.py Outdated
Comment thread babel/support.py Outdated
Comment thread babel/support.py Outdated
Comment thread babel/units.py Outdated
Comment thread babel/units.py Outdated
Comment thread babel/units.py Outdated
Comment thread babel/units.py Outdated
Comment thread babel/util.py Outdated
DenverCoder1 marked this pull request as draft January 8, 2023 01:54
DenverCoder1 and others added 3 commits January 7, 2023 18:58
Co-authored-by: Aarni Koskela <akx@iki.fi>
* Added more type annotations to checkers.py
* Changed str to Final[str]
* Added parse_template_string option
* Type aliases for extraction results
* Fix Final on Python 3.7 (use typing_extensions)
* Change po fileobj type
* overload get_territory_currencies return type

Copy link
Copy Markdown
Contributor Author

I made a bunch of suggestions around readability

This is a good start, maybe we can consider running Black on the whole project to give it some consistency?

DenverCoder1 marked this pull request as ready for review January 8, 2023 03:09
akx added this to the Babel 2.12 milestone Jan 11, 2023

akx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@DenverCoder1 Let's ship this! ... Can you merge/rebase once more with #943 in?

akx enabled auto-merge (squash) January 11, 2023 08:51

akx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

🚀

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL