Skip to main content

1102

Turn a number of seconds into something readable, and read it back.

The import name is p1102 because a Python module cannot start with a digit:

from p1102 import format_duration

Install

pip install 1102

Usage

from p1102 import format_duration, parse_duration

format_duration(0)            # '0s'
format_duration(90)           # '1m 30s'
format_duration(93784)        # '1d 2h 3m'
format_duration(-90)          # '-1m 30s'
format_duration(93784, 2)     # '1d 2h'

parse_duration('1d 2h 3m 4s') # 93784.0
parse_duration('90s')         # 90.0
parse_duration('90')          # 90.0

Rules

d, h, m, s, case insensitive, any order, repeatable. Unparseable text raises ValueError rather than returning 0 — a silent zero in a timeout calculation is worse than a crash.

License

MIT

Metadata

Release files for 1102 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for 1102 0.0.2
File Size Uploaded Provenance Actions
1102-0.0.2.tar.gz 3.1 kB Without provenance Details for 1102-0.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for 1102 0.0.2
File Interpreter ABI Platform Actions
1102-0.0.2-py3-none-any.whl Python 3 none any Details for 1102-0.0.2-py3-none-any.whl

Total release size: 6.6 kB

Release files / 1102-0.0.2.tar.gz

Download URL 1102-0.0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
27dcfa1972e96360da8614859a12e6ef9d7d84237a8805945446d9deddeddd13
BLAKE2b-256 checksum
How to use checksums
2fd1af5654c9ed53c3113d61919eb24706df10039e59659b067537f39b45dcc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Release files / 1102-0.0.2-py3-none-any.whl

Download URL 1102-0.0.2-py3-none-any.whl
Size 3.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b3b5f850d40b3aa63787646566efb66e4b40b4f72b8d418153cedcf0e0b80bbf
BLAKE2b-256 checksum
How to use checksums
fa5c8180f812b3680df693660d305564fb39005568f97e8255a8688d9b75e330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.10.11

Security for 1102 0.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page