Use MaybeNone (alias to Any) when applicable (#12855)

This commit is contained in:
Oleh Prypin
2024-10-18 23:07:52 +02:00
committed by GitHub
parent 7fb84668fc
commit b2f68ec2fe
10 changed files with 43 additions and 41 deletions

View File

@@ -1,5 +1,5 @@
import sys
from _typeshed import SupportsKeysAndGetItem
from _typeshed import MaybeNone, SupportsKeysAndGetItem
from _typeshed.importlib import LoaderProtocol
from collections.abc import (
AsyncGenerator,
@@ -528,9 +528,9 @@ class FrameType:
def f_lasti(self) -> int: ...
# see discussion in #6769: f_lineno *can* sometimes be None,
# but you should probably file a bug report with CPython if you encounter it being None in the wild.
# An `int | None` annotation here causes too many false-positive errors.
# An `int | None` annotation here causes too many false-positive errors, so applying `int | Any`.
@property
def f_lineno(self) -> int | Any: ...
def f_lineno(self) -> int | MaybeNone: ...
@property
def f_locals(self) -> dict[str, Any]: ...
f_trace: Callable[[FrameType, str, Any], Any] | None