Skip to main content

DESCRIPTION

Project description

Summary

humanreadable is a Python library to convert from human-readable values to Python values.

PyPI package version https://img.shields.io/pypi/pyversions/humanreadable.svg Linux CI status https://img.shields.io/appveyor/ci/thombashi/humanreadable/master.svg?label=Windows%20CI Test coverage

Supported Unites

  • time (days, hours, minutes, seconds, …)

  • bit per seconds

Usage

Sample Code:
import humanreadable as hr

print("\n[Examples: humanreadable.Time]")
value = "120 sec"
print("'{}' to msecs -> {}".format(value, hr.Time(value).milliseconds))
print("'{}' to minutes -> {}".format(value, hr.Time(value).minutes))

print("\n[Examples: humanreadable.BitPerSecond]")
value = "1 Gbps"
print("'{}' to Mbps -> {}".format(value, hr.BitPerSecond(value).mega_bps))
print("'{}' to Kbps -> {}".format(value, hr.BitPerSecond(value).kilo_bps))
print("'{}' to Kibps -> {}".format(value, hr.BitPerSecond(value).kibi_bps))
Output:
[Examples: humanreadable.Time]
120 sec to msecs -> 120000.0
120 sec to minutes -> 2.0

[Examples: humanreadable.BitPerSecond]
1 Gbps to Mbps -> 1000.0
1 Gbps to Kbps -> 1000000.0
1 Gbps to Kibps -> 953674.31640625

Installation

pip install humanreadable

Dependencies

Python 2.7+ or 3.4+

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

humanreadable-0.0.1.tar.gz (8.7 kB view hashes)

Uploaded Source

Built Distribution

humanreadable-0.0.1-py2.py3-none-any.whl (8.3 kB view hashes)

Uploaded Python 2 Python 3

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