Parsing human time intervals
Project description
Deltaman - Parsing human time intervals
pip install deltaman
Getting Started
from deltaman import delta_parser
for delta in ("15s", "3min", "1h15m", "1 day 12 hours", "1m-15s"):
parsed = delta_parser.parse(delta)
print(f'{delta!r:20s} {parsed!r:20s}')
That outputs
'15s' datetime.timedelta(seconds=15)
'3min' datetime.timedelta(seconds=180)
'1h15m' datetime.timedelta(seconds=4500)
'1 day 12 hours' datetime.timedelta(days=1, seconds=43200)
'1m-15s' datetime.timedelta(seconds=45)
Note you can get more examples from the testing files.
Testing
$ pytest
Or
$ tox
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
deltaman-0.0.4.tar.gz
(27.1 kB
view hashes)
Built Distribution
deltaman-0.0.4-py3-none-any.whl
(27.4 kB
view hashes)