@@ -175,15 +175,14 @@ def check(
175
175
Yields:
176
176
All the problems with the attributes.
177
177
"""
178
- all_targets = list (
179
- chain (_iter_class_attrs (class_assign_nodes ), _iter_method_attrs (method_assign_nodes ))
180
- )
181
- all_public_targets = list (
182
- target for target in all_targets if not target .name .startswith (PRIVATE_ATTR_PREFIX )
178
+ all_class_targets = list (_iter_class_attrs (class_assign_nodes ))
179
+ all_public_class_targets = list (
180
+ target for target in all_class_targets if not target .name .startswith (PRIVATE_ATTR_PREFIX )
183
181
)
182
+ all_targets = list (chain (all_class_targets , _iter_method_attrs (method_assign_nodes )))
184
183
185
184
# Check that attrs section is in docstring if function/ method has public attributes
186
- if all_public_targets and docstr_info .attrs is None :
185
+ if all_public_class_targets and docstr_info .attrs is None :
187
186
yield types_ .Problem (
188
187
docstr_node .lineno , docstr_node .col_offset , ATTRS_SECTION_NOT_IN_DOCSTR_MSG
189
188
)
@@ -206,7 +205,7 @@ def check(
206
205
# Check for class attributes that are not in the docstring
207
206
yield from (
208
207
types_ .Problem (target .lineno , target .col_offset , ATTR_NOT_IN_DOCSTR_MSG % target .name )
209
- for target in all_public_targets
208
+ for target in all_public_class_targets
210
209
if target .name not in docstr_attrs
211
210
)
212
211
@@ -218,7 +217,7 @@ def check(
218
217
)
219
218
220
219
# Check for empty attrs section
221
- if not all_public_targets and len (docstr_info .attrs ) == 0 :
220
+ if not all_public_class_targets and len (docstr_info .attrs ) == 0 :
222
221
yield types_ .Problem (
223
222
docstr_node .lineno , docstr_node .col_offset , ATTRS_SECTION_IN_DOCSTR_MSG
224
223
)
0 commit comments