8000 Sync typeshed by ilevkivskyi · Pull Request #6800 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Sync typeshed #6800

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

Merged
merged 3 commits into from
May 8, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
2 changes: 1 addition & 1 deletion mypy/stubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ def get_init(self, lvalue: str, rvalue: Expression,
typename = self.print_annotation(annotation)
if (isinstance(annotation, UnboundType) and not annotation.args and
annotation.name == 'Final' and
self.import_tracker.module_for.get('Final') in ('typing, typing_extensions')):
self.import_tracker.module_for.get('Final') in ('typing', 'typing_extensions')):
Copy link
Member

Choose a reason for hiding this comment

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

Nice that we were able to find this with the __contains__ change.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, exactly!

# Final without type argument is invalid in stubs.
final_arg = self.get_str_type_of_node(rvalue)
typename += '[{}]'.format(final_arg)
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed
Submodule typeshed updated 508 files
8 changes: 8 additions & 0 deletions test-data/unit/stubgen.test
Original file line number Diff line number Diff line change
Expand Up @@ -1371,6 +1371,14 @@ y: Final[Any]
z: Final[object]
t: Final[Any]

[case testFinalInvalid_semanal]
Final = 'boom'

x: Final = 1
[out]
Final: str
x: Final

[case testNoFunctionNested_semanal]
import a
from typing import Dict, Any
Expand Down
0