Skip to content

Commit a7450bd

Browse files
authored
Merge pull request #208 from tataratat/ft-show-options-call
add __call__ to ShowOption
2 parents e6137ea + d079235 commit a7450bd

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

gustaf/helpers/options.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,32 @@ def __contains__(self, key):
351351
"""
352352
return key in self._options
353353

354+
def __call__(self, **kwargs):
355+
"""A short-cut to update(), but it returns helpee object.
356+
This is mainly to support one-line/inline visualizations.
357+
358+
Parameters
359+
----------
360+
kwargs: **kwargs
361+
362+
Returns
363+
-------
364+
helpee: Any
365+
366+
Example
367+
-------
368+
.. code-block:: python
369+
370+
gus.show(
371+
mesh1.show_options(c="red"),
372+
mesh2.show_options(c="green"),
373+
mesh3.show_options(c="blue"),
374+
)
375+
"""
376+
self.update(**kwargs)
377+
378+
return self._helpee
379+
354380
def get(self, key, default=None):
355381
"""
356382
Gets value from key and default. Similar to dict.get(),

0 commit comments

Comments
 (0)