Permalink
Browse files

update to upstream 1.8.1

  • Loading branch information...
1 parent 323edd3 commit 6324ba718b25588f165d75817d7dbd594a49c421 @zookos zookos committed Dec 21, 2010
Showing with 1,126 additions and 490 deletions.
  1. +48 −4 COPYING.GPL
  2. +3 −0 COPYING.SPL.txt
  3. +57 −3 COPYING.TGPPL.html
  4. +7 −0 NEWS.rst
  5. +183 −0 README.rst
  6. +0 −43 README.txt
  7. +4 −1 pyutil/PickleSaver.py
  8. +1 −0 pyutil/__init__.py
  9. +1 −1 pyutil/_version.py
  10. +1 −1 pyutil/assertutil.py
  11. +1 −1 pyutil/benchmarks/bench_xor.py
  12. +25 −20 pyutil/benchutil.py
  13. +4 −5 pyutil/cache.py
  14. +8 −0 pyutil/dictutil.py
  15. +19 −99 pyutil/fileutil.py
  16. +2 −0 pyutil/find_exe.py
  17. +4 −1 pyutil/hashexpand.py
  18. +1 −1 pyutil/humanreadable.py
  19. +1 −1 pyutil/increasing_timer.py
  20. +5 −3 pyutil/jsonutil.py
  21. +6 −0 pyutil/logutil.py
  22. +2 −2 pyutil/mathutil.py
  23. +18 −11 pyutil/memutil.py
  24. +1 −1 pyutil/nummedobj.py
  25. +1 −0 pyutil/observer.py
  26. +7 −3 pyutil/randutil.py
  27. +1 −1 pyutil/repeatable_random.py
  28. +5 −5 pyutil/scripts/lines.py
  29. +2 −2 pyutil/scripts/memdump2dot.py
  30. +0 −2 pyutil/scripts/randfile.py
  31. +2 −6 pyutil/scripts/try_decoding.py
  32. +1 −1 pyutil/scripts/verinfo.py
  33. +2 −4 pyutil/strutil.py
  34. 0 pyutil/test/{json_tests → current}/__init__.py
  35. 0 pyutil/test/current/json_tests/__init__.py
  36. 0 pyutil/test/{ → current}/json_tests/test_decode.py
  37. 0 pyutil/test/{ → current}/json_tests/test_default.py
  38. 0 pyutil/test/{ → current}/json_tests/test_dump.py
  39. +0 −1 pyutil/test/{ → current}/json_tests/test_encode_basestring_ascii.py
  40. 0 pyutil/test/{ → current}/json_tests/test_fail.py
  41. 0 pyutil/test/{ → current}/json_tests/test_float.py
  42. 0 pyutil/test/{ → current}/json_tests/test_indent.py
  43. 0 pyutil/test/{ → current}/json_tests/test_pass1.py
  44. 0 pyutil/test/{ → current}/json_tests/test_pass2.py
  45. 0 pyutil/test/{ → current}/json_tests/test_pass3.py
  46. +1 −1 pyutil/test/{ → current}/json_tests/test_recursion.py
  47. 0 pyutil/test/{ → current}/json_tests/test_separators.py
  48. +0 −1 pyutil/test/{ → current}/json_tests/test_speedups.py
  49. 0 pyutil/test/{ → current}/json_tests/test_unicode.py
  50. +3 −11 pyutil/test/{ → current}/test_assertutil.py
  51. 0 pyutil/test/{ → current}/test_fileutil.py
  52. +5 −3 pyutil/test/{ → current}/test_iputil.py
  53. 0 pyutil/test/{ → current}/test_jsonutil.py
  54. +12 −20 pyutil/test/{ → current}/test_mathutil.py
  55. 0 pyutil/test/{ → current}/test_time_format.py
  56. +23 −0 pyutil/test/current/test_version_class.py
  57. 0 pyutil/test/deprecated/__init__.py
  58. +6 −6 pyutil/test/{ → deprecated}/test_dictutil.py
  59. +3 −3 pyutil/test/{ → deprecated}/test_picklesaver.py
  60. +3 −11 pyutil/test/{ → deprecated}/test_xor.py
  61. 0 pyutil/test/out_of_shape/__init__.py
  62. +16 −16 pyutil/test/{ → out_of_shape}/test_cache.py
  63. +16 −19 pyutil/test/{ → out_of_shape}/test_odict.py
  64. +30 −0 pyutil/test/out_of_shape/test_strutil.py
  65. +17 −17 pyutil/test/{ → out_of_shape}/test_zlibutil.py
  66. +0 −36 pyutil/test/test_strutil.py
  67. +0 −32 pyutil/test/test_template
  68. +126 −0 pyutil/test/test_verlib.py
  69. +9 −5 pyutil/testutil.py
  70. +5 −1 pyutil/twistedutil.py
  71. +338 −0 pyutil/verlib.py
  72. +22 −20 pyutil/version_class.py
  73. +5 −2 pyutil/weakutil.py
  74. +0 −1 pyutil/xor/__init__.py
  75. +6 −5 pyutil/xor/xor.py
  76. +11 −6 pyutil/zlibutil.py
  77. +0 −3 setup.cfg
  78. +46 −48 setup.py
View
@@ -1,7 +1,51 @@
-This licence also comes with the added permission that you may link this
-program with the OpenSSL library and distribute executables, as long as you
-follow the requirements of this licence in regard to all of the software in
-the executable aside from OpenSSL.
+This work also comes with the added permission that you may combine it
+with a work licensed under the OpenSSL license (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the OpenSSL
+license.
+
+This work also comes with the added permission that you may combine it
+with a work licensed under the Eclipse Public Licence (any version)
+and distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Eclipse
+Public Licence.
+
+This work also comes with the added permission that you may combine it
+with a work licensed under the Q Public Licence (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Q
+Public Licence.
+
+This work also comes with the added permission that you may combine it
+with a work licensed under the Apache Licence (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Apache
+Licence.
+
+This work also comes with the added permission that you may combine it
+with a work licensed under the GNU Lesser General Public License (any
+version) and distribute the resulting combined work, as long as you
+follow the requirements of the licences of this work in regard to all
+of the the resulting combined work aside from the work licensed under
+the GNU Lesser General Public License.
+
+This work also comes with the added permission that you may combine it
+with a work licensed under the Zope Public License (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Zope
+Public License.
+
+This work also comes with the added permission that you may combine it
+with a work licensed under the Python Software Foundation License (any
+version) and distribute the resulting combined work, as long as you
+follow the requirements of the licences of this work in regard to all
+of the the resulting combined work aside from the work licensed under
+the Python Software Foundation License.
GNU GENERAL PUBLIC LICENSE
View
@@ -0,0 +1,3 @@
+Permission is hereby granted to any person obtaining a copy of this work to
+deal in this work without restriction (including the rights to use, modify,
+distribute, sublicense, and/or sell copies).
View
@@ -8,15 +8,69 @@
<link rel="stylesheet" href="style.css" type="text/css">
- <meta name="description" content="an open source licence for commercial software">
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="description" content="a Free Software, Open Source licence">
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="keywords" content="Zooko">
</head>
<body>
+
+
<h1>Transitive Grace Period Public Licence ("TGPPL") v. 1.0</h1>
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the OpenSSL license (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the OpenSSL
+license.
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the Eclipse Public Licence (any version)
+and distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Eclipse
+Public Licence.
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the Q Public Licence (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Q
+Public Licence.
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the Apache Licence (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Apache
+Licence.
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the GNU Lesser General Public License (any
+version) and distribute the resulting combined work, as long as you
+follow the requirements of the licences of this work in regard to all
+of the the resulting combined work aside from the work licensed under
+the GNU Lesser General Public License.
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the Zope Public License (any version) and
+distribute the resulting combined work, as long as you follow the
+requirements of the licences of this work in regard to all of the the
+resulting combined work aside from the work licensed under the Zope
+Public License.
+
+<p>This work also comes with the added permission that you may combine it
+with a work licensed under the Python Software Foundation License (any
+version) and distribute the resulting combined work, as long as you
+follow the requirements of the licences of this work in regard to all
+of the the resulting combined work aside from the work licensed under
+the Python Software Foundation License.
+
+
+
<p>This Transitive Grace Period Public Licence (the "License") applies to any original work of authorship (the "Original Work") whose owner (the "Licensor") has placed the following licensing notice adjacent to the copyright notice for the Original Work:</p>
<p><b>Licensed under the Transitive Grace Period Public Licence version 1.0</b></p>
@@ -64,7 +118,7 @@
<li><b>Right to Use.</b> You may use the Original Work in all ways not otherwise restricted or conditioned by this License or by law, and Licensor promises not to interfere with or be responsible for such uses by You.</p>
- <li><b>Modification of This License.</b> This License is Copyright © 2007 Zooko Wilcox-O'Hearn. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Transitive Grace Period Public Licence" or "TGPPL" and you may not use those names in the name of your Modified License; and (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License.</p>
+ <li><b>Modification of This License.</b> This License is Copyright © 2007 Zooko Wilcox-O'Hearn. Permission is granted to copy, distribute, or communicate this License without modification. Nothing in this License permits You to modify this License as applied to the Original Work or to Derivative Works. However, You may modify the text of this License and copy, distribute or communicate your modified version (the "Modified License") and apply it to other original works of authorship subject to the following conditions: (i) You may not indicate in any way that your Modified License is the "Transitive Grace Period Public Licence" or "TGPPL" and you may not use those names in the name of your Modified License; and (ii) You must replace the notice specified in the first paragraph above with the notice "Licensed under <insert your license name here>" or with a notice of your own that is not confusingly similar to the notice in this License.</p>
</ol>
</td>
View
@@ -0,0 +1,7 @@
+2010-09-02
+
+ version_class:
+
+ * Copy in Tarek Ziadé's verlib to use as the comparison between Version instances.
+ * Reject 'rc' after the version number (you have to use 'c' instead).
+ * Add tests.
View
@@ -0,0 +1,183 @@
+pyutil -- a library of useful Python functions and classes
+==========================================================
+
+Many of these utilities (or their ancestors) were developed for the Mojo
+Nation, Mnet, Allmydata.com "Mountain View", Tahoe-LAFS, or SimpleGeo's
+products. (In the case where the code was developed for a for-profit company,
+the copyright holder donated the pyutil code to the public under these open
+source licences.)
+
+
+utilities
+=========
+
+current
+-------
+
+- mathutil.py_ - integer power, floor, ceil, and nearest multiples;
+ permute and fit slope
+- memutil.py_ - statistics and diagnostics for memory use and garbage
+ collection
+- platformutil.py_ - get platform including Linux distro; more accurate
+ and less noisy than platform.platform()
+- strutil.py_ - common prefix and suffix of two strings, and newline
+ processing
+- assertutil.py_ - test preconditions, postconditions, and assertions
+- benchutil.py_ - benchmark a function by running it repeatedly
+- fileutil.py_ - work with files and directories
+- iputil.py_ - query available local IPv4 addresses
+- jsonutil.py_ - wrapper around simplejson which converts decimal
+ inputs to Python Decimal objects instead of to Python floats
+- lineutil.py_ - remove extra whitespace from files
+- testutil.py_ - utilities for use in unit tests, especially in Twisted
+- time_format.py_ - date and time formatting operations
+- version_class.py_ - parse version strings into a Version Number
+ object
+
+out of shape
+------------
+
+I don't currently use these, but I still think they are possibly good
+ideas.
+
+- nummedobj.py_ - number objects in order of creation for consistent
+ debug output
+- observer.py_ - the Observer pattern
+- increasing.py_ - an implementation of a monotonically-increasing
+ timer; By the way a future, better implementation of this would use
+ CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW if it were available:
+ http://stackoverflow.com/questions/1205722/how-do-i-get-monotonic-time-durations-in-python/1205762#1205762
+- repeatable_random.py_ - Make the random and time modules
+ deterministic, so that executions can be reproducible.
+- strutil.py_ - string utilities
+- cache.py_ - multiple implementations of a least-recently-used
+ in-memory caching strategy, optimized for different sizes (note: I,
+ Zooko, nowadays prefer a random-replacement cache eviction strategy
+ over least-recently-used because the former has more consistent and
+ predictable behavior)
+- odict.py_ - ordered dictionary implementation: see PEP 372. Note:
+ there is now (as of Python 2.7) an ordered dict implementation in
+ the standard library, but I haven't checked if it is as good as this
+ one.
+- zlibutil.py_ - zlib decompression in limited memory
+
+deprecated
+----------
+
+I no longer use these and I don't recommend that you do either.
+
+- logutil.py_ - send log messages to Twisted logger if present, else
+ Python library logger
+- weakutil.py_ - allows a bound method's object to be GC'd
+- twistedutil.py_ - callLater_weakly, a variant of Twisted's callLater
+ which interacts more nicely with weakrefs
+- PickleSaver.py_ - make all or part of an object persistent, by saving
+ it to disk when it's garbage collected
+- humanreadable.py_ - an improved version of the builtin repr()
+ function
+- hashexpand.py_ - cryptographically strong pseudo-random number
+ generator based on SHA256
+- find_exe.py_ - try different paths in search of an executable
+- dictutil.py_ - several specialized dict extensions, as well as some
+ convenient functions for working with dicts
+- randutil.py_ - various ways to get random bytes
+- xor.py_ - xor two same-length strings together
+
+Thanks to Peter Westlake and Ravi Pinjala for help documenting what
+these do.
+
+
+
+download
+========
+
+http://pypi.python.org/pypi/pyutil
+
+issue tracker
+=============
+
+http://tahoe-lafs.org/trac/pyutil
+
+darcs repository
+================
+
+http://tahoe-lafs.org/source/pyutil/trunk
+
+(To get the latest source, run ``darcs get --lazy http://tahoe-lafs.org/source/pyutil/trunk``.)
+
+tests and benchmarks
+====================
+
+To run tests: ``python ./setup.py trial -s pyutil.test.current``.
+
+You can also run the tests with the standard pyunit test runner
+instead of trial, but a couple of the tests will fail due to the
+absence of Trial's "Skip This Test" feature. You can also run the
+tests of the out-of-shape and deprecated modules:
+
+``python ./setup.py trial -s pyutil.test.out_of_shape``
+
+``python ./setup.py trial -s pyutil.test.deprecated``
+
+Or of all modules:
+
+``python ./setup.py trial -s pyutil.test``
+
+Some modules have self-benchmarks provided. For example, to benchmark
+the cache module: ``python -OOu -c 'from pyutil.test import test_cache; test_cache.quick_bench()'``
+
+or for more complete and time-consuming results: ``python -OOu -c 'from pyutil.test import test_cache; test_cache.slow_bench()'``
+
+(The "-O" is important when benchmarking, since cache has extensive
+self-tests that are optimized out when -O is included.)
+
+
+LICENCE
+=======
+
+You may use this package under the GNU General Public License, version 2 or, at
+your option, any later version. You may use this package under the Transitive
+Grace Period Public Licence, version 1.0, or at your option, any later version.
+(You may choose to use this package under the terms of either licence, at your
+option.) You may use this package under the Simple Permissive Licence, version
+1 or, at your option, any later version. See the file COPYING.GPL_ for the
+terms of the GNU General Public License, version 2. See the file
+COPYING.TGPPL.html_ for the terms of the Transitive Grace Period Public Licence,
+version 1.0. See the file COPYING.SPL.txt_ for the terms of the Simple
+Permissive Licence, version 1.
+
+.. _COPYING.GPL: COPYING.GPL
+.. _COPYING.TGPPL.html: COPYING.TGPPL.html
+.. _COPYING.SPL.txt: COPYING.SPL.txt
+
+.. _mathutil.py: pyutil/mathutil.py
+.. _memutil.py: pyutil/memutil.py
+.. _platformutil.py: pyutil/platformutil.py
+.. _strutil.py: pyutil/strutil.py
+.. _assertutil.py: pyutil/assertutil.py
+.. _benchutil.py: pyutil/benchutil.py
+.. _fileutil.py: pyutil/fileutil.py
+.. _iputil.py: pyutil/iputil.py
+.. _jsonutil.py: pyutil/jsonutil.py
+.. _lineutil.py: pyutil/lineutil.py
+.. _testutil.py: pyutil/testutil.py
+.. _time_format.py: pyutil/time_format.py
+.. _version_class.py: pyutil/version_class.py
+.. _zlibutil.py: pyutil/zlibutil.py
+.. _nummedobj.py: pyutil/nummedobj.py
+.. _observer.py: pyutil/observer.py
+.. _increasing.py: pyutil/increasing.py
+.. _repeatable_random.py: pyutil/repeatable_random.py
+.. _strutil.py: pyutil/strutil.py
+.. _cache.py: pyutil/cache.py
+.. _odict.py: pyutil/odict.py
+.. _logutil.py: pyutil/logutil.py
+.. _weakutil.py: pyutil/weakutil.py
+.. _twistedutil.py: pyutil/twistedutil.py
+.. _PickleSaver.py: pyutil/PickleSaver.py
+.. _humanreadable.py: pyutil/humanreadable.py
+.. _hashexpand.py: pyutil/hashexpand.py
+.. _find_exe.py: pyutil/find_exe.py
+.. _dictutil.py: pyutil/dictutil.py
+.. _randutil.py: pyutil/randutil.py
+.. _xor.py: pyutil/xor/xor.py
View
@@ -1,43 +0,0 @@
-pyutil -- a library of useful Python functions and classes
-
-Many of these utilities (or their ancestors) were developed for the Mojo Nation
-open source project, its open source successor project Mnet, its proprietary
-successor project Allmydata.com "Mountain View", or its open source successor
-project Allmydata.org "Tahoe". (In the case where the code was developed for a
-for-profit company, the copyright holder donated the pyutil code to the public
-under these open source licences.)
-
-trac:
-
-http://allmydata.org/trac/pyutil
-
-darcs repository:
-
-http://allmydata.org/source/pyutil/trunk
-
-To run tests, do
-
-python ./setup.py test
-
-Some modules have self-benchmarks provided. For example, to benchmark
-the cache module, do
-
-python -OOu -c 'from pyutil.test import test_cache; test_cache.quick_bench()'
-
-or for more complete and time-consuming results:
-
-python -OOu -c 'from pyutil.test import test_cache; test_cache.slow_bench()'
-
-(The "-O" is important when benchmarking, since cache has extensive
-self-tests that are optimized out when -O is included.)
-
-
-LICENCE
-
-You may use this package under the GNU General Public License, version 2 or, at
-your option, any later version. You may use this package under the Transitive
-Grace Period Public Licence, version 1.0, or at your option, any later version.
-(You may choose to use this package under the terms of either licence, at your
-option.) See the file COPYING.GPL for the terms of the GNU General Public
-License, version 2. See the file COPYING.TGPPL.html for the terms of the
-Transitive Grace Period Public Licence, version 1.0.
Oops, something went wrong.

0 comments on commit 6324ba7

Please sign in to comment.