diff --git a/.pypi_notice b/.pypi_notice index e70e200..6a51dd7 100644 --- a/.pypi_notice +++ b/.pypi_notice @@ -10,6 +10,13 @@ :height: 19 :width: 77 +.. image:: https://readthedocs.org/projects/bitmath/badge/?version=latest + :target: http://bitmath.rtfd.org/ + :align: right + :height: 19 + :width: 77 + + bitmath ======= @@ -106,22 +113,22 @@ Arithmetic .. code-block:: python - In [1]: from bitmath import * + >>> from bitmath import * - In [2]: log_size = kB(137.4) + >>> log_size = kB(137.4) - In [3]: log_zipped_size = Byte(987) + >>> log_zipped_size = Byte(987) - In [4]: print "Compression saved %s space" % (log_size - log_zipped_size) + >>> print "Compression saved %s space" % (log_size - log_zipped_size) Compression saved 136.413kB space - In [5]: thumb_drive = GiB(12) + >>> thumb_drive = GiB(12) - In [6]: song_size = MiB(5) + >>> song_size = MiB(5) - In [7]: songs_per_drive = thumb_drive / song_size + >>> songs_per_drive = thumb_drive / song_size - In [8]: print songs_per_drive + >>> print songs_per_drive 2457.6 @@ -130,11 +137,11 @@ Convert Units .. code-block:: python - In [1]: from bitmath import * + >>> from bitmath import * - In [2]: dvd_size = GiB(4.7) + >>> dvd_size = GiB(4.7) - In [3]: print "DVD Size in MiB: %s" % dvd_size.to_MiB() + >>> print "DVD Size in MiB: %s" % dvd_size.to_MiB() DVD Size in MiB: 4812.8MiB @@ -143,14 +150,14 @@ Select a human-readable unit .. code-block:: python - In [4]: small_number = kB(100) + >>> small_number = kB(100) - In [5]: ugly_number = small_number.to_TiB() + >>> ugly_number = small_number.to_TiB() - In [6]: print ugly_number + >>> print ugly_number 9.09494701773e-08TiB - In [7]: print ugly_number.best_prefix() + >>> print ugly_number.best_prefix() 97.65625KiB @@ -159,30 +166,30 @@ Rich Comparison .. code-block:: python - In [8]: cd_size = MiB(700) + >>> cd_size = MiB(700) - In [9]: cd_size > dvd_size - Out[9]: False + >>> cd_size > dvd_size + False - In [10]: cd_size < dvd_size - Out[10]: True + >>> cd_size < dvd_size + True - In [11]: MiB(1) == KiB(1024) - Out[11]: True + >>> MiB(1) == KiB(1024) + True - In [12]: MiB(1) <= KiB(1024) - Out[12]: True + >>> MiB(1) <= KiB(1024) + True Sorting ------- .. code-block:: python - In [13]: sizes = [KiB(7337.0), KiB(1441.0), KiB(2126.0), KiB(2178.0), + >>> sizes = [KiB(7337.0), KiB(1441.0), KiB(2126.0), KiB(2178.0), KiB(2326.0), KiB(4003.0), KiB(48.0), KiB(1770.0), KiB(7892.0), KiB(4190.0)] - In [14]: print sorted(sizes) + >>> print sorted(sizes) [KiB(48.0), KiB(1441.0), KiB(1770.0), KiB(2126.0), KiB(2178.0), KiB(2326.0), KiB(4003.0), KiB(4190.0), KiB(7337.0), KiB(7892.0)] @@ -197,7 +204,7 @@ Example: .. code-block:: python - In [8]: longer_format = """Formatting attributes for %s + >>> longer_format = """Formatting attributes for %s ...: This instances prefix unit is {unit}, which is a {system} type unit ...: The unit value is {value} ...: This value can be truncated to just 1 digit of precision: {value:.1f} @@ -208,7 +215,7 @@ Example: ...: The instance is {bits} bits large ...: bytes/bits without trailing decimals: {bytes:.0f}/{bits:.0f}""" % str(ugly_number) - In [9]: print ugly_number.format(longer_format) + >>> print ugly_number.format(longer_format) Formatting attributes for 5.96046447754MiB This instances prefix unit is MiB, which is a NIST type unit The unit value is 5.96046447754 diff --git a/README.md b/README.md index de7ab94..c025bd6 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![Build Status](https://api.travis-ci.org/tbielawa/bitmath.png)](https://travis-ci.org/tbielawa/bitmath/) [![Coverage Status](https://img.shields.io/coveralls/tbielawa/bitmath.svg)](https://coveralls.io/r/tbielawa/bitmath?branch=master) -[![Documentation](https://readthedocs.org/projects/bitmath/badge/?version=latest)](https://readthedocs.org/projects/bitmath/?badge=latest) +[![Documentation](https://readthedocs.org/projects/bitmath/badge/?version=latest)](http://bitmath.rtfd.org/) bitmath