mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
Use PEP 570 syntax in stdlib (#11250)
This commit is contained in:
@@ -71,12 +71,12 @@ _FormatStyle: TypeAlias = Literal["%", "{", "$"]
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
class _SupportsFilter(Protocol):
|
||||
def filter(self, __record: LogRecord) -> bool | LogRecord: ...
|
||||
def filter(self, record: LogRecord, /) -> bool | LogRecord: ...
|
||||
|
||||
_FilterType: TypeAlias = Filter | Callable[[LogRecord], bool | LogRecord] | _SupportsFilter
|
||||
else:
|
||||
class _SupportsFilter(Protocol):
|
||||
def filter(self, __record: LogRecord) -> bool: ...
|
||||
def filter(self, record: LogRecord, /) -> bool: ...
|
||||
|
||||
_FilterType: TypeAlias = Filter | Callable[[LogRecord], bool] | _SupportsFilter
|
||||
|
||||
@@ -355,7 +355,7 @@ class LogRecord:
|
||||
) -> None: ...
|
||||
def getMessage(self) -> str: ...
|
||||
# Allows setting contextual information on LogRecord objects as per the docs, see #7833
|
||||
def __setattr__(self, __name: str, __value: Any) -> None: ...
|
||||
def __setattr__(self, name: str, value: Any, /) -> None: ...
|
||||
|
||||
_L = TypeVar("_L", bound=Logger | LoggerAdapter[Any])
|
||||
|
||||
|
||||
@@ -253,7 +253,7 @@ class HTTPHandler(Handler):
|
||||
|
||||
class _QueueLike(Protocol[_T]):
|
||||
def get(self) -> _T: ...
|
||||
def put_nowait(self, __item: _T) -> None: ...
|
||||
def put_nowait(self, item: _T, /) -> None: ...
|
||||
|
||||
class QueueHandler(Handler):
|
||||
queue: _QueueLike[Any]
|
||||
|
||||
Reference in New Issue
Block a user