From 676cfb44a79e059f74514ff492035e930ed57d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Mazzucotelli?= Date: Mon, 9 Sep 2024 16:57:17 +0200 Subject: [PATCH] fix: Fix identity checks in inspector when handling attributes --- src/_griffe/agents/inspector.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/_griffe/agents/inspector.py b/src/_griffe/agents/inspector.py index ef820f88..36e84f97 100644 --- a/src/_griffe/agents/inspector.py +++ b/src/_griffe/agents/inspector.py @@ -11,7 +11,7 @@ from _griffe.agents.nodes.runtime import ObjectNode from _griffe.collections import LinesCollection, ModulesCollection -from _griffe.enumerations import ObjectKind, ParameterKind +from _griffe.enumerations import Kind, ParameterKind from _griffe.expressions import safe_get_annotation from _griffe.extensions.base import Extensions, load_extensions from _griffe.importer import dynamic_import @@ -483,18 +483,18 @@ def handle_attribute(self, node: ObjectNode, annotation: str | Expr | None = Non self.extensions.call("on_node", node=node, agent=self) self.extensions.call("on_attribute_node", node=node, agent=self) - # TODO: to improve + # TODO: To improve. parent = self.current labels: set[str] = set() - if parent.kind is ObjectKind.MODULE: + if parent.kind is Kind.MODULE: labels.add("module") - elif parent.kind is ObjectKind.CLASS: + elif parent.kind is Kind.CLASS: labels.add("class") - elif parent.kind is ObjectKind.FUNCTION: + elif parent.kind is Kind.FUNCTION: if parent.name != "__init__": return - parent = parent.parent + parent = parent.parent # type: ignore[assignment] labels.add("instance") try: