Skip to main content

CircleCI Test Coverage Maintainability

clockrange

A clock-like periodic sequence generator

Installation

pip install clockrange

Getting Started

ClockRange provides clock-like sequences according to the given specification:

from clockrange import ClockRange

# A typical 24h microsecond-granular clock.
clock = ClockRange((24, 60, 60, 1000, 1000))

# How many microseconds until the clock completes a full cycle?
len(clock)

# How does the clock look like when 150000 microseconds have passed?
clock[150000]

See more examples below.

Examples

ClockRange accepts different specification formats:

# These are equivalent:
ClockRange((3, 60))
ClockRange(([0, 1, 2], 60))
ClockRange((range(3), 60))
ClockRange((range(0, 3, 1), 60))

# These result in .counters being different from .rendered:
ClockRange((["A", "B", "Z"], 60))
ClockRange((range(4, 10, 2), 60))

ClockRange instances support random item access with O(1) runtime performance:

clock = ClockRange((24, 60, 60))
clock[0] # ClockState(counters=(0, 0, 0), cycles=0, rendered=(0, 0, 0))
clock[1] # ClockState(counters=(0, 0, 1), cycles=0, rendered=(0, 0, 1))
clock[86400] # ClockState(counters=(0, 0, 0), cycles=1, rendered=(0, 0, 0))

ClockRange.__len__ provides the cycle length:

assert len(ClockRange((12,))) == 12
assert len(ClockRange((10, 10))) == 100
assert len(ClockRange((24, 60, 60))) == 86400

ClockRange instances can be iterated on:

clock = ClockRange((24, 60, 60))
it = iter(clock)
next(it) # ClockState(counters=(0, 0, 0), cycles=0, rendered=(0, 0, 0))
next(it) # ClockState(counters=(0, 0, 1), cycles=0, rendered=(0, 0, 1))

ClockRange iterators never get exhausted, so loop control needs to be performed manually:

for state in ClockRange((24, 60, 60):
    if state.cycle == 1:
        break

Contributing

To run the test suite locally, clone and setup the repository for local development:

pipenv install
pytest --cov-report=html

Metadata

Release files for clockrange 0.0.1

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

Source distribution (sdist)

Source distribution for clockrange 0.0.1
File Size Uploaded Provenance Actions
clockrange-0.0.1.tar.gz 2.5 kB Without provenance Details for clockrange-0.0.1.tar.gz

Built distribution (wheel)

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

Total release size: 5.4 kB

Release files / clockrange-0.0.1.tar.gz

Download URL clockrange-0.0.1.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
04ebb0b4f23b5ca71570a4ca7e807c131d1b8001941f422ab6a49587589ebf89
BLAKE2b-256 checksum
How to use checksums
0edf8adc4d061d166f51b0cd69270cf40366e38676076e00e535485338df0e9d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Release files / clockrange-0.0.1-py3-none-any.whl

Download URL clockrange-0.0.1-py3-none-any.whl
Size 2.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0151204e8f65129f8bcc5ab745d19ba79372d0c318bd7a1194d59eff9caf17fd
BLAKE2b-256 checksum
How to use checksums
83933c95254af283d1431b3abcd38be0a202bb8c349b3b872bb06fdc8ae0d841
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

Security for clockrange 0.0.1

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.

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files No provenance

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