python-babel / babel

The official repository for Babel, the Python Internationalization Library
http://babel.pocoo.org/
BSD 3-Clause "New" or "Revised" License
1.32k stars 440 forks source link

Numbers and core type fixes #966

Closed DenverCoder1 closed 1 year ago

DenverCoder1 commented 1 year ago

Type annotation improvements:

  1. Changed Locale.parse to always return a Locale (this fixes type issues in multiple places where the return type is assumed to not be None)
  2. Fixed Pyright type errors and added type: ignore in certain places in core.py and numbers.py

Note: Changing Locale.parse to always return a Locale simplifies the logic, but it also can potentially be a breaking change if people are relying on passing None not raising an exception. It is a bit of a stretch though, since passing None has no functional effect in the use of the lib.

These changes have been separated from #961

codecov[bot] commented 1 year ago

Codecov Report

Merging #966 (053c242) into master (25e4360) will decrease coverage by 0.02%. The diff coverage is 91.30%.

@@            Coverage Diff             @@
##           master     #966      +/-   ##
==========================================
- Coverage   90.89%   90.88%   -0.02%     
==========================================
  Files          25       25              
  Lines        4340     4334       -6     
==========================================
- Hits         3945     3939       -6     
  Misses        395      395              
Impacted Files Coverage Δ
babel/core.py 96.52% <90.00%> (+0.20%) :arrow_up:
babel/numbers.py 97.79% <92.30%> (-0.24%) :arrow_down:

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