Skip to content

Commit

Permalink
add __call__ to ShowOption
Browse files Browse the repository at this point in the history
  • Loading branch information
j042 committed May 7, 2024
1 parent e6137ea commit d079235
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions gustaf/helpers/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,32 @@ def __contains__(self, key):
"""
return key in self._options

def __call__(self, **kwargs):
"""A short-cut to update(), but it returns helpee object.
This is mainly to support one-line/inline visualizations.
Parameters
----------
kwargs: **kwargs
Returns
-------
helpee: Any
Example
-------
.. code-block:: python
gus.show(
mesh1.show_options(c="red"),
mesh2.show_options(c="green"),
mesh3.show_options(c="blue"),
)
"""
self.update(**kwargs)

return self._helpee

def get(self, key, default=None):
"""
Gets value from key and default. Similar to dict.get(),
Expand Down

0 comments on commit d079235

Please sign in to comment.