toolz.py 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. try:
  2. from cytoolz import (
  3. accumulate,
  4. assoc,
  5. assoc_in,
  6. comp,
  7. complement,
  8. compose,
  9. concat,
  10. concatv,
  11. cons,
  12. count,
  13. countby,
  14. curried,
  15. curry,
  16. dicttoolz,
  17. diff,
  18. dissoc,
  19. do,
  20. drop,
  21. excepts,
  22. filter,
  23. first,
  24. flip,
  25. frequencies,
  26. functoolz,
  27. get,
  28. get_in,
  29. groupby,
  30. identity,
  31. interleave,
  32. interpose,
  33. isdistinct,
  34. isiterable,
  35. itemfilter,
  36. itemmap,
  37. iterate,
  38. itertoolz,
  39. join,
  40. juxt,
  41. keyfilter,
  42. keymap,
  43. last,
  44. map,
  45. mapcat,
  46. memoize,
  47. merge,
  48. merge_sorted,
  49. merge_with,
  50. nth,
  51. partial,
  52. partition,
  53. partition_all,
  54. partitionby,
  55. peek,
  56. pipe,
  57. pluck,
  58. random_sample,
  59. recipes,
  60. reduce,
  61. reduceby,
  62. remove,
  63. second,
  64. sliding_window,
  65. sorted,
  66. tail,
  67. take,
  68. take_nth,
  69. thread_first,
  70. thread_last,
  71. topk,
  72. unique,
  73. update_in,
  74. utils,
  75. valfilter,
  76. valmap,
  77. )
  78. except ImportError:
  79. from toolz import ( # noqa: F401
  80. accumulate,
  81. assoc,
  82. assoc_in,
  83. comp,
  84. complement,
  85. compose,
  86. concat,
  87. concatv,
  88. cons,
  89. count,
  90. countby,
  91. curried,
  92. curry,
  93. dicttoolz,
  94. diff,
  95. dissoc,
  96. do,
  97. drop,
  98. excepts,
  99. filter,
  100. first,
  101. flip,
  102. frequencies,
  103. functoolz,
  104. get,
  105. get_in,
  106. groupby,
  107. identity,
  108. interleave,
  109. interpose,
  110. isdistinct,
  111. isiterable,
  112. itemfilter,
  113. itemmap,
  114. iterate,
  115. itertoolz,
  116. join,
  117. juxt,
  118. keyfilter,
  119. keymap,
  120. last,
  121. map,
  122. mapcat,
  123. memoize,
  124. merge,
  125. merge_sorted,
  126. merge_with,
  127. nth,
  128. partial,
  129. partition,
  130. partition_all,
  131. partitionby,
  132. peek,
  133. pipe,
  134. pluck,
  135. random_sample,
  136. recipes,
  137. reduce,
  138. reduceby,
  139. remove,
  140. second,
  141. sliding_window,
  142. sorted,
  143. tail,
  144. take,
  145. take_nth,
  146. thread_first,
  147. thread_last,
  148. topk,
  149. unique,
  150. update_in,
  151. utils,
  152. valfilter,
  153. valmap,
  154. )