METADATA 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. Metadata-Version: 2.0
  2. Name: more-itertools
  3. Version: 4.1.0
  4. Summary: More routines for operating on iterables, beyond itertools
  5. Home-page: https://github.com/erikrose/more-itertools
  6. Author: Erik Rose
  7. Author-email: erikrose@grinchcentral.com
  8. License: MIT
  9. Description-Content-Type: UNKNOWN
  10. Keywords: itertools,iterator,iteration,filter,peek,peekable,collate,chunk,chunked
  11. Platform: UNKNOWN
  12. Classifier: Development Status :: 5 - Production/Stable
  13. Classifier: Intended Audience :: Developers
  14. Classifier: Natural Language :: English
  15. Classifier: License :: OSI Approved :: MIT License
  16. Classifier: Programming Language :: Python :: 2
  17. Classifier: Programming Language :: Python :: 2.7
  18. Classifier: Programming Language :: Python :: 3
  19. Classifier: Programming Language :: Python :: 3.2
  20. Classifier: Programming Language :: Python :: 3.3
  21. Classifier: Programming Language :: Python :: 3.4
  22. Classifier: Programming Language :: Python :: 3.5
  23. Classifier: Topic :: Software Development :: Libraries
  24. Requires-Dist: six (<2.0.0,>=1.0.0)
  25. ==============
  26. More Itertools
  27. ==============
  28. .. image:: https://coveralls.io/repos/github/erikrose/more-itertools/badge.svg?branch=master
  29. :target: https://coveralls.io/github/erikrose/more-itertools?branch=master
  30. Python's ``itertools`` library is a gem - you can compose elegant solutions
  31. for a variety of problems with the functions it provides. In ``more-itertools``
  32. we collect additional building blocks, recipes, and routines for working with
  33. Python iterables.
  34. Getting started
  35. ===============
  36. To get started, install the library with `pip <https://pip.pypa.io/en/stable/>`_:
  37. .. code-block:: shell
  38. pip install more-itertools
  39. The recipes from the `itertools docs <https://docs.python.org/3/library/itertools.html#itertools-recipes>`_
  40. are included in the top-level package:
  41. .. code-block:: python
  42. >>> from more_itertools import flatten
  43. >>> iterable = [(0, 1), (2, 3)]
  44. >>> list(flatten(iterable))
  45. [0, 1, 2, 3]
  46. Several new recipes are available as well:
  47. .. code-block:: python
  48. >>> from more_itertools import chunked
  49. >>> iterable = [0, 1, 2, 3, 4, 5, 6, 7, 8]
  50. >>> list(chunked(iterable, 3))
  51. [[0, 1, 2], [3, 4, 5], [6, 7, 8]]
  52. >>> from more_itertools import spy
  53. >>> iterable = (x * x for x in range(1, 6))
  54. >>> head, iterable = spy(iterable, n=3)
  55. >>> list(head)
  56. [1, 4, 9]
  57. >>> list(iterable)
  58. [1, 4, 9, 16, 25]
  59. For the full listing of functions, see the `API documentation <https://more-itertools.readthedocs.io/en/latest/api.html>`_.
  60. Development
  61. ===========
  62. ``more-itertools`` is maintained by `@erikrose <https://github.com/erikrose>`_
  63. and `@bbayles <https://github.com/bbayles>`_, with help from `many others <https://github.com/erikrose/more-itertools/graphs/contributors>`_.
  64. If you have a problem or suggestion, please file a bug or pull request in this
  65. repository. Thanks for contributing!
  66. Version History
  67. ===============
  68. 4.1.0
  69. -----
  70. * New itertools:
  71. * split_at (thanks to michael-celani)
  72. * circular_shifts (thanks to hiqua)
  73. * make_decorator - see the blog post `Yo, I heard you like decorators <https://sites.google.com/site/bbayles/index/decorator_factory>`_
  74. for a tour (thanks to pylang)
  75. * always_reversible (thanks to michael-celani)
  76. * nth_combination (from the `Python 3.7 docs <https://docs.python.org/3.7/library/itertools.html#itertools-recipes>`_)
  77. * Improvements to existing itertools:
  78. * seekable now has an ``elements`` method to return cached items.
  79. * The performance tradeoffs between roundrobin and
  80. interleave_longest are now documented (thanks michael-celani,
  81. pylang, and MSeifert04)
  82. 4.0.1
  83. -----
  84. * No code changes - this release fixes how the docs display on PyPI.
  85. 4.0.0
  86. -----
  87. * New itertools:
  88. * consecutive_groups (Based on the example in the `Python 2.4 docs <https://docs.python.org/release/2.4.4/lib/itertools-example.html>`_)
  89. * seekable (If you're looking for how to "reset" an iterator,
  90. you're in luck!)
  91. * exactly_n (thanks to michael-celani)
  92. * run_length.encode and run_length.decode
  93. * difference
  94. * Improvements to existing itertools:
  95. * The number of items between filler elements in intersperse can
  96. now be specified (thanks to pylang)
  97. * distinct_permutations and peekable got some minor
  98. adjustments (thanks to MSeifert04)
  99. * always_iterable now returns an iterator object. It also now
  100. allows different types to be considered iterable (thanks to jaraco)
  101. * bucket can now limit the keys it stores in memory
  102. * one now allows for custom exceptions (thanks to kalekundert)
  103. * Other changes:
  104. * A few typos were fixed (thanks to EdwardBetts)
  105. * All tests can now be run with ``python setup.py test``
  106. The major version update is due to the change in the return value of always_iterable.
  107. It now always returns iterator objects:
  108. .. code-block:: python
  109. >>> from more_itertools import always_iterable
  110. # Non-iterable objects are wrapped with iter(tuple(obj))
  111. >>> always_iterable(12345)
  112. <tuple_iterator object at 0x7fb24c9488d0>
  113. >>> list(always_iterable(12345))
  114. [12345]
  115. # Iterable objects are wrapped with iter()
  116. >>> always_iterable([1, 2, 3, 4, 5])
  117. <list_iterator object at 0x7fb24c948c50>
  118. 3.2.0
  119. -----
  120. * New itertools:
  121. * lstrip, rstrip, and strip
  122. (thanks to MSeifert04 and pylang)
  123. * islice_extended
  124. * Improvements to existing itertools:
  125. * Some bugs with slicing peekable-wrapped iterables were fixed
  126. 3.1.0
  127. -----
  128. * New itertools:
  129. * numeric_range (Thanks to BebeSparkelSparkel and MSeifert04)
  130. * count_cycle (Thanks to BebeSparkelSparkel)
  131. * locate (Thanks to pylang and MSeifert04)
  132. * Improvements to existing itertools:
  133. * A few itertools are now slightly faster due to some function
  134. optimizations. (Thanks to MSeifert04)
  135. * The docs have been substantially revised with installation notes,
  136. categories for library functions, links, and more. (Thanks to pylang)
  137. 3.0.0
  138. -----
  139. * Removed itertools:
  140. * ``context`` has been removed due to a design flaw - see below for
  141. replacement options. (thanks to NeilGirdhar)
  142. * Improvements to existing itertools:
  143. * ``side_effect`` now supports ``before`` and ``after`` keyword
  144. arguments. (Thanks to yardsale8)
  145. * PyPy and PyPy3 are now supported.
  146. The major version change is due to the removal of the ``context`` function.
  147. Replace it with standard ``with`` statement context management:
  148. .. code-block:: python
  149. # Don't use context() anymore
  150. file_obj = StringIO()
  151. consume(print(x, file=f) for f in context(file_obj) for x in u'123')
  152. # Use a with statement instead
  153. file_obj = StringIO()
  154. with file_obj as f:
  155. consume(print(x, file=f) for x in u'123')
  156. 2.6.0
  157. -----
  158. * New itertools:
  159. * ``adjacent`` and ``groupby_transform`` (Thanks to diazona)
  160. * ``always_iterable`` (Thanks to jaraco)
  161. * (Removed in 3.0.0) ``context`` (Thanks to yardsale8)
  162. * ``divide`` (Thanks to mozbhearsum)
  163. * Improvements to existing itertools:
  164. * ``ilen`` is now slightly faster. (Thanks to wbolster)
  165. * ``peekable`` can now prepend items to an iterable. (Thanks to diazona)
  166. 2.5.0
  167. -----
  168. * New itertools:
  169. * ``distribute`` (Thanks to mozbhearsum and coady)
  170. * ``sort_together`` (Thanks to clintval)
  171. * ``stagger`` and ``zip_offset`` (Thanks to joshbode)
  172. * ``padded``
  173. * Improvements to existing itertools:
  174. * ``peekable`` now handles negative indexes and slices with negative
  175. components properly.
  176. * ``intersperse`` is now slightly faster. (Thanks to pylang)
  177. * ``windowed`` now accepts a ``step`` keyword argument.
  178. (Thanks to pylang)
  179. * Python 3.6 is now supported.
  180. 2.4.1
  181. -----
  182. * Move docs 100% to readthedocs.io.
  183. 2.4
  184. -----
  185. * New itertools:
  186. * ``accumulate``, ``all_equal``, ``first_true``, ``partition``, and
  187. ``tail`` from the itertools documentation.
  188. * ``bucket`` (Thanks to Rosuav and cvrebert)
  189. * ``collapse`` (Thanks to abarnet)
  190. * ``interleave`` and ``interleave_longest`` (Thanks to abarnet)
  191. * ``side_effect`` (Thanks to nvie)
  192. * ``sliced`` (Thanks to j4mie and coady)
  193. * ``split_before`` and ``split_after`` (Thanks to astronouth7303)
  194. * ``spy`` (Thanks to themiurgo and mathieulongtin)
  195. * Improvements to existing itertools:
  196. * ``chunked`` is now simpler and more friendly to garbage collection.
  197. (Contributed by coady, with thanks to piskvorky)
  198. * ``collate`` now delegates to ``heapq.merge`` when possible.
  199. (Thanks to kmike and julianpistorius)
  200. * ``peekable``-wrapped iterables are now indexable and sliceable.
  201. Iterating through ``peekable``-wrapped iterables is also faster.
  202. * ``one`` and ``unique_to_each`` have been simplified.
  203. (Thanks to coady)
  204. 2.3
  205. -----
  206. * Added ``one`` from ``jaraco.util.itertools``. (Thanks, jaraco!)
  207. * Added ``distinct_permutations`` and ``unique_to_each``. (Contributed by
  208. bbayles)
  209. * Added ``windowed``. (Contributed by bbayles, with thanks to buchanae,
  210. jaraco, and abarnert)
  211. * Simplified the implementation of ``chunked``. (Thanks, nvie!)
  212. * Python 3.5 is now supported. Python 2.6 is no longer supported.
  213. * Python 3 is now supported directly; there is no 2to3 step.
  214. 2.2
  215. -----
  216. * Added ``iterate`` and ``with_iter``. (Thanks, abarnert!)
  217. 2.1
  218. -----
  219. * Added (tested!) implementations of the recipes from the itertools
  220. documentation. (Thanks, Chris Lonnen!)
  221. * Added ``ilen``. (Thanks for the inspiration, Matt Basta!)
  222. 2.0
  223. -----
  224. * ``chunked`` now returns lists rather than tuples. After all, they're
  225. homogeneous. This slightly backward-incompatible change is the reason for
  226. the major version bump.
  227. * Added ``@consumer``.
  228. * Improved test machinery.
  229. 1.1
  230. -----
  231. * Added ``first`` function.
  232. * Added Python 3 support.
  233. * Added a default arg to ``peekable.peek()``.
  234. * Noted how to easily test whether a peekable iterator is exhausted.
  235. * Rewrote documentation.
  236. 1.0
  237. -----
  238. * Initial release, with ``collate``, ``peekable``, and ``chunked``. Could
  239. really use better docs.