You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mypy does not care about double quotes, and treat them same. However, no_implicit_optional still add additional Optional, like below will be transform to
from typing import Optional
class DummyClass:
"""A dummy class for illustration purposes."""
def __init__(self, name: str):
self.name = name
def greet(self) -> str:
"""A dummy method that returns a greeting."""
return f"Hello, {self.name}!"
def example_function_double_quote(x: "Optional[DummyClass]"=None) -> None:
reveal_type(x)
def example_function(x: Optional[DummyClass]=None) -> None:
reveal_type(x)
example_function(DummyClass("hello"))
example_function_double_quote(DummyClass("hello"))
and when run about code:
test.py:15: note: Revealed type is "Union[test.DummyClass, None]"
test.py:18: note: Revealed type is "Union[test.DummyClass, None]"
Success: no issues found in 1 source file
The text was updated successfully, but these errors were encountered:
Mypy does not care about double quotes, and treat them same. However, no_implicit_optional still add additional Optional, like below will be transform to
Can we fix this edge case?
and when run about code:
The text was updated successfully, but these errors were encountered: