summaryrefslogtreecommitdiffstats
path: root/Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py
diff options
context:
space:
mode:
authoryum <yum.food.vr@gmail.com>2023-01-01 21:05:27 -0800
committeryum <yum.food.vr@gmail.com>2023-01-01 21:44:45 -0800
commite25bdba3a3a53b09be5269d8b065c13b73ab55c3 (patch)
tree1d1dc1d94cde92c2f4f8ce86017395054787515d /Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py
parent0d408cc812a094a708edbe4baf536e928731cfc3 (diff)
Embed git in package
package.ps1 fetches PortableGit and embeds it in the package. This eliminates all but one runtime dependency (MSVC++ Redistributable). * Move Python into a new FOSS folder.
Diffstat (limited to 'Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py')
-rw-r--r--Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py59
1 files changed, 0 insertions, 59 deletions
diff --git a/Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py b/Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py
deleted file mode 100644
index 6f0c2a8..0000000
--- a/Python/Dependencies/future-0.18.2/src/future/builtins/new_min_max.py
+++ /dev/null
@@ -1,59 +0,0 @@
-import itertools
-
-from future import utils
-if utils.PY2:
- from __builtin__ import max as _builtin_max, min as _builtin_min
-else:
- from builtins import max as _builtin_max, min as _builtin_min
-
-_SENTINEL = object()
-
-
-def newmin(*args, **kwargs):
- return new_min_max(_builtin_min, *args, **kwargs)
-
-
-def newmax(*args, **kwargs):
- return new_min_max(_builtin_max, *args, **kwargs)
-
-
-def new_min_max(_builtin_func, *args, **kwargs):
- """
- To support the argument "default" introduced in python 3.4 for min and max
- :param _builtin_func: builtin min or builtin max
- :param args:
- :param kwargs:
- :return: returns the min or max based on the arguments passed
- """
-
- for key, _ in kwargs.items():
- if key not in set(['key', 'default']):
- raise TypeError('Illegal argument %s', key)
-
- if len(args) == 0:
- raise TypeError
-
- if len(args) != 1 and kwargs.get('default', _SENTINEL) is not _SENTINEL:
- raise TypeError
-
- if len(args) == 1:
- iterator = iter(args[0])
- try:
- first = next(iterator)
- except StopIteration:
- if kwargs.get('default', _SENTINEL) is not _SENTINEL:
- return kwargs.get('default')
- else:
- raise ValueError('{}() arg is an empty sequence'.format(_builtin_func.__name__))
- else:
- iterator = itertools.chain([first], iterator)
- if kwargs.get('key') is not None:
- return _builtin_func(iterator, key=kwargs.get('key'))
- else:
- return _builtin_func(iterator)
-
- if len(args) > 1:
- if kwargs.get('key') is not None:
- return _builtin_func(args, key=kwargs.get('key'))
- else:
- return _builtin_func(args)