From dde13fb91de8ea668e091a9965c738131e997120 Mon Sep 17 00:00:00 2001 From: Avasam Date: Thu, 26 Dec 2024 16:35:34 -0500 Subject: [PATCH] Enable Ruff PGH rules (#13304) --- pyproject.toml | 1 + stubs/m3u8/m3u8/httpclient.pyi | 2 +- stubs/networkx/networkx/classes/multidigraph.pyi | 2 +- stubs/tensorflow/tensorflow/keras/layers/__init__.pyi | 2 +- stubs/tensorflow/tensorflow/keras/metrics.pyi | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 501066318..b38a40da3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,7 @@ select = [ "B", # flake8-bugbear "FA", # flake8-future-annotations "I", # isort + "PGH", # pygrep-hooks "RUF", # Ruff-specific and unused-noqa "UP", # pyupgrade # Flake8 base rules diff --git a/stubs/m3u8/m3u8/httpclient.pyi b/stubs/m3u8/m3u8/httpclient.pyi index de76c1b84..96569e96e 100644 --- a/stubs/m3u8/m3u8/httpclient.pyi +++ b/stubs/m3u8/m3u8/httpclient.pyi @@ -16,4 +16,4 @@ class DefaultHTTPClient: ) -> tuple[str, str]: ... class HTTPSHandler: - def __new__(cls, verify_ssl: bool = True) -> urllib.request.HTTPSHandler: ... # type: ignore + def __new__(cls, verify_ssl: bool = True) -> urllib.request.HTTPSHandler: ... # type: ignore[misc] diff --git a/stubs/networkx/networkx/classes/multidigraph.pyi b/stubs/networkx/networkx/classes/multidigraph.pyi index e9a2b91b1..fac4ea0c0 100644 --- a/stubs/networkx/networkx/classes/multidigraph.pyi +++ b/stubs/networkx/networkx/classes/multidigraph.pyi @@ -20,6 +20,6 @@ class MultiDiGraph(MultiGraph[_Node], DiGraph[_Node]): def in_degree(self) -> InMultiDegreeView[_Node]: ... @cached_property def out_degree(self) -> OutMultiDegreeView[_Node]: ... - def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> MultiGraph[_Node]: ... # type: ignore + def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> MultiGraph[_Node]: ... # type: ignore[override] def reverse(self, copy: bool = True) -> MultiDiGraph[_Node]: ... def copy(self, as_view: bool = False) -> MultiDiGraph[_Node]: ... diff --git a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi index 48a32b9eb..a2a2211b5 100644 --- a/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi +++ b/stubs/tensorflow/tensorflow/keras/layers/__init__.pyi @@ -394,7 +394,7 @@ class MultiHeadAttention(Layer[Any, tf.Tensor]): name: str | None = None, ) -> None: ... # @override - @overload # type: ignore + @overload # type: ignore[override] def __call__( self, query: tf.Tensor, diff --git a/stubs/tensorflow/tensorflow/keras/metrics.pyi b/stubs/tensorflow/tensorflow/keras/metrics.pyi index 245e6b227..9e3d1e456 100644 --- a/stubs/tensorflow/tensorflow/keras/metrics.pyi +++ b/stubs/tensorflow/tensorflow/keras/metrics.pyi @@ -23,7 +23,7 @@ class Metric(tf.keras.layers.Layer[tf.Tensor, tf.Tensor], metaclass=ABCMeta): def result(self) -> _Output: ... # Metric inherits from keras.Layer, but its add_weight method is incompatible with the one from "Layer". @override - def add_weight( # type: ignore + def add_weight( # type: ignore[override] self, name: str, shape: Iterable[int | None] | None = (),