pyrio.utils =========== .. py:module:: pyrio.utils Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/pyrio/utils/dict_item/index /autoapi/pyrio/utils/optional/index Classes ------- .. autoapisummary:: pyrio.utils.DictItem pyrio.utils.Optional Package Contents ---------------- .. py:class:: DictItem(key, value) Helper record class for mapping key-value pairs .. py:attribute:: _key .. py:attribute:: _value .. py:property:: key .. py:property:: value .. py:method:: _map(val) .. py:method:: __repr__() .. py:method:: __eq__(other) .. py:method:: __hash__() .. py:class:: Optional(element) Container object which may (or may not) contain a non-null value .. py:attribute:: _element .. py:method:: __str__() .. py:method:: empty() :staticmethod: Creates empty Optional .. py:method:: of(element) :staticmethod: Creates Optional describing given non-null value .. py:method:: of_nullable(element) :staticmethod: Returns an Optional describing the given value, if non-null, otherwise returns an empty Optional .. py:method:: get() If a value is present, returns the value, otherwise raises an Exception .. py:method:: is_present() Returns bool whether a value is present .. py:method:: is_empty() Returns bool whether the Optional is empty .. py:method:: if_present(action) Performs given action with the value if the Optional is not empty .. py:method:: if_present_or_else(action, empty_action) Performs given action with the value if the Optional is not empty, otherwise calls fallback 'empty_action' .. py:method:: or_else(value) Returns the value if present, or a provided argument otherwise. Safe alternative to get() method .. py:method:: or_else_get(supplier) Returns the value if present, or calls a 'supplier' function otherwise. Safe alternative to get() method .. py:method:: or_else_raise(supplier=None) Returns the value if present, otherwise throws an exception produced by the exception supplying function (if such is provided by the user) or NoSuchElementError