Utility Functions and Types

Helper Classes

class hymn.utils.CachedSequence(iterable)

Bases: object

sequence wrapper that is lazy while keeps the items

Helper Functions

hymn.utils.const(value)

constant function

hymn.utils.suppress(*exceptions)[source]

Context manager to suppress specified exceptions

After the exception is suppressed, execution proceeds with the next statement following the with statement.

with suppress(FileNotFoundError):
os.remove(somefile)

# Execution still resumes here if the file was already removed

hymn.utils.pipe(*fs)

reversed function composition