Skip to content

Commit 49e540a

Browse files
committed
Fix types for python <3.9 using typing-extensions
1 parent 27b9235 commit 49e540a

File tree

9 files changed

+19
-5
lines changed

9 files changed

+19
-5
lines changed

.github/workflows/fluent.syntax.yml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ jobs:
3535
run: |
3636
python -m pip install wheel
3737
python -m pip install --upgrade pip
38+
python -m pip install .
3839
- name: Test
3940
working-directory: ./fluent.syntax
4041
run: |

fluent.docs/setup.py

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
from setuptools import setup, find_namespace_packages
1+
from setuptools import setup
22

33
setup(
44
name='fluent.docs',
5-
packages=find_namespace_packages(include=['fluent.*']),
5+
packages=['fluent.docs'],
6+
install_requires=[
7+
'typing-extensions>=3.7,<5'
8+
],
69
)

fluent.runtime/fluent/runtime/bundle.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import babel
22
import babel.numbers
33
import babel.plural
4-
from typing import Any, Callable, Dict, List, Literal, TYPE_CHECKING, Tuple, Union, cast
4+
from typing import Any, Callable, Dict, List, TYPE_CHECKING, Tuple, Union, cast
5+
from typing_extensions import Literal
56

67
from fluent.syntax import ast as FTL
78

fluent.runtime/fluent/runtime/types.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
from babel import Locale
88
from babel.dates import format_date, format_time, get_datetime_format, get_timezone
99
from babel.numbers import NumberPattern, parse_pattern
10-
from typing import Any, Dict, Literal, Type, TypeVar, Union, cast
10+
from typing import Any, Dict, Type, TypeVar, Union, cast
11+
from typing_extensions import Literal
1112

1213
FORMAT_STYLE_DECIMAL = "decimal"
1314
FORMAT_STYLE_CURRENCY = "currency"

fluent.runtime/setup.py

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'attrs',
3434
'babel',
3535
'pytz',
36+
'typing-extensions>=3.7,<5'
3637
],
3738
test_suite='tests',
3839
)

fluent.runtime/tox.ini

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ deps =
1212
attrs==19.1.0
1313
babel==2.7.0
1414
pytz==2019.2
15+
typing-extensions==3.7
1516
syntax: .
1617
commands = ./runtests.py
1718

fluent.syntax/fluent/syntax/stream.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Callable, Literal, Union
1+
from typing import Callable, Union
2+
from typing_extensions import Literal
23
from .errors import ParseError
34

45

fluent.syntax/setup.py

+3
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626
],
2727
packages=['fluent.syntax'],
2828
package_data={'fluent.syntax': ['py.typed']},
29+
install_requires=[
30+
'typing-extensions>=3.7,<5'
31+
],
2932
test_suite='tests.syntax'
3033
)

fluent.syntax/tox.ini

+2
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@ skipsdist=True
77
[testenv]
88
setenv =
99
PYTHONPATH = {toxinidir}
10+
deps =
11+
typing-extensions==3.7
1012
commands = ./runtests.py

0 commit comments

Comments
 (0)