summaryrefslogtreecommitdiffstats
path: root/venv/lib/python3.9/site-packages/toolz/curried
diff options
context:
space:
mode:
authornoptuno <repollo.marrero@gmail.com>2023-04-28 02:29:30 +0200
committernoptuno <repollo.marrero@gmail.com>2023-04-28 02:29:30 +0200
commit355dee533bb34a571b9367820a63cccb668cf866 (patch)
tree838af886b4fec07320aeb10f0d1e74ba79e79b5c /venv/lib/python3.9/site-packages/toolz/curried
parentadded pyproject.toml file (diff)
downloadgpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar
gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.gz
gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.bz2
gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.lz
gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.xz
gpt4free-355dee533bb34a571b9367820a63cccb668cf866.tar.zst
gpt4free-355dee533bb34a571b9367820a63cccb668cf866.zip
Diffstat (limited to 'venv/lib/python3.9/site-packages/toolz/curried')
-rw-r--r--venv/lib/python3.9/site-packages/toolz/curried/__init__.py103
-rw-r--r--venv/lib/python3.9/site-packages/toolz/curried/exceptions.py18
-rw-r--r--venv/lib/python3.9/site-packages/toolz/curried/operator.py22
3 files changed, 143 insertions, 0 deletions
diff --git a/venv/lib/python3.9/site-packages/toolz/curried/__init__.py b/venv/lib/python3.9/site-packages/toolz/curried/__init__.py
new file mode 100644
index 00000000..356eddbd
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/toolz/curried/__init__.py
@@ -0,0 +1,103 @@
+"""
+Alternate namespace for toolz such that all functions are curried
+
+Currying provides implicit partial evaluation of all functions
+
+Example:
+
+ Get usually requires two arguments, an index and a collection
+ >>> from toolz.curried import get
+ >>> get(0, ('a', 'b'))
+ 'a'
+
+ When we use it in higher order functions we often want to pass a partially
+ evaluated form
+ >>> data = [(1, 2), (11, 22), (111, 222)]
+ >>> list(map(lambda seq: get(0, seq), data))
+ [1, 11, 111]
+
+ The curried version allows simple expression of partial evaluation
+ >>> list(map(get(0), data))
+ [1, 11, 111]
+
+See Also:
+ toolz.functoolz.curry
+"""
+import toolz
+from . import operator
+from toolz import (
+ apply,
+ comp,
+ complement,
+ compose,
+ compose_left,
+ concat,
+ concatv,
+ count,
+ curry,
+ diff,
+ first,
+ flip,
+ frequencies,
+ identity,
+ interleave,
+ isdistinct,
+ isiterable,
+ juxt,
+ last,
+ memoize,
+ merge_sorted,
+ peek,
+ pipe,
+ second,
+ thread_first,
+ thread_last,
+)
+from .exceptions import merge, merge_with
+
+accumulate = toolz.curry(toolz.accumulate)
+assoc = toolz.curry(toolz.assoc)
+assoc_in = toolz.curry(toolz.assoc_in)
+cons = toolz.curry(toolz.cons)
+countby = toolz.curry(toolz.countby)
+dissoc = toolz.curry(toolz.dissoc)
+do = toolz.curry(toolz.do)
+drop = toolz.curry(toolz.drop)
+excepts = toolz.curry(toolz.excepts)
+filter = toolz.curry(toolz.filter)
+get = toolz.curry(toolz.get)
+get_in = toolz.curry(toolz.get_in)
+groupby = toolz.curry(toolz.groupby)
+interpose = toolz.curry(toolz.interpose)
+itemfilter = toolz.curry(toolz.itemfilter)
+itemmap = toolz.curry(toolz.itemmap)
+iterate = toolz.curry(toolz.iterate)
+join = toolz.curry(toolz.join)
+keyfilter = toolz.curry(toolz.keyfilter)
+keymap = toolz.curry(toolz.keymap)
+map = toolz.curry(toolz.map)
+mapcat = toolz.curry(toolz.mapcat)
+nth = toolz.curry(toolz.nth)
+partial = toolz.curry(toolz.partial)
+partition = toolz.curry(toolz.partition)
+partition_all = toolz.curry(toolz.partition_all)
+partitionby = toolz.curry(toolz.partitionby)
+peekn = toolz.curry(toolz.peekn)
+pluck = toolz.curry(toolz.pluck)
+random_sample = toolz.curry(toolz.random_sample)
+reduce = toolz.curry(toolz.reduce)
+reduceby = toolz.curry(toolz.reduceby)
+remove = toolz.curry(toolz.remove)
+sliding_window = toolz.curry(toolz.sliding_window)
+sorted = toolz.curry(toolz.sorted)
+tail = toolz.curry(toolz.tail)
+take = toolz.curry(toolz.take)
+take_nth = toolz.curry(toolz.take_nth)
+topk = toolz.curry(toolz.topk)
+unique = toolz.curry(toolz.unique)
+update_in = toolz.curry(toolz.update_in)
+valfilter = toolz.curry(toolz.valfilter)
+valmap = toolz.curry(toolz.valmap)
+
+del exceptions
+del toolz
diff --git a/venv/lib/python3.9/site-packages/toolz/curried/exceptions.py b/venv/lib/python3.9/site-packages/toolz/curried/exceptions.py
new file mode 100644
index 00000000..75a52bbb
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/toolz/curried/exceptions.py
@@ -0,0 +1,18 @@
+import toolz
+
+
+__all__ = ['merge_with', 'merge']
+
+
+@toolz.curry
+def merge_with(func, d, *dicts, **kwargs):
+ return toolz.merge_with(func, d, *dicts, **kwargs)
+
+
+@toolz.curry
+def merge(d, *dicts, **kwargs):
+ return toolz.merge(d, *dicts, **kwargs)
+
+
+merge_with.__doc__ = toolz.merge_with.__doc__
+merge.__doc__ = toolz.merge.__doc__
diff --git a/venv/lib/python3.9/site-packages/toolz/curried/operator.py b/venv/lib/python3.9/site-packages/toolz/curried/operator.py
new file mode 100644
index 00000000..35979a68
--- /dev/null
+++ b/venv/lib/python3.9/site-packages/toolz/curried/operator.py
@@ -0,0 +1,22 @@
+from __future__ import absolute_import
+
+import operator
+
+from toolz.functoolz import curry
+
+
+# Tests will catch if/when this needs updated
+IGNORE = {
+ "__abs__", "__index__", "__inv__", "__invert__", "__neg__", "__not__",
+ "__pos__", "_abs", "abs", "attrgetter", "index", "inv", "invert",
+ "itemgetter", "neg", "not_", "pos", "truth"
+}
+locals().update(
+ {name: f if name in IGNORE else curry(f)
+ for name, f in vars(operator).items() if callable(f)}
+)
+
+# Clean up the namespace.
+del IGNORE
+del curry
+del operator