Skip to content

Commit 9c91487

Browse files
authored
Sync typeshed (#6800)
Syncing just because we didn't do this for a while (plus to test the recent `str.__contains__()` signature updates that actually found a bug in stubgen).
1 parent 285b683 commit 9c91487

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

mypy/stubgen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,8 @@ def get_init(self, lvalue: str, rvalue: Expression,
717717
typename = self.print_annotation(annotation)
718718
if (isinstance(annotation, UnboundType) and not annotation.args and
719719
annotation.name == 'Final' and
720-
self.import_tracker.module_for.get('Final') in ('typing, typing_extensions')):
720+
self.import_tracker.module_for.get('Final') in ('typing',
721+
'typing_extensions')):
721722
# Final without type argument is invalid in stubs.
722723
final_arg = self.get_str_type_of_node(rvalue)
723724
typename += '[{}]'.format(final_arg)

mypy/typeshed

Submodule typeshed updated 508 files

test-data/unit/stubgen.test

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,14 @@ y: Final[Any]
13711371
z: Final[object]
13721372
t: Final[Any]
13731373

1374+
[case testFinalInvalid_semanal]
1375+
Final = 'boom'
1376+
1377+
x: Final = 1
1378+
[out]
1379+
Final: str
1380+
x: Final
1381+
13741382
[case testNoFunctionNested_semanal]
13751383
import a
13761384
from typing import Dict, Any

0 commit comments

Comments
 (0)