Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## latest

- Fixed `MicroSimulation` initialization requiring positional parameters [#255](https://github.com/precice/micro-manager/pull/255)
- Fixed model adaptivity convergence at resolution boundaries to prevent infinite loops for out-of-range switching requests [#252](https://github.com/precice/micro-manager/pull/252)
- Add function `set_global_id` to the dummies and the example in the integration test [#247](https://github.com/precice/micro-manager/pull/247)

Expand Down
16 changes: 13 additions & 3 deletions micro_manager/micro_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,9 +555,19 @@ def __getattr__(self, name):
# Only add initialize override if the wrapped class actually has it,
# so that requires_initialize() returns True for those classes.
if has_initialize:
class_body += """
def initialize(self, *args, **kwargs):
return self._wrapped.initialize(*args, **kwargs)
argspec = inspect.getfullargspec(cls.initialize)
# build args
init_args = f"{', '.join(argspec.args)}"
params = f"{', '.join(argspec.args[1::])}"
if argspec.varargs is not None:
init_args += f", *args"
params += f", *args"
if argspec.varkw is not None:
init_args += f", **kwargs"
params += f", **kwargs"
class_body += f"""
def initialize({init_args}):
return self._wrapped.initialize({params})
"""

# Only add output override if the wrapped class actually has it,
Expand Down
Loading