Bump ruff to 0.11.2 (#13757)

This commit is contained in:
Avasam
2025-04-01 12:31:38 -04:00
committed by GitHub
parent eafa274f1b
commit 19cea106f0
8 changed files with 19 additions and 21 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ repos:
args: [--fix=lf]
- id: check-case-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.3 # must match requirements-tests.txt
rev: v0.11.2 # must match requirements-tests.txt
hooks:
- id: ruff
name: Run ruff on stubs, tests and scripts
+1 -1
View File
@@ -13,7 +13,7 @@ packaging==24.2
pathspec>=0.11.1
pre-commit
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
ruff==0.9.3
ruff==0.11.2
stubdefaulter==0.1.0
termcolor>=2.3
tomli==2.2.1
+3 -2
View File
@@ -3,6 +3,7 @@
# See the README.md file in this directory for more information.
import sys
import typing_extensions
from collections.abc import Awaitable, Callable, Iterable, Sequence, Set as AbstractSet, Sized
from dataclasses import Field
from os import PathLike
@@ -328,9 +329,9 @@ class structseq(Generic[_T_co]):
# The second parameter will accept a dict of any kind without raising an exception,
# but only has any meaning if you supply it a dict where the keys are strings.
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
def __new__(cls: type[Self], sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> Self: ...
def __new__(cls, sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> typing_extensions.Self: ...
if sys.version_info >= (3, 13):
def __replace__(self: Self, **kwargs: Any) -> Self: ...
def __replace__(self, **kwargs: Any) -> typing_extensions.Self: ...
# Superset of typing.AnyStr that also includes LiteralString
AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001
+1 -1
View File
@@ -959,7 +959,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
def setdefault(self, k: _Never, default: object) -> object: ...
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: _Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
def update(self: _T, m: _T, /) -> None: ...
def update(self, m: typing_extensions.Self, /) -> None: ...
def __delitem__(self, k: _Never) -> None: ...
def items(self) -> dict_items[str, object]: ...
def keys(self) -> dict_keys[str, object]: ...
+1 -1
View File
@@ -249,7 +249,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
def setdefault(self, k: Never, default: object) -> object: ...
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
def update(self: _T, m: _T, /) -> None: ...
def update(self, m: Self, /) -> None: ...
def items(self) -> dict_items[str, object]: ...
def keys(self) -> dict_keys[str, object]: ...
def values(self) -> dict_values[str, object]: ...
+3 -3
View File
@@ -3,12 +3,12 @@ from _typeshed import Incomplete, ReadableBuffer, SupportsItems
from collections.abc import Callable, Iterable, Mapping
from types import BuiltinFunctionType, FunctionType, ModuleType
from typing import Any, ClassVar, NoReturn, TypeVar
from typing_extensions import Self
from yaml.error import YAMLError as YAMLError
from yaml.nodes import MappingNode as MappingNode, Node as Node, ScalarNode as ScalarNode, SequenceNode as SequenceNode
_T = TypeVar("_T")
_R = TypeVar("_R", bound=BaseRepresenter)
class RepresenterError(YAMLError): ...
@@ -25,9 +25,9 @@ class BaseRepresenter:
def represent(self, data) -> None: ...
def represent_data(self, data) -> Node: ...
@classmethod
def add_representer(cls: type[_R], data_type: type[_T], representer: Callable[[_R, _T], Node]) -> None: ...
def add_representer(cls, data_type: type[_T], representer: Callable[[Self, _T], Node]) -> None: ...
@classmethod
def add_multi_representer(cls: type[_R], data_type: type[_T], representer: Callable[[_R, _T], Node]) -> None: ...
def add_multi_representer(cls, data_type: type[_T], representer: Callable[[Self, _T], Node]) -> None: ...
def represent_scalar(self, tag: str, value, style: str | None = None) -> ScalarNode: ...
def represent_sequence(self, tag: str, sequence: Iterable[Any], flow_style: bool | None = None) -> SequenceNode: ...
def represent_mapping(
@@ -1,5 +1,6 @@
from collections.abc import Callable, Iterable, Iterator, MutableMapping, Sequence
from typing import Any, Protocol, SupportsIndex, TypeVar, overload
from typing_extensions import Self
from google.protobuf.descriptor import Descriptor
from google.protobuf.internal.message_listener import MessageListener
@@ -10,7 +11,6 @@ _T = TypeVar("_T")
_K = TypeVar("_K", bound=bool | int | str)
_ScalarV = TypeVar("_ScalarV", bound=bool | int | float | str | bytes)
_MessageV = TypeVar("_MessageV", bound=Message)
_M = TypeVar("_M")
class _ValueChecker(Protocol[_T]):
def CheckValue(self, proposed_value: _T) -> _T: ...
@@ -33,7 +33,7 @@ class RepeatedScalarFieldContainer(BaseContainer[_ScalarV]):
def append(self, value: _ScalarV) -> None: ...
def insert(self, key: int, value: _ScalarV) -> None: ...
def extend(self, elem_seq: Iterable[_ScalarV] | None) -> None: ...
def MergeFrom(self: _M, other: _M | Iterable[_ScalarV]) -> None: ...
def MergeFrom(self, other: Self | Iterable[_ScalarV]) -> None: ...
def remove(self, elem: _ScalarV) -> None: ...
def pop(self, key: int = -1) -> _ScalarV: ...
@overload
@@ -49,7 +49,7 @@ class RepeatedCompositeFieldContainer(BaseContainer[_MessageV]):
def append(self, value: _MessageV) -> None: ...
def insert(self, key: int, value: _MessageV) -> None: ...
def extend(self, elem_seq: Iterable[_MessageV]) -> None: ...
def MergeFrom(self: _M, other: _M | Iterable[_MessageV]) -> None: ...
def MergeFrom(self, other: Self | Iterable[_MessageV]) -> None: ...
def remove(self, elem: _MessageV) -> None: ...
def pop(self, key: int = -1) -> _MessageV: ...
def __delitem__(self, key: int | slice) -> None: ...
@@ -73,7 +73,7 @@ class ScalarMap(MutableMapping[_K, _ScalarV]):
def get(self, key: _K, default: None = None) -> _ScalarV | None: ...
@overload
def get(self, key: _K, default: _ScalarV | _T) -> _ScalarV | _T: ...
def MergeFrom(self: _M, other: _M): ...
def MergeFrom(self, other: Self): ...
def InvalidateIterators(self) -> None: ...
def GetEntryClass(self) -> GeneratedProtocolMessageType: ...
@@ -96,6 +96,6 @@ class MessageMap(MutableMapping[_K, _MessageV]):
@overload
def get(self, key: _K, default: _MessageV | _T) -> _MessageV | _T: ...
def get_or_create(self, key: _K) -> _MessageV: ...
def MergeFrom(self: _M, other: _M): ...
def MergeFrom(self, other: Self): ...
def InvalidateIterators(self) -> None: ...
def GetEntryClass(self) -> GeneratedProtocolMessageType: ...
+4 -7
View File
@@ -1,5 +1,5 @@
from collections.abc import Sequence
from typing import Any, TypeVar
from typing import Any
from typing_extensions import Self
from .descriptor import Descriptor, FieldDescriptor
@@ -9,8 +9,6 @@ class Error(Exception): ...
class DecodeError(Error): ...
class EncodeError(Error): ...
_M = TypeVar("_M", bound=Message) # message type (of self)
class Message:
DESCRIPTOR: Descriptor
def __deepcopy__(self, memo: Any = None) -> Self: ...
@@ -26,12 +24,11 @@ class Message:
def SerializeToString(self, *, deterministic: bool = ...) -> bytes: ...
def SerializePartialToString(self, *, deterministic: bool = ...) -> bytes: ...
def ListFields(self) -> Sequence[tuple[FieldDescriptor, Any]]: ...
# The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `HasExtension` & `ClearExtension`
def HasExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> bool: ...
def ClearExtension(self: _M, field_descriptor: _ExtensionFieldDescriptor[_M, Any]) -> None: ...
def HasExtension(self, field_descriptor: _ExtensionFieldDescriptor[Self, Any]) -> bool: ...
def ClearExtension(self, field_descriptor: _ExtensionFieldDescriptor[Self, Any]) -> None: ...
# The TypeVar must be bound to `Message` or we get mypy errors, so we cannot use `Self` for `Extensions`
@property
def Extensions(self: _M) -> _ExtensionDict[_M]: ...
def Extensions(self) -> _ExtensionDict[Self]: ...
def ByteSize(self) -> int: ...
@classmethod
def FromString(cls, s: bytes) -> Self: ...