[ Avaa Bypassed ]




Upload:

Command:

hmhc3928@18.226.214.1: ~ $


�.W�v�@s�dZddlmZmZmZddlZddlZddlZddlZyddl	m
Z
Wn"ek
r�ddlm
Z
YnXddl
mZdddd	gZeej�Zeej�ZeeejfZdd
d�Zdd
�Zdd	�ZGdd�de�ZGdd�de�ZGdd�de�Zeddd�Zeddd�Z eddd�Z!eddd�Z"eddd�Z#Gdd�de�Z$Gd d�de�Z%Gd!d�de�Z&dS)"z�Function signature objects for callables

Back port of Python 3.3's function signature tools from the inspect module,
modified to be compatible with Python 2.6, 2.7 and 3.3+.
�)�absolute_import�division�print_functionN)�OrderedDict)�__version__�BoundArguments�	Parameter�	Signature�	signaturecCsJt|t�r@|jdd|fkr.|jS|jd|jSt|�S)N�builtins�__builtin__�.)�
isinstance�type�
__module__�__name__�repr)�
annotationZbase_module�r�/__init__.py�formatannotations
rcGsvyF|tkrdSt||�}x |D]}t|||�}q)WWntk
r^dSYnXt|t�sr|SdS)N)r�getattr�AttributeErrorr�_NonUserDefinedCallables)�clsZmethod_name�nested�meth�namerrr�_get_user_defined_method's

	rc$Cst|�s!tdj|���t|tj�r�t|j�}|jdkrU|St	|j
j��}|s�|djt
tfkr�td��|dj}|ttfkr�|dd�}n|tk	r�td��|jd|�Sy
|j}Wntk
rYnX|dk	r"|Sy
|j}Wntk
rCYnXt|�St|tj�rmtj|�St|tj�r�t|j�}t|j
j��}|jp�f}|j p�i}y|j!||�}Wn@tk
r}	z dj|�}
t|
��WYdd}	~	XnXx~|j"j�D]m\}}||}
||krk|
jd	|d
d�||<q*|
jt
tfkr*|
j#r*|j$|�q*W|jd|j��Sd}t|t%�rJt&t%|�d�}|dk	r�t|�}q�t&|d
�}|dk	r t|�}q�t&|d�}|dk	r�t|�}n?t|t'�s�t&t%|�dd�}|dk	r�t|�}|dk	r�|jdt	|j
j��dd��St|tj(�r�dj|�}
t|
��tdj|���dS)z/Get a signature object for the passed callable.z{0!r} is not a callable objectNrzinvalid method signature�zinvalid argument type�
parametersz,partial object {0!r} has incorrect arguments�default�_partial_kwargT�__call__�__new__�__init__Zim_funcz-no signature found for builtin function {0!r}z,callable {0!r} is not supported by signature))�callable�	TypeError�formatr�types�
MethodTyper
�__func__�__self__�tupler �values�kind�_VAR_KEYWORD�
_KEYWORD_ONLY�
ValueError�_POSITIONAL_OR_KEYWORD�_POSITIONAL_ONLY�_VAR_POSITIONAL�replaceZ
__signature__r�__wrapped__�FunctionTyper	�
from_function�	functools�partial�funcr�items�args�keywords�bind_partial�	argumentsr"�poprrr�BuiltinFunctionType)�obj�sig�paramsr/�wrappedZ
new_paramsZpartial_argsZpartial_keywordsZba�ex�msgZarg_nameZ	arg_value�param�call�newZinitrrrr
7s� 








)c@seZdZdZdS)�_voidz0A private marker - used in Parameter & SignatureN)rr�__qualname__�__doc__rrrrrM�srMc@seZdZdS)�_emptyN)rrrNrrrrrP�srPc@s4eZdZdd�Zdd�Zdd�ZdS)�_ParameterKindcOs#tj||�}|d|_|S)Nr)�intr$�_name)�selfr>�kwargsrDrrrr$�s
z_ParameterKind.__new__cCs|jS)N)rS)rTrrr�__str__�sz_ParameterKind.__str__cCsdj|j�S)Nz<_ParameterKind: {0!r}>)r(rS)rTrrr�__repr__�sz_ParameterKind.__repr__N)rrrNr$rVrWrrrrrQ�srQr�POSITIONAL_ONLYr�POSITIONAL_OR_KEYWORD��VAR_POSITIONAL��KEYWORD_ONLY��VAR_KEYWORDc@s�eZdZdZdZeZeZe	Z
eZe
ZeZeeddd	�Zed
d��Zedd
��Zedd��Zedd��Zeeeeedd�Zdd�Zdd�Zdd�Zdd�Zdd�ZdS) ra�Represents a parameter in a function signature.

    Has the following public attributes:

    * name : str
        The name of the parameter as a string.
    * default : object
        The default value for the parameter if specified.  If the
        parameter has no default value, this attribute is not set.
    * annotation
        The annotation for the parameter if specified.  If the
        parameter has no annotation, this attribute is not set.
    * kind : str
        Describes how argument values are bound to the parameter.
        Possible values: `Parameter.POSITIONAL_ONLY`,
        `Parameter.POSITIONAL_OR_KEYWORD`, `Parameter.VAR_POSITIONAL`,
        `Parameter.KEYWORD_ONLY`, `Parameter.VAR_KEYWORD`.
    rS�_kind�_default�_annotationr"FcCs
|tttttfkr'td��||_|tk	ri|ttfkridj|�}t|��||_	||_
|dkr�|tkr�td��||_nUt|�}|tkr�t
jd|t
j�r�dj|�}t|��||_||_dS)Nz,invalid value for 'Parameter.kind' attributez){0} parameters cannot have default valuesz<None is not a valid name for a non-positional-only parameterz
[a-z_]\w*$z#{0!r} is not a valid parameter name)r4r3r5r1r0r2r`rPr(rarbrS�str�re�match�Ir")rTrr/r!rr"rIrrrr%�s(				%	zParameter.__init__cCs|jS)N)rS)rTrrrrszParameter.namecCs|jS)N)ra)rTrrrr!szParameter.defaultcCs|jS)N)rb)rTrrrrszParameter.annotationcCs|jS)N)r`)rTrrrr/!szParameter.kindc	Cs�|tkr|j}|tkr*|j}|tkr?|j}|tkrT|j}|tkri|j}t|�||d|d|d|�S)z+Creates a customized copy of the Parameter.r!rr")rMrSr`rbrar"r)rTrr/rr!r"rrrr6%s					zParameter.replacecCs�|j}|j}|tkr?|dkr0d}dj|�}|jtk	ridj|t|j��}|jtk	r�dj|t|j��}|t	kr�d|}n|t
kr�d|}|S)N�z<{0}>z{0}:{1}z{0}={1}�*z**)r/rSr4r(rbrPrrarr5r0)rTr/�	formattedrrrrV;s 			

zParameter.__str__cCs"dj|jjt|�|j�S)Nz<{0} at {1:#x} {2!r}>)r(�	__class__r�idr)rTrrrrWSszParameter.__repr__cCs%dj|jj�}t|��dS)Nzunhashable type: '{0}')r(rjrr')rTrIrrr�__hash__WszParameter.__hash__cCsXt|jt�oW|j|jkoW|j|jkoW|j|jkoW|j|jkS)N)�
issubclassrjrrSr`rarb)rT�otherrrr�__eq__[s
zParameter.__eq__cCs|j|�S)N)ro)rTrnrrr�__ne__bszParameter.__ne__N)z_namez_kindz_defaultz_annotationz_partial_kwarg)rrrNrO�	__slots__r4rXr3rYr5r[r1r]r0r_rP�emptyr%�propertyrr!rr/rMr6rVrWrlrorprrrrr�s*	c@s|eZdZdZdd�Zedd��Zedd��Zedd	��Zd
d�Z	dd
�Z
dd�ZdS)raResult of `Signature.bind` call.  Holds the mapping of arguments
    to the function's parameters.

    Has the following public attributes:

    * arguments : OrderedDict
        An ordered mutable mapping of parameters' names to arguments' values.
        Does not contain arguments' default values.
    * signature : Signature
        The Signature object that created this instance.
    * args : tuple
        Tuple of positional arguments values.
    * kwargs : dict
        Dict of keyword arguments values.
    cCs||_||_dS)N)rA�
_signature)rTr
rArrrr%ws	zBoundArguments.__init__cCs|jS)N)rt)rTrrrr
{szBoundArguments.signaturecCs�g}x�|jjj�D]~\}}|jttfksC|jrDPy|j|}Wntk
rjPYqX|jt	kr�|j
|�q|j|�qWt|�S)N)
rtr r=r/r0r1r"rA�KeyErrorr5�extend�appendr-)rTr>�
param_namerJ�argrrrr>s	
zBoundArguments.argscCs�i}d}x�|jjj�D]�\}}|sp|jttfksO|jrXd}n||jkrpd}q|syqy|j|}Wntk
r�YqX|jtkr�|j	|�q|||<qW|S)NFT)
rtr r=r/r0r1r"rAru�update)rTrUZkwargs_startedrxrJryrrrrU�s(		
zBoundArguments.kwargscCs%dj|jj�}t|��dS)Nzunhashable type: '{0}')r(rjrr')rTrIrrrrl�szBoundArguments.__hash__cCs4t|jt�o3|j|jko3|j|jkS)N)rmrjrr
rA)rTrnrrrro�szBoundArguments.__eq__cCs|j|�S)N)ro)rTrnrrrrp�szBoundArguments.__ne__N)rrrNrOr%rsr
r>rUrlrorprrrrrfsc@s�eZdZdZdZeZeZe	Z
de	ddd�Zedd	��Z
ed
d��Zedd
��Zeedd�Zdd�Zdd�Zdd�Zddd�Zdd�Zdd�Zdd�ZdS) r	aA Signature object represents the overall signature of a function.
    It stores a Parameter object for each parameter accepted by the
    function, as well as information specific to the function itself.

    A Signature object has the following public attributes and methods:

    * parameters : OrderedDict
        An ordered mapping of parameters' names to the corresponding
        Parameter objects (keyword-only arguments are in the same order
        as listed in `code.co_varnames`).
    * return_annotation : object
        The annotation for the return type of the function if specified.
        If the function has no annotation for its return type, this
        attribute is not set.
    * bind(*args, **kwargs) -> BoundArguments
        Creates a mapping from positional and keyword arguments to
        parameters.
    * bind_partial(*args, **kwargs) -> BoundArguments
        Creates a partial mapping from positional and keyword arguments
        to parameters (simulating 'functools.partial' behavior.)
    �_return_annotation�_parametersNTcCs%|dkrt�}n�|r�t�}t}x�t|�D]�\}}|j}||kr�d}	|	j||j�}	t|	��n|}|j}
|
dkr�t|�}
|jd|
�}|
|kr�dj|
�}	t|	��|||
<q:Wntdd�|D��}||_	||_
dS)z�Constructs Signature from the given list of Parameter
        objects and 'return_annotation'.  All arguments are optional.
        Nz%wrong parameter order: {0} before {1}rzduplicate parameter name: {0!r}css|]}|j|fVqdS)N)r)�.0rJrrr�	<genexpr>sz%Signature.__init__.<locals>.<genexpr>)rr4�	enumerater/r(r2rrcr6r|r{)rTr �return_annotation�__validate_parameters__rFZtop_kind�idxrJr/rIrrrrr%�s0			
	zSignature.__init__cCs�t|tj�s'tdj|���|j}|j}|j}|j}t	|d|��}t
|dd�}||||�}t
|di�}	|j}
t
|dd�}|
r�t|
�}nd}g}
||}xI|d|�D]7}|	j
|t�}|
j||d|dt��q�Wx_t||d��D]G\}}|	j
|t�}|
j||d|dtd	|
|��qBW|jd
@r�|||}|	j
|t�}|
j||d|dt��xi|D]a}t}|dk	r
|j
|t�}|	j
|t�}|
j||d|dtd	|��q�W|jd@r�||}|jd
@rs|d7}||}|	j
|t�}|
j||d|dt��||
d
|	j
dt�dd�S)z2Constructs Signature for the given python functionz{0!r} is not a Python functionN�co_kwonlyargcountr�__annotations__�__kwdefaults__rr/r!r^�rr��returnr�F)rr)r8r'r(�_parameter_cls�__code__�co_argcount�co_varnamesr-r�__defaults__�len�getrPrwr3r�co_flagsr5r1r0)rr<rZ	func_codeZ	pos_countZ	arg_namesZ
positionalZkeyword_only_countZkeyword_onlyZannotationsZdefaultsZ
kwdefaultsZpos_default_countr Znon_default_countrr�offsetr!�indexrrrr9sd					
#








	zSignature.from_functioncCs@ytj|j�SWn%tk
r;t|jj��SYnXdS)N)r)�MappingProxyTyper|rrr=)rTrrrr Ts
zSignature.parameterscCs|jS)N)r{)rTrrrr�[szSignature.return_annotationcCsF|tkr|jj�}|tkr0|j}t|�|d|�S)z�Creates a customized copy of the Signature.
        Pass 'parameters' and/or 'return_annotation' arguments
        to override them in the new copy.
        r�)rMr r.r{r)rTr r�rrrr6_s	zSignature.replacecCs%dj|jj�}t|��dS)Nzunhashable type: '{0}')r(rjrr')rTrIrrrrlnszSignature.__hash__cCs8tt|�t�sF|j|jksFt|j�t|j�krJdStdd�t|jj��D��}x�t|jj	��D]�\}\}}|j
tkr�y|j|}Wntk
r�dSYq0X||kr0dSq�y||}Wntk
rdSYq�X||ks,||j|kr�dSq�WdS)NFcss!|]\}}||fVqdS)Nr)r}r�rJrrrr~xsz#Signature.__eq__.<locals>.<genexpr>T)
rmrr	r�r�r �dictr�keysr=r/r1ru)rTrnZother_positionsr�rxrJZother_paramZ	other_idxrrrrors,(
	
	zSignature.__eq__cCs|j|�S)N)ro)rTrnrrrrp�szSignature.__ne__FcCsut�}t|jj��}f}t|�}|rxx?|jj�D].\}}	|	jrF||krF|	j||<qFWx�yt|�}
Wntk
r�yt|�}	Wntk
r�PYn�X|	j	t
kr�Pn�|	j|kr&|	j	tkrd}|j
d|	j�}t|��|	f}Pne|	j	tksD|	jtk	rQ|	f}Pn:|rd|	f}Pn'd}|j
d|	j�}t|��Yq{Xyt|�}	Wntk
r�td��Yq{X|	j	ttfkr�td��|	j	t
kr|
g}|j|�t|�||	j<P|	j|krEtdj
d|	j���|
||	j<q{Wd}
x�tj||�D]�}	|	j	tkr�tdj
d|	j���|	j	tkr�|	}
qo|	j}y|j|�}
WnOtk
r$|r |	j	t
kr |	jtkr tdj
d|���YqoX|
||<qoW|re|
dk	rU|||
j<ntd|��|j||�S)z$Private method.  Don't use directly.zA{arg!r} parameter is positional only, but was passed as a keywordryz'{arg!r} parameter lacking default valueztoo many positional argumentsz$multiple values for argument {arg!r}Nztoo many keyword arguments %r)r�iterr r.r=r"r!�next�
StopIterationr/r5rr4r(r'r0rPr1rvr-�	itertools�chainrBru�_bound_arguments_cls)rTr>rUr;rAr Z
parameters_exZarg_valsrxrJZarg_valrIr.Zkwargs_paramrrr�_bind�s�	

			
	
	
zSignature._bindcOs|dj|dd�|�S)z�Get a BoundArguments object, that maps the passed `args`
        and `kwargs` to the function's signature.  Raises `TypeError`
        if the passed arguments can not be bound.
        rrN)r�)r>rUrrr�bindszSignature.bindcOs|j||dd�S)z�Get a BoundArguments object, that partially maps the
        passed `args` and `kwargs` to the function's signature.
        Raises `TypeError` if the passed arguments can not be bound.
        r;T)r�)rTr>rUrrrr@szSignature.bind_partialc	Cs�g}d}xt|jj��D]h\}}t|�}|j}|tkrXd}n%|tkr}|r}|jd�d}|j|�q"Wdjdj	|��}|j
tk	r�t|j
�}|dj|�7}|S)NTFrhz({0})z, z -> {0})
rr r.rcr/r5r1rwr(�joinr�rPr)	rT�resultZrender_kw_only_separatorr�rJrir/ZrenderedZannorrrrV!s "		
zSignature.__str__)z_return_annotationz_parameters)rrrNrOrqrr�rr�rPrrr%�classmethodr9rsr r�rMr6rlrorpr�r�r@rVrrrrr	�s$%I�)'rOZ
__future__rrrr�r:rdr)�collectionsr�ImportErrorZordereddictZfuncsigs.versionr�__all__rr#Z_WrapperDescriptor�allZ_MethodWrapperrCrrrr
�objectrMrPrRrQr4r3r5r1r0rrr	rrrr�<module>s<
�
�a

Filemanager

Name Type Size Permission Actions
__init__.cpython-35.opt-1.pyc File 19.19 KB 0644
__init__.cpython-35.pyc File 19.19 KB 0644
version.cpython-35.opt-1.pyc File 117 B 0644
version.cpython-35.pyc File 117 B 0644