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 87c34fa commit 3990e71
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions swig/edata.i
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,18 @@ def __new__(cls, *args, **kwargs):
if not args:
return super().__new__(cls)

if isinstance(args[0], numpy.ReturnDataView):
from amici.numpy import ReturnDataView

if isinstance(args[0], ReturnDataView):
return super().__new__(cls, _get_ptr(args[0]["ptr"]), *args[1:])

if isinstance(args[0], (amici_swig.ExpData, amici_swig.ExpDataPtr)):
if isinstance(args[0], (ExpData, ExpDataPtr)):
# the *args[:1] should be empty, but by the time you read this,
# the constructor signature may have changed, and you are glad this
# wrapper did not break.
return super().__new__(cls, _get_ptr(args[0]), *args[1:])

if isinstance(args[0], (amici_swig.Model, amici_swig.ModelPtr)):
if isinstance(args[0], (Model, ModelPtr)):
return super().__new__(cls, _get_ptr(args[0]))

return super().__new__(cls, *args)
Expand Down

0 comments on commit 3990e71

Please sign in to comment.