Skip to content

Commit a4198cd

Browse files
committed
Update pr based on review
1 parent c8b2cbb commit a4198cd

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

ChangeLog

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Release date: TBA
1414

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

17-
Closes #4744
17+
Closes #4744
1818

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

5757
Closes #3692
5858

59+
* Fix false-positive of ``unused-private-member`` when using nested functions in a class
60+
61+
Closes #4673
62+
5963

6064
What's New in Pylint 2.9.6?
6165
===========================
@@ -169,10 +173,6 @@ Release date: 2021-07-20
169173

170174
Closes #4723
171175

172-
* Fix false-positive of ``unused-private-member`` when using nested functions in a class
173-
174-
Closes #4673
175-
176176

177177
What's New in Pylint 2.9.3?
178178
===========================

pylint/checkers/classes.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -939,23 +939,22 @@ def _check_unused_private_functions(self, node: astroid.ClassDef) -> None:
939939
break
940940
else:
941941
name_stack = []
942-
outer_level_names = ""
943942
curr = parent_scope
944943
# Generate proper names for nested functions
945944
while curr != node:
946945
name_stack.append(curr.name)
947946
curr = curr.parent.scope()
948947

949-
if name_stack:
950-
outer_level_names = f"{'.'.join(reversed(name_stack))}."
948+
outer_level_names = f"{'.'.join(reversed(name_stack))}"
951949

952-
function_repr = f"{outer_level_names}{function_def.name}({function_def.args.as_string()})"
953950
self.add_message(
954951
"unused-private-member",
955952
node=function_def,
956953
args=(
957954
node.name,
958-
function_repr,
955+
f"{outer_level_names}.{function_def.name}({function_def.args.as_string()})".lstrip(
956+
"."
957+
),
959958
),
960959
)
961960

0 commit comments

Comments
 (0)