Skip to content

Commit

Permalink
chore: compact retrieving instance
Browse files Browse the repository at this point in the history
  • Loading branch information
geeshta committed Sep 29, 2023
1 parent 05b82cf commit 4f39cad
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions litestar/middleware/exceptions/_debug_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,7 @@ def get_symbol_name(frame: FrameInfo) -> str:
locals_dict = frame.frame.f_locals
# this piece assumes that the code uses standard names "self" and "cls"
# in instance and class methods
instance_or_cls = None
if "self" in locals_dict:
instance_or_cls = locals_dict["self"]
elif "cls" in locals_dict:
instance_or_cls = locals_dict["cls"]
instance_or_cls = inst if (inst := locals_dict.get("self")) is not None else locals_dict.get("cls")

classname = f"{get_name(instance_or_cls)}." if instance_or_cls is not None else ""

Expand Down

0 comments on commit 4f39cad

Please sign in to comment.