Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Apr 16, 2024
1 parent ea40015 commit 253b98a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/sdist/amici/swig.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Functions related to SWIG or SWIG-generated code"""
from __future__ import annotations
import ast
import contextlib
import re
Expand Down Expand Up @@ -74,7 +75,10 @@ def visit_FunctionDef(self, node):
arg.annotation = self._new_annot(arg.annotation.value)
return node

def _new_annot(self, old_annot: str):
def _new_annot(self, old_annot: str | ast.Name):
if isinstance(old_annot, ast.Name):
old_annot = old_annot.id

with contextlib.suppress(KeyError):
return self.mapping[old_annot]

Expand Down

0 comments on commit 253b98a

Please sign in to comment.