pytimeparser package

Submodules

pytimeparser.api module

pytimeparser.api.parse(text)[source]

Parse time expression.

Parameters:text – Time expression to parse
Returns:datetime.timedelta object
Return type:datetime.timedelta
Raises:TypeError: if text is not a string
Raises:ValueError: if text is empty

pytimeparser.utils module

Utility functions

pytimeparser.utils.expand_regex(regex, text, template, sep=' ')[source]

Expand regex using provided template

pytimeparser.utils.mapping_inversed(mapping)[source]

Inverse a mapping of lists

pytimeparser.utils.mapping_to_list(mapping)[source]

Convert a mapping to a list

pytimeparser.utils.normalize_numbers(text)[source]

Normalize numbers.

pytimeparser.utils.normalize_text(text)[source]

Normalize text by normalizing whitespace and numbers.

pytimeparser.utils.normalize_whitespace(text, replace_with=' ')[source]

Normalize whitespace.

pytimeparser.utils.remove_whitespace(text)[source]

Remove all whitespace.

Module contents

Top-level package for Python time expressions parser.

pytimeparser.parse(text)[source]

Parse time expression.

Parameters:text – Time expression to parse
Returns:datetime.timedelta object
Return type:datetime.timedelta
Raises:TypeError: if text is not a string
Raises:ValueError: if text is empty