__init__.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. """
  2. Alternate namespace for cytoolz such that all functions are curried
  3. Currying provides implicit partial evaluation of all functions
  4. Example:
  5. Get usually requires two arguments, an index and a collection
  6. >>> from cytoolz.curried import get
  7. >>> get(0, ('a', 'b'))
  8. 'a'
  9. When we use it in higher order functions we often want to pass a partially
  10. evaluated form
  11. >>> data = [(1, 2), (11, 22), (111, 222)]
  12. >>> list(map(lambda seq: get(0, seq), data))
  13. [1, 11, 111]
  14. The curried version allows simple expression of partial evaluation
  15. >>> list(map(get(0), data))
  16. [1, 11, 111]
  17. See Also:
  18. cytoolz.functoolz.curry
  19. """
  20. import cytoolz
  21. from . import operator
  22. from cytoolz import (
  23. apply,
  24. comp,
  25. complement,
  26. compose,
  27. compose_left,
  28. concat,
  29. concatv,
  30. count,
  31. curry,
  32. diff,
  33. first,
  34. flip,
  35. frequencies,
  36. identity,
  37. interleave,
  38. isdistinct,
  39. isiterable,
  40. juxt,
  41. last,
  42. memoize,
  43. merge_sorted,
  44. peek,
  45. pipe,
  46. second,
  47. thread_first,
  48. thread_last,
  49. )
  50. from .exceptions import merge, merge_with
  51. accumulate = cytoolz.curry(cytoolz.accumulate)
  52. assoc = cytoolz.curry(cytoolz.assoc)
  53. assoc_in = cytoolz.curry(cytoolz.assoc_in)
  54. cons = cytoolz.curry(cytoolz.cons)
  55. countby = cytoolz.curry(cytoolz.countby)
  56. dissoc = cytoolz.curry(cytoolz.dissoc)
  57. do = cytoolz.curry(cytoolz.do)
  58. drop = cytoolz.curry(cytoolz.drop)
  59. excepts = cytoolz.curry(cytoolz.excepts)
  60. filter = cytoolz.curry(cytoolz.filter)
  61. get = cytoolz.curry(cytoolz.get)
  62. get_in = cytoolz.curry(cytoolz.get_in)
  63. groupby = cytoolz.curry(cytoolz.groupby)
  64. interpose = cytoolz.curry(cytoolz.interpose)
  65. itemfilter = cytoolz.curry(cytoolz.itemfilter)
  66. itemmap = cytoolz.curry(cytoolz.itemmap)
  67. iterate = cytoolz.curry(cytoolz.iterate)
  68. join = cytoolz.curry(cytoolz.join)
  69. keyfilter = cytoolz.curry(cytoolz.keyfilter)
  70. keymap = cytoolz.curry(cytoolz.keymap)
  71. map = cytoolz.curry(cytoolz.map)
  72. mapcat = cytoolz.curry(cytoolz.mapcat)
  73. nth = cytoolz.curry(cytoolz.nth)
  74. partial = cytoolz.curry(cytoolz.partial)
  75. partition = cytoolz.curry(cytoolz.partition)
  76. partition_all = cytoolz.curry(cytoolz.partition_all)
  77. partitionby = cytoolz.curry(cytoolz.partitionby)
  78. peekn = cytoolz.curry(cytoolz.peekn)
  79. pluck = cytoolz.curry(cytoolz.pluck)
  80. random_sample = cytoolz.curry(cytoolz.random_sample)
  81. reduce = cytoolz.curry(cytoolz.reduce)
  82. reduceby = cytoolz.curry(cytoolz.reduceby)
  83. remove = cytoolz.curry(cytoolz.remove)
  84. sliding_window = cytoolz.curry(cytoolz.sliding_window)
  85. sorted = cytoolz.curry(cytoolz.sorted)
  86. tail = cytoolz.curry(cytoolz.tail)
  87. take = cytoolz.curry(cytoolz.take)
  88. take_nth = cytoolz.curry(cytoolz.take_nth)
  89. topk = cytoolz.curry(cytoolz.topk)
  90. unique = cytoolz.curry(cytoolz.unique)
  91. update_in = cytoolz.curry(cytoolz.update_in)
  92. valfilter = cytoolz.curry(cytoolz.valfilter)
  93. valmap = cytoolz.curry(cytoolz.valmap)
  94. del exceptions
  95. del cytoolz