-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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
fix: use typing_extension instead #17174
Conversation
TYPE_CHECKING, | ||
Union, | ||
) | ||
from typing import Any, Callable, Dict, List, Optional, Type, TYPE_CHECKING, Union |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this compatible with 3.8
AND 3.7
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup
➜ python3.7
Python 3.7.12 (default, Oct 13 2021, 06:53:03)
[Clang 13.0.0 (clang-1300.0.29.3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from typing import (
Any,
Callable,
Dict,
List,
Literal,
Optional,
Type,
TYPE_CHECKING,
Union,
)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: cannot import name 'Literal' from 'typing' (/usr/local/Cellar/python@3.7/3.7.12_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py)
>>> from typing import (
Any,
Callable,
Dict,
List,
Optional,
Type,
TYPE_CHECKING,
Union,
)
Codecov Report
@@ Coverage Diff @@
## master #17174 +/- ##
==========================================
- Coverage 76.83% 76.69% -0.14%
==========================================
Files 1039 1039
Lines 55561 55562 +1
Branches 7570 7570
==========================================
- Hits 42690 42615 -75
- Misses 12621 12697 +76
Partials 250 250
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
(cherry picked from commit aa0f4d6)
🏷️ 2021.40 |
(cherry picked from commit aa0f4d6)
(cherry picked from commit aa0f4d6)
SUMMARY
Use
from typing_extensions import Literal
instead offrom typing import Literal
to support legacy versions of pythonBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION