Skip to main content

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


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 details)

Uploaded Source

Built Distribution

deltaman-0.0.4-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file deltaman-0.0.4.tar.gz.

File metadata

  • Download URL: deltaman-0.0.4.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.12 Linux/5.13.0-1031-azure

File hashes

Hashes for deltaman-0.0.4.tar.gz
Algorithm Hash digest
SHA256 0a2ec2f95bdef58f080d237fd10dd103ade5770d0955acbfd38616452eadc840
MD5 a9f4509bf60a898099a7495800f76f90
BLAKE2b-256 647402648becdab039d8b03ab5ef8384f4714b81d7f969d54bb34e634c65c844

See more details on using hashes here.

File details

Details for the file deltaman-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: deltaman-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.0 CPython/3.8.12 Linux/5.13.0-1031-azure

File hashes

Hashes for deltaman-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 627fdb72d610132e045353d0ccfcca06244845a44a733bc27a9cf3d5a37f5a26
MD5 8b4bac42b4ed9707f30b6e81750e5a77
BLAKE2b-256 9acfc25a20ee1c81db633da02e7c194ff0304dd82d2f47f9dd164137ff98782e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page