ape.infrastructure.timemap.RelativeTime

class ape.infrastructure.timemap.RelativeTime(source=None)

A timedeltas extension

RelativeTime constructor

Param:
  • source: A string with relative time in it (e.g. ‘1week 2 days 4.2 seconds’)
__init__(source=None)

RelativeTime constructor

Param:
  • source: A string with relative time in it (e.g. ‘1week 2 days 4.2 seconds’)

Methods

__init__([source]) RelativeTime constructor
get_number(*args, **kwargs)
log_error(error[, message]) Logs the error in bold red
populate_fields() populates the time fields with values (e.g. self.minutes)
reset() Resets the attributes (undoes populate_fields)
total_seconds(*args, **kwargs)

Attributes

days
logger
return:A logging object.
microseconds
seconds
source
return:the source string
time_map A relative time map instance to parse the source.
log_error(error, message='')

Logs the error in bold red

Param:
  • error: error type (prefix in red and bold)
  • message: descriptive message (red but not bold)
populate_fields()

populates the time fields with values (e.g. self.minutes)

reset()

Resets the attributes (undoes populate_fields)

logger
Returns:A logging object.
source
Returns:the source string
time_map

A relative time map instance to parse the source.

Navigation