Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
553aea9
types for core, localedata, some of dates
DenverCoder1 Dec 2, 2022
7b59f48
more dates types
DenverCoder1 Dec 4, 2022
9534bee
more dates types
DenverCoder1 Dec 4, 2022
105c673
more dates types
DenverCoder1 Dec 4, 2022
7ba273c
More types for dates
DenverCoder1 Dec 4, 2022
42ac91d
Add some numbers types
DenverCoder1 Dec 4, 2022
63e37ed
more numbers type annotations
DenverCoder1 Dec 4, 2022
483029f
More type annotations
DenverCoder1 Dec 4, 2022
00e15bb
type annotations for units, util
DenverCoder1 Dec 4, 2022
b663dc1
Formatting and small fixes
DenverCoder1 Dec 4, 2022
a8d195e
Make typing_extensions only required for type checking
DenverCoder1 Dec 4, 2022
941f009
Update support imports
DenverCoder1 Dec 4, 2022
a0c53c1
finish support, plural update
DenverCoder1 Dec 4, 2022
90032bf
Add more type annotations to plural.py
DenverCoder1 Dec 5, 2022
6c8b3d3
More localtime annotations
DenverCoder1 Dec 5, 2022
298a8c1
Fix import order
DenverCoder1 Dec 5, 2022
5f10d90
style: formatting
DenverCoder1 Dec 5, 2022
c07ed4d
Retype from typeshed stubs
DenverCoder1 Dec 15, 2022
89d60c0
Infer additional types
DenverCoder1 Dec 15, 2022
6ea0042
Add types to get_global()
DenverCoder1 Dec 16, 2022
9886da9
Merge branch 'master' into typing
DenverCoder1 Dec 26, 2022
132a9a4
Add babel.messages annotations
DenverCoder1 Jan 6, 2023
32bbc9e
Update .coveragerc
DenverCoder1 Jan 6, 2023
d27288c
Merge branch 'master' into typing
DenverCoder1 Jan 6, 2023
c2fe354
Apply suggestions from code review
DenverCoder1 Jan 8, 2023
25dbcb2
Changes from code review
DenverCoder1 Jan 8, 2023
621cd16
Code changes from review
DenverCoder1 Jan 8, 2023
c868813
Remove less specific list type in get_territory_currencies
DenverCoder1 Jan 8, 2023
1409b14
Fix coverage on overloads
DenverCoder1 Jan 8, 2023
fc1f1ff
Add coverage ignore
DenverCoder1 Jan 8, 2023
d0cb966
Change IO[bytes] | IO[str] to IO[AnyStr]
DenverCoder1 Jan 11, 2023
c3beb51
Merge branch 'master' into typing
DenverCoder1 Jan 11, 2023
05f690f
Merge branch 'master' into typing
DenverCoder1 Jan 11, 2023
c17f6c5
Pre-commit fixes
DenverCoder1 Jan 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More localtime annotations
  • Loading branch information
DenverCoder1 committed Dec 5, 2022
commit 6c8b3d3d64d6336186dc62c87ca98ce3eda73ada
4 changes: 2 additions & 2 deletions babel/localtime/_unix.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytz


def _tz_from_env(tzenv):
def _tz_from_env(tzenv: str) -> pytz.BaseTzInfo:
if tzenv[0] == ':':
tzenv = tzenv[1:]

Expand All @@ -23,7 +23,7 @@ def _tz_from_env(tzenv):
"Please use a timezone in the form of Continent/City")


def _get_localzone(_root='/'):
def _get_localzone(_root: str = '/') -> pytz.BaseTzInfo:
"""Tries to find the local timezone configuration.
This method prefers finding the timezone name and passing that to pytz,
over passing in the localtime file, as in the later case the zoneinfo
Expand Down
12 changes: 8 additions & 4 deletions babel/localtime/_win32.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,20 @@
except ImportError:
winreg = None

from babel.core import get_global
from __future__ import annotations

from typing import Dict, cast

import pytz

from babel.core import get_global

# When building the cldr data on windows this module gets imported.
# Because at that point there is no global.dat yet this call will
# fail. We want to catch it down in that case then and just assume
# the mapping was empty.
try:
tz_names = get_global('windows_zone_mapping')
tz_names: dict[str, str] = cast(Dict[str, str], get_global('windows_zone_mapping'))
except RuntimeError:
tz_names = {}

Expand All @@ -27,7 +31,7 @@ def valuestodict(key):
return dict


def get_localzone_name():
def get_localzone_name() -> str:
# Windows is special. It has unique time zone names (in several
# meanings of the word) available, but unfortunately, they can be
# translated to the language of the operating system, so we need to
Expand Down Expand Up @@ -86,7 +90,7 @@ def get_localzone_name():
return timezone


def _get_localzone():
def _get_localzone() -> pytz.BaseTzInfo:
if winreg is None:
raise pytz.UnknownTimeZoneError(
'Runtime support not available')
Expand Down