Skip to content

Commit

Permalink
refactor: Make attribute labels more explicit
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Feb 13, 2022
1 parent 0e503d1 commit 19eac2e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/griffe/agents/visitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,13 +433,13 @@ def handle_attribute( # noqa: WPS231
names = get_names(node)
except KeyError: # unsupported nodes, like subscript
return
labels.add("module")
labels.add("module-attribute")
elif parent.kind is Kind.CLASS:
try:
names = get_names(node)
except KeyError: # unsupported nodes, like subscript
return
labels.add("class")
labels.add("class-attribute")
elif parent.kind is Kind.FUNCTION:
if parent.name != "__init__":
return
Expand All @@ -448,7 +448,7 @@ def handle_attribute( # noqa: WPS231
except KeyError: # unsupported nodes, like subscript
return
parent = parent.parent # type: ignore[assignment]
labels.add("instance")
labels.add("instance-attribute")

if not names:
return
Expand Down

0 comments on commit 19eac2e

Please sign in to comment.