Skip to content

Commit

Permalink
Fix docs badges in readmes
Browse files Browse the repository at this point in the history
  • Loading branch information
tbielawa committed Dec 29, 2014
1 parent 6718991 commit 7ede17d
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
63 changes: 35 additions & 28 deletions .pypi_notice
Expand Up @@ -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
=======

Expand Down Expand Up @@ -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


Expand All @@ -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


Expand All @@ -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


Expand All @@ -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)]

Expand All @@ -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}
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion 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
Expand Down

0 comments on commit 7ede17d

Please sign in to comment.