tyrian.utils

tyrian.utils.flatten(obj, can_return_single: bool=False)[source]

Flattens nested lists, like so;

>>> from tyrian.utils import flatten
>>> flatten([[[[[[['value']]]]]]], can_return_single=True)
'value'
>>> flatten([[[[[[['value']]]]]]], can_return_single=False)
['value']
Parameters:
  • obj – nested list of lists, depth uncertain
  • can_return_single – see above
tyrian.utils.enforce_types(func: function)[source]

checks supplied argument types against the annotations

Parameters:func – function to enforce argument types for
Read the Docs v: latest
Versions
latest
Downloads
PDF
HTML
Epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.