[ruff] Omit diagnostic for shadowed private function parameters in used-dummy-variable (RUF052) (#15376)

This commit is contained in:
Dylan 2025-01-10 03:09:25 -06:00 committed by GitHub
parent 23ad319b55
commit 443bf38565
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 88 additions and 4 deletions

View file

@ -145,3 +145,19 @@ def special_calls():
_NotADynamicClass = type("_NotADynamicClass")
print(_T, _P, _NT, _E, _NT2, _NT3, _DynamicClass, _NotADynamicClass)
# Do not emit diagnostic if parameter is private
# even if it is later shadowed in the body of the function
# see https://github.com/astral-sh/ruff/issues/14968
class Node:
connected: list[Node]
def recurse(self, *, _seen: set[Node] | None = None):
if _seen is None:
_seen = set()
elif self in _seen:
return
_seen.add(self)
for other in self.connected:
other.recurse(_seen=_seen)