opening_hours
TODO: documentation
Validate that input string is a correct opening hours description.
Examples
>>> opening_hours.validate("24/7")
True
>>> opening_hours.validate("24/24")
False
Parse input opening hours description.
Raises
- SyntaxError: Given string is not in valid opening hours format.
Examples
>>> oh = OpeningHours("24/7")
>>> oh.is_open()
True
Get current state of the time domain, the state can be either "open", "closed" or "unknown".
Parameters
- time (Optional[datetime]): Base time for the evaluation, current time will be used if it is not specified.
Examples
>>> OpeningHours("24/7 off").state()
"closed"
Check if current state is open.
Parameters
- time (Optional[datetime]): Base time for the evaluation, current time will be used if it is not specified.
Examples
>>> OpeningHours("24/7").is_open()
True
Check if current state is closed.
Parameters
- time (Optional[datetime]): Base time for the evaluation, current time will be used if it is not specified.
Examples
>>> OpeningHours("24/7 off").is_closed()
True
Check if current state is unknown.
Parameters
- time (Optional[datetime]): Base time for the evaluation, current time will be used if it is not specified.
Examples
>>> OpeningHours("24/7 unknown").is_unknown()
True
Get the date for next change of state.
Parameters
- time (Optional[datetime]): Base time for the evaluation, current time will be used if it is not specified.
Examples
>>> OpeningHours("2099Mo-Su 12:30-17:00").next_change()
datetime.datetime(2099, 1, 1, 12, 30)
Give an iterator that yields successive time intervals of consistent state.
Parameters
- start (Optional[datetime]): Initial time for the iterator, current time will be used if it is not specified.
- end (Optional[datetime]): Maximal time for the iterator, the iterator will continue until year 9999 if it no max is specified.
Examples
TODO
#  
__doc__ = 'Parse input opening hours description.\n\nRaises\n------\nSyntaxError\n Given string is not in valid opening hours format.\n\nExamples\n--------\n>>> oh = OpeningHours("24/7")\n>>> oh.is_open()\nTrue'