Skip to content

Commit 050343b

Browse files
committed
remove specific for Optional
1 parent ae03294 commit 050343b

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

mypy/stubgen.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,10 +513,6 @@ def get_str_type_of_node(self, rvalue: Node) -> str:
513513
return 'int'
514514
if isinstance(rvalue, NameExpr) and rvalue.name in ('True', 'False'):
515515
return 'bool'
516-
if isinstance(rvalue, NameExpr) and rvalue.name == 'None':
517-
self.add_typing_import('Optional')
518-
self.add_typing_import('Any')
519-
return 'Optional[Any]'
520516
self.add_typing_import('Any')
521517
return 'Any'
522518

test-data/unit/stubgen.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ def g(b: int = ..., c: int = ...): ...
2626
[case testDefaultArgNone]
2727
def f(x=None): ...
2828
[out]
29-
from typing import Any, Optional
29+
from typing import Any
3030

31-
def f(x: Optional[Any] = ...): ...
31+
def f(x: Any = ...): ...
3232

3333
[case testDefaultArgBool]
3434
def f(x=True, y=False): ...

typeshed

Submodule typeshed updated 195 files

0 commit comments

Comments
 (0)