# HG changeset patch # User Gustavo Picon # Date 1270514810 18000 # Node ID b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 # Parent d6e806ea0e33135c8cc2679d83d1ce4a37587cdd making the latest version of pep8.py happy diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/.buildinfo --- a/docs/.buildinfo Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/.buildinfo Mon Apr 05 19:46:50 2010 -0500 @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 4702369698cd000d34fde9c8155e9cf5 +config: 667b97e8fd7a1c34d350e43d2f86f81d tags: fbb0d17656682115ca4d033fb2f83ba1 diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/_static/basic.css --- a/docs/_static/basic.css Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/_static/basic.css Mon Apr 05 19:46:50 2010 -0500 @@ -332,6 +332,18 @@ background-color: #ffa } +.line-block { + display: block; + margin-top: 1em; + margin-bottom: 1em; +} + +.line-block .line-block { + margin-top: 0; + margin-bottom: 0; + margin-left: 1.5em; +} + /* -- code displays --------------------------------------------------------- */ pre { @@ -392,7 +404,7 @@ div.document, div.documentwrapper, div.bodywrapper { - margin: 0; + margin: 0 !important; width: 100%; } diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/_static/default.css --- a/docs/_static/default.css Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/_static/default.css Mon Apr 05 19:46:50 2010 -0500 @@ -207,4 +207,12 @@ background-color: #ecf0f3; padding: 0 1px 0 1px; font-size: 0.95em; +} + +.warning tt { + background: #efc2c2; +} + +.note tt { + background: #d6d6d6; } \ No newline at end of file diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/conf.py --- a/docs/conf.py Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/conf.py Mon Apr 05 19:46:50 2010 -0500 @@ -42,9 +42,9 @@ # other places throughout the built documents. # # The short X.Y version. -version = '2.0' +version = '2.1a' # The full version, including alpha/beta/rc tags. -release = '2.0' +release = '2.1a' # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/genindex.html --- a/docs/genindex.html Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/genindex.html Mon Apr 05 19:46:50 2010 -0500 @@ -5,13 +5,13 @@ - Index — numconv v2.0 documentation + Index — numconv v2.1a documentation - + @@ -131,18 +131,18 @@

Navigation

\ No newline at end of file diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/index.html --- a/docs/index.html Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/index.html Mon Apr 05 19:46:50 2010 -0500 @@ -5,13 +5,13 @@ - numconv — flexible numeric conversion for python — numconv v2.0 documentation + numconv — flexible numeric conversion for python — numconv v2.1a documentation - + @@ -55,7 +55,7 @@ license:Apache License 2.0 -version:2.0 +version:2.1a url:http://code.tabo.pe/numconv/ @@ -108,8 +108,8 @@
  • radix – The base that will be used in the conversions. The default value is 10 for decimal conversions.
  • alphabet

    A string that will be used as a encoding alphabet. -The length of the alphabet can be longer than the radix. In this case -the alphabet will be internally truncated.

    +The length of the alphabet can be longer than the radix. In this +case the alphabet will be internally truncated.

    The default value is numconv.BASE85

  • @@ -244,9 +244,9 @@
    \ No newline at end of file diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 docs/modindex.html --- a/docs/modindex.html Mon Apr 05 19:42:46 2010 -0500 +++ b/docs/modindex.html Mon Apr 05 19:46:50 2010 -0500 @@ -5,13 +5,13 @@ - Global Module Index — numconv v2.0 documentation + Global Module Index — numconv v2.1a documentation - + - + @@ -83,14 +83,14 @@
  • modules |
  • -
  • numconv v2.0 documentation »
  • +
  • numconv v2.1a documentation »
  • diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 numconv.py --- a/numconv.py Mon Apr 05 19:42:46 2010 -0500 +++ b/numconv.py Mon Apr 05 19:46:50 2010 -0500 @@ -8,7 +8,7 @@ strings. :copyright: 2008-2009 by Gustavo Picon :license: Apache License 2.0 -:version: 2.0 +:version: 2.1a :url: http://code.tabo.pe/numconv/ :documentation: `numconv-docs @@ -46,7 +46,7 @@ """ -__version__ = '2.0.0' +__version__ = '2.1.0a' # from april fool's rfc 1924 BASE85 = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' \ @@ -65,20 +65,20 @@ class NumConv(object): """Class to create converter objects. - + :param radix: The base that will be used in the conversions. The default value is 10 for decimal conversions. :param alphabet: A string that will be used as a encoding alphabet. - The length of the alphabet can be longer than the radix. In this case - the alphabet will be internally truncated. - + The length of the alphabet can be longer than the radix. In this + case the alphabet will be internally truncated. + The default value is :data:`numconv.BASE85` - + :raise TypeError: when *radix* isn't an integer :raise ValueError: when *radix* is invalid :raise ValueError: when *alphabet* has duplicated characters """ - + def __init__(self, radix=10, alphabet=BASE85): "basic validation and cached_map storage" if int(radix) != radix: @@ -95,38 +95,38 @@ def int2str(self, num): """Converts an integer into a string. - + :param num: A numeric value to be converted to another base as a string. - - + + :rtype: string - + :raise TypeError: when *num* isn't an integer :raise ValueError: when *num* isn't positive - + **Examples** (taken from :file:`tests.py`): - + 3735928559 to hexadecimal:: - + >> NumConv(16).int2str(3735928559) 'DEADBEEF' - + 19284 to binary:: - + >> NumConv(2).int2str(19284) '100101101010100' - + 37 to base 4 using a custom dictionary:: - + >> NumConv(4, 'rofl').int2str(37) 'foo' - + Very large number to :data:`~numconv.BASE85`:: - + >> NumConv(85).int2str(2693233728041137L) '~123AFz@' - + """ if int(num) != num: raise TypeError('number must be an integer') @@ -143,42 +143,41 @@ break num //= radix return ret - - + def str2int(self, num): """Converts a string into an integer. - + If possible, the built-in python conversion will be used for speed purposes. - + :param num: A string that will be converted to an integer. - + :rtype: integer - + :raise ValueError: when *num* is invalid - + **Examples** (taken from :file:`tests.py`): - + Hexadecimal 'DEADBEEF' to integer:: - + >> NumConv(16).str2int('DEADBEEF') 3735928559L - + Binary '100101101010100' to integer:: - + >> NumConv(2).str2int('100101101010100') 19284 - + Base 4 with custom encoding 'foo' to integer:: - + >> NumConv(4, 'rofl').str2int('foo') 37 - + :data:`~numconv.BASE85` '~123AFz@' to integer:: - + >> NumConv(85).str2int('~123AFz@') 2693233728041137L - + """ radix, alphabet = self.radix, self.alphabet if radix <= 36 and alphabet[:radix].lower() == BASE85[:radix].lower(): @@ -197,7 +196,7 @@ "helper for quick base conversions from integers to strings" return NumConv(radix, alphabet).int2str(num) + def str2int(num, radix=10, alphabet=BASE85): "helper for quick base conversions from strings to integers" return NumConv(radix, alphabet).str2int(num) - diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 setup.py --- a/setup.py Mon Apr 05 19:42:46 2010 -0500 +++ b/setup.py Mon Apr 05 19:46:50 2010 -0500 @@ -3,7 +3,7 @@ import os from distutils.core import setup -version = '2.0' +version = '2.1a' classifiers = [ "Development Status :: 5 - Production/Stable", @@ -15,7 +15,7 @@ ] root_dir = os.path.dirname(__file__) -long_desc = open((root_dir if root_dir else '.')+'/README').read() +long_desc = open((root_dir if root_dir else '.') + '/README').read() setup( name='numconv', diff -r d6e806ea0e33135c8cc2679d83d1ce4a37587cdd -r b27cf772ba32922b3348ddd3bfc3d313bfc5fbc2 tests.py --- a/tests.py Mon Apr 05 19:42:46 2010 -0500 +++ b/tests.py Mon Apr 05 19:46:50 2010 -0500 @@ -97,7 +97,7 @@ """sanity check: testing a large interval and lots of radixes""" for radix in range(2, len(BASE85)): ncobj = NumConv(radix) - for num in range(1000) + [10**x for x in range(5, 15)]: + for num in range(1000) + [10 ** x for x in range(5, 15)]: self.assertEqual(num, ncobj.str2int(ncobj.int2str(num))) if __name__ == "__main__":