Metadata-Version: 2.1
Name: humanreadable
Version: 0.0.4
Summary: humanreadable is a Python library to convert from human-readable values to Python values.
Home-page: https://github.com/thombashi/humanreadable
Author: Tsuyoshi Hombashi
Author-email: tsuyoshi.hombashi@gmail.com
License: MIT License
Project-URL: Source, https://github.com/thombashi/humanreadable
Project-URL: Tracker, https://github.com/thombashi/humanreadable/issues
Keywords: human-readable,converter
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Text Processing
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
Requires-Dist: setuptools (>=38.3.0)
Requires-Dist: six (<2.0.0,>=1.11.0)
Requires-Dist: typepy (<1.0.0,>=0.4.0)
Provides-Extra: build
Requires-Dist: twine ; extra == 'build'
Requires-Dist: wheel ; extra == 'build'
Provides-Extra: release
Requires-Dist: releasecmd (<0.1.0,>=0.0.18) ; extra == 'release'
Provides-Extra: test
Requires-Dist: pytest ; extra == 'test'
Requires-Dist: tox ; extra == 'test'

.. contents:: **humanreadable**
   :backlinks: top
   :depth: 2


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

.. image:: https://badge.fury.io/py/humanreadable.svg
    :target: https://badge.fury.io/py/humanreadable
    :alt: PyPI package version

.. image:: https://img.shields.io/pypi/pyversions/humanreadable.svg
   :target: https://pypi.org/project/humanreadable
    :alt: Supported Python versions

.. image:: https://img.shields.io/travis/thombashi/humanreadable/master.svg?label=Linux%20CI
    :target: https://travis-ci.org/thombashi/humanreadable
    :alt: Linux CI status

.. image:: https://img.shields.io/appveyor/ci/thombashi/humanreadable/master.svg?label=Windows%20CI
    :target: https://ci.appveyor.com/project/thombashi/humanreadable

.. image:: https://coveralls.io/repos/github/thombashi/humanreadable/badge.svg?branch=master
    :target: https://coveralls.io/github/thombashi/humanreadable?branch=master
    :alt: Test coverage


Supported Unites
-------------------------------------------
- time (days, hours, minutes, seconds, ...)
- bit per seconds


Usage
============================================

Basic usages
-------------------------------------------
:Sample Code:
    .. code-block:: python

        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:
    .. code-block::

        [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


Set default unit
-------------------------------------------
:Sample Code:
    .. code-block:: python

        import humanreadable as hr

        print(hr.Time("1", default_unit=hr.Time.Unit.SECOND))

:Output:
    .. code-block::

        1.0 seconds


Units
-------------------------------------------
.. table:: Available units for ``humanreadable.Time``

    +------------+----------------------------------------------------------+
    |    Unit    |                Available specifiers (str)                |
    +============+==========================================================+
    |days        |``d``/``day``/``days``                                    |
    +------------+----------------------------------------------------------+
    |hours       |``h``/``hour``/``hours``                                  |
    +------------+----------------------------------------------------------+
    |minutes     |``m``/``min``/``mins``/``minute``/``minutes``             |
    +------------+----------------------------------------------------------+
    |seconds     |``s``/``sec``/``secs``/``second``/``seconds``             |
    +------------+----------------------------------------------------------+
    |milliseconds|``ms``/``msec``/``msecs``/``millisecond``/``milliseconds``|
    +------------+----------------------------------------------------------+
    |microseconds|``us``/``usec``/``usecs``/``microsecond``/``microseconds``|
    +------------+----------------------------------------------------------+

.. table:: Available units for ``humanreadable.BitPerSecond``

    +-----+---------------------------+
    |Unit |Available specifiers (str) |
    +=====+===========================+
    |bps  |``bps``/``bit/s``          |
    +-----+---------------------------+
    |Kbps |``[kK]bps``/``[kK]bit/s``  |
    +-----+---------------------------+
    |Kibps|``[kK]ibps``/``[kK]ibit/s``|
    +-----+---------------------------+
    |Mbps |``[mM]bps``/``[mM]bit/s``  |
    +-----+---------------------------+
    |Mibps|``[mM]ibps``/``[mM]ibit/s``|
    +-----+---------------------------+
    |Gbps |``[gG]bps``/``[gG]bit/s``  |
    +-----+---------------------------+
    |Gibps|``[gG]ibps``/``[gG]ibit/s``|
    +-----+---------------------------+
    |Tbps |``[tT]bps``/``[tT]bit/s``  |
    +-----+---------------------------+
    |Tibps|``[tT]ibps``/``[tT]ibit/s``|
    +-----+---------------------------+


Installation
============================================
::

    pip install humanreadable


Dependencies
============================================
Python 2.7+ or 3.4+

- `six <https://pypi.org/project/six/>`__
- `typepy <https://github.com/thombashi/typepy>`__


