Skip to content

Commit

Permalink
Update pr based on review
Browse files Browse the repository at this point in the history
  • Loading branch information
yushao2 committed Aug 1, 2021
1 parent c8b2cbb commit a4198cd
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
10 changes: 5 additions & 5 deletions ChangeLog
Expand Up @@ -14,7 +14,7 @@ Release date: TBA

* pyreverse: Show class has-a relationships inferred from the type-hint

Closes #4744
Closes #4744

* Added ``ignored-parents`` option to the design checker to ignore specific
classes from the ``too-many-ancestors`` check (R0901).
Expand Down Expand Up @@ -56,6 +56,10 @@ Closes #4744

Closes #3692

* Fix false-positive of ``unused-private-member`` when using nested functions in a class

Closes #4673


What's New in Pylint 2.9.6?
===========================
Expand Down Expand Up @@ -169,10 +173,6 @@ Release date: 2021-07-20

Closes #4723

* Fix false-positive of ``unused-private-member`` when using nested functions in a class

Closes #4673


What's New in Pylint 2.9.3?
===========================
Expand Down
9 changes: 4 additions & 5 deletions pylint/checkers/classes.py
Expand Up @@ -939,23 +939,22 @@ def _check_unused_private_functions(self, node: astroid.ClassDef) -> None:
break
else:
name_stack = []
outer_level_names = ""
curr = parent_scope
# Generate proper names for nested functions
while curr != node:
name_stack.append(curr.name)
curr = curr.parent.scope()

if name_stack:
outer_level_names = f"{'.'.join(reversed(name_stack))}."
outer_level_names = f"{'.'.join(reversed(name_stack))}"

function_repr = f"{outer_level_names}{function_def.name}({function_def.args.as_string()})"
self.add_message(
"unused-private-member",
node=function_def,
args=(
node.name,
function_repr,
f"{outer_level_names}.{function_def.name}({function_def.args.as_string()})".lstrip(
"."
),
),
)

Expand Down

0 comments on commit a4198cd

Please sign in to comment.