Skip to main content

Utility Module (1.5.0)

Functions

noop_context(noop=NoOp)

A NoOp/Dummy context manager that does basically nothing. It can be used as a stand-in for a more useful, but optional, context manager.

Parameters

noop : object, optional

The object to yield, by default NoOp()

Yields

noop

An instance of the NoOp class.

Examples

>>> from universal_extension import utility as util
>>> with noop_context() as test:
>>> test.run(5).stop()
>>> valid = True
>>> with noop_context() if not valid else real_context() as test:
>>> test.run()

Classes

class NoOp (**kwargs)

A NoOp/Dummy class that can be used for stubbing out other classes.

Raises

None

Examples

>>> from universal_extension import utility as util
>>> t = util.NoOp(1, 2, "testing")
>>> t.num = 5
>>> t.update("a", "b")