Skip to content

Commit

Permalink
fix: Fix getting subscript value
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Jan 4, 2022
1 parent 7d536d5 commit 1699f12
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/griffe/agents/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,10 @@ def _get_sub_value(node: NodeSub) -> str:


def _get_subscript_value(node: NodeSubscript) -> str:
return f"{get_value(node.value)}[{get_value(node.slice).strip('()')}]"
subscript = get_value(node.slice)
if isinstance(subscript, str):
subscript = subscript.strip("()")
return f"{get_value(node.value)}[{subscript}]"


def _get_tuple_value(node: NodeTuple) -> str:
Expand Down

0 comments on commit 1699f12

Please sign in to comment.