Skip to content

Commit

Permalink
fix: Fix new expressions (kind property -> classname)
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Aug 16, 2023
1 parent 66c8ad5 commit 0fe8f91
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/griffe/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def _expr_as_dict(expression: Expr, **kwargs: Any) -> dict[str, Any]:
for field in sorted(getfields(expression), key=lambda f: f.name)
if field.name != "parent"
}
fields["cls"] = expression.__class__.__name__
fields["cls"] = expression.classname
return fields


Expand Down Expand Up @@ -99,9 +99,9 @@ def as_dict(self, **kwargs: Any) -> dict[str, Any]:
return _expr_as_dict(self, **kwargs)

@property
def kind(self) -> str:
"""The expression kind."""
return self.__class__.__name__.lower()[4:]
def classname(self) -> str:
"""The expression class name."""
return self.__class__.__name__

@property
def path(self) -> str:
Expand Down Expand Up @@ -1003,7 +1003,8 @@ def safe_get_expression(
except ValueError:
path = "<in-memory>"
lineno = node.lineno # type: ignore[union-attr]
message = msg_format.format(path=path, lineno=lineno, node_class=node_class, error=error)
error_str = f"{error.__class__.__name__}: {error}"
message = msg_format.format(path=path, lineno=lineno, node_class=node_class, error=error_str)
getattr(logger, log_level.value)(message)
return None

Expand Down

0 comments on commit 0fe8f91

Please sign in to comment.