%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/python/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/python/__pycache__/formmethod.cpython-312.pyc

�

Ϫ�fJ/���dZddlZddlmZmZmZGd�de�ZGd�de�ZGd�d	�Z	Gd
�de	�Z
Gd�d
e
�ZGd�de
�ZGd�de
�Z
Gd�de
�ZGd�de	�ZGd�de�ZGd�de	�ZGd�de	�ZGd�de	�ZGd�de�ZGd �d!e�ZGd"�d#e	�ZGd$�d%e	�Zd&�ZGd'�d(e	�ZGd)�d*e�ZGd+�d,�ZGd-�d.�ZGd/�d0�Zy)1z�
Form-based method objects.

This module contains support for descriptive method signatures that can be used
to format methods.
�N)�Any�Optional�Tuplec��eZdZdZd�Zy)�
FormExceptionz*An error occurred calling the form method.c�>�tj|g|���||_y�N)�	Exception�__init__�descriptions)�self�args�kwargss   �;/usr/lib/python3/dist-packages/twisted/python/formmethod.pyrzFormException.__init__s�����4�'�$�'�"���N)�__name__�
__module__�__qualname__�__doc__r�rrrrs
��4�#rrc��eZdZdZy)�
InputErrorz,
    An error occurred with some input.
    N�rrrrrrrrr���rrc�J�eZdZUdZdZeed<	d
d�Zd�Zdd�Z	d�Z
d�Zd	�Zy)�ArgumentzBase class for form arguments.N�defaultDefaultc�|�||_||_|�|j}||_||_||_|si}||_yr	)�name�	allowNoner�default�	shortDesc�longDesc�hints)r
rr!r"r#r$r s       rrzArgument.__init__%sF����	�"����?��)�)�G����"��� ��
���E���
rc�:�|jj|�yr	)r$�update)r
rs  r�addHintszArgument.addHints3s���
�
���&�!rc�:�|jj||�Sr	)r$�get)r
rr!s   r�getHintzArgument.getHint6s���z�z�~�~�d�G�,�,rc�R�|jxs|jj�Sr	)r"r�
capitalize�r
s r�getShortDescriptionzArgument.getShortDescription9s���~�~�7����!5�!5�!7�7rc�"�|jxsdS)N�)r#r-s r�getLongDescriptionzArgument.getLongDescription<s���}�}�"��"rc��td��)z(Convert the value to the correct format.zimplement in subclass)�NotImplementedError�r
�vals  r�coercezArgument.coerce?s��!�"9�:�:r)NNNN�r	)
rrrrrr�__annotations__rr'r*r.r1r6rrrrrs6��(��N�C��XY��"�-�8�#�;rrc�D�eZdZUdZdZeed<dZdZ							dd�Z	d�Z
y)	�StringzA single string.r0rrNc		�X�tj|||||||��||_||_y)N)r!r"r#r$r )rr�min�max)	r
rr!r"r#r$r r<r=s	         rrzString.__init__Ks<��	����������	�	
������rc��t|�}t|�|jkrtd|jz��|j�0t|�|jkDrtd|jz��t|�S)N�)Value must be at least %s characters long�(Value must be at most %s characters long)�str�lenr<rr=)r
r5�ss   rr6z
String.coercebsg����H���q�6�D�H�H���H�4�8�8�S�T�T��8�8��C��F�T�X�X�$5��G�$�(�(�R�S�S��3�x�r)NNNNr7rN)rrrrrrAr8r<r=rr6rrrr:r:Ds:����N�C��
�C�
�C�
�����
���.rr:c��eZdZdZy)�TextzA long string.NrrrrrErEks��rrEc��eZdZdZy)�Passwordz-A string which should be obscured when input.NrrrrrGrGos��7rrGc��eZdZdZd�Zy)�VerifiedPasswordzCA string that should be obscured when input and needs verification.c�B�t|�dk7s|d|dk7rtd��t|d�}t|�|jkrtd|jz��|j�0t|�|jkDrtd|jz��|S)N�rr7z%Please enter the same password twice.r?r@)rBrrAr<r=)r
�valsrCs   rr6zVerifiedPassword.coercevs����t�9��>�T�!�W��Q��/��D�E�E���Q��L���q�6�D�H�H���H�4�8�8�S�T�T��8�8��C��F�T�X�X�$5��G�$�(�(�R�S�S��rN)rrrrr6rrrrIrIss
��M�rrIc��eZdZdZy)�HiddenzSA string which is not displayed.

    The passed default is used as the value.
    NrrrrrNrN�s��rrNc�6�eZdZUdZdZeeed<	dd�Zd�Z	y)�IntegerzA single integer.Nrc	�:�tj|||||||�yr	�rr�r
rr r!r"r#r$s       rrzInteger.__init__����	���$��g�y�(�E�9�Urc��|j�s
|jry	t|�S#t$rt	dj|���wxYw)Nz5{} is not valid, please enter a whole number, e.g. 10)�stripr �int�
ValueErrorr�formatr4s  rr6zInteger.coerce�sM���y�y�{�t�~�~��	��s�8�O���	��J�Q�Q�RU�V��
�	�s	�
*�$A�r7NNNN)
rrrrrrrWr8rr6rrrrPrP�s%���$(�N�H�S�M�(�UY�V�rrPc�$�eZdZ					dd�Zd�Zy)�IntegerRangeNc		�X�||_||_tj|||||||��y)N)r r!r"r#r$)r<r=rPr)	r
rr<r=r r!r"r#r$s	         rrzIntegerRange.__init__�s:������������������	�	
rc�(�tj||�}|jr|dk(r|S||jkr%t	dj||j���||jkDr%t	dj||j���|S)Nz/Value {} is too small, it should be at least {}z.Value {} is too large, it should be at most {})rPr6r r<rrYr=)r
r5�results   rr6zIntegerRange.coerce�s�������c�*���>�>�f��n��M��D�H�H���A�H�H��D�H�H���
�
�D�H�H���@�G�G��D�H�H���
�
�
rrZ�rrrrr6rrrr\r\�s�������
�.rr\c�2�eZdZUdZeeed<	dd�Zd�Zy)�FloatNrc	�:�tj|||||||�yr	rRrSs       rrzFloat.__init__�rTrc��|j�s
|jry	t|�S#t$rt	d|z��wxYw)NzInvalid float: %s)rVr �floatrXrr4s  rr6zFloat.coerce�sC���y�y�{�t�~�~��	8���:����	8��0�3�6�7�7�	8�s	�
*�ArZ)	rrrrrrer8rr6rrrrbrb�s"��&*�N�H�U�O�*�UY�V�8rrbc�*�eZdZdZggddddfd�Zd�Zy)�Choicea�
    The result of a choice between enumerated types.  The choices should
    be a list of tuples of tag, value, and description.  The tag will be
    the value returned if the user hits "Submit", and the description
    is the bale for the enumerated type.  default is a list of all the
    values (seconds element in choices).  If no defaults are specified,
    initially the first item will be selected.  Only one item can (should)
    be selected at once.
    Nr7c	��||_|r|s|j|dd�tj|||||||��y)Nrr7�r )�choices�appendrr)r
rrjr!r"r#r$r s        rrzChoice.__init__�sF������7��N�N�7�1�:�a�=�)�����$���H�e�y�	�	
rc�Z�|jD]\}}}||k(s�
|cStd|z��)NzInvalid Choice: %s)rjr)r
�inIdent�identr5�descs     rr6z
Choice.coerce�s<�� $���	=��E�3������
�	=��1�G�;�<�<r�rrrrrr6rrrrgrg�s%���������
�"=rrgc�*�eZdZdZ						dd�Zd�Zy)�Flagsa�
    The result of a checkbox group or multi-menu.  The flags should be a
    list of tuples of tag, value, and description. The tag will be
    the value returned if the user hits "Submit", and the description
    is the bale for the enumerated type.  default is a list of all the
    values (second elements in flags).  If no defaults are specified,
    initially nothing will be selected.  Several items may be selected at
    once.
    Nc	�J�||_tj|||||||��y�Nri)�flagsrr)r
rrur!r"r#r$r s        rrzFlags.__init__s-����
�����$���H�e�y�	�	
rc��|sgSg}|D]<}|jD]\}}}||k(s�
|j|��/td|z��|S)NzInvalid Flag: %s)rurkr)r
�
inFlagKeys�outFlags�	inFlagKey�flagKey�flagVal�flagDescs       rr6zFlags.coerce!sm����I���#�	A�I�.2�j�j�
A�*���(���'��O�O�G�,��
A�
!�!3�i�!?�@�@�
	A��r)rrNNNr7rprrrrrrrs%���������

�rrrc��eZdZy)�
CheckGroupN�rrrrrrr~r~/���rr~c��eZdZy)�
RadioGroupNrrrrr�r�3r�rr�c��eZdZd�Zy)�Booleanc�F�|syt|�j�}|dvryy)Nr)�no�n�f�false�0r7)rA�lower)r
�inVal�lInVals   rr6zBoolean.coerce8s)�����U��!�!�#���3�3��rN)rrrr6rrrr�r�7s��rr�c��eZdZdd�Zd�Zy)�FileNc	�<�tj||d||||��yrtrR)r
rr r"r#r$s      rrz
File.__init__Bs$������$��i��5�I�	�	
rc�>�|s
|jry|r|Std��)NzInvalid File)r r)r
�files  rr6zFile.coerceGs!�������
��K��^�,�,r)r7NNNr`rrrr�r�As��
�
-rr�c�2�t|�}|dkrt�|S)Nr)rWrX)�xs r�positiveIntr�Ps���A��A��A�v����Hrc�B�eZdZUdZdZeeeeefed<	dd�Z	d�Z
y)�Datez#A date -- (year, month, day) tuple.Nrc�Z�tj||||||�||_|sd|_yy)N)i�r7r7)rrr rrSs       rrz
Date.__init__\s3��	���$��g�y�(�E�J�"����".�D��rc�r�t|�dk(r
|jry	tt|�\}}}||fdk(r(t
j|�std|z��|||fS	tj|}||kDrtd��|||fS#t$rtd��wxYw#t$rtd��wxYw)z(Return tuple of ints (year, month, day).)r0r0r0NzInvalid date)rK�z%d was not a leap year)
�tupler �mapr�rXr�calendar�isleap�mdays�
IndexError)r
r�year�month�dayr�s      rr6zDate.coerceds�����;�,�&�4�>�>��	-�"�;��5��D�%��
�3�<�7�"��?�?�4�(� �!9�D�!@�A�A��U�C�'�'�	-��N�N�5�)�E���;��^�,�,��U�C�����	-��^�,�,�	-���	-��^�,�,�	-�s�B	�!B!�	B�!B6rZ)rrrrrrrrWr8rr6rrrr�r�Ws0��-�59�N�H�U�3��S�=�1�2�9�UY�/� rr�c�,�eZdZdZdgdddddfd�Zd�Zy)�Submitz0Submit button or a reasonable facsimile thereof.)r��submitzSubmit formrNc�V�tj||||||��||_||_y)N)rjr"r#r$)rgrr �reset)r
rrjr�r"r#r r$s        rrzSubmit.__init__~s7��	���������
	�	
�#�����
rc�L�|jr|sytj||�Sr	)r rgr6)r
�values  rr6z
Submit.coerce�s���>�>�%���=�=��u�-�-rrprrrr�r�{s&��:�
5�5�������*.rr�c��eZdZdZy)�PresentationHintz(
    A hint to a particular system.
    Nrrrrr�r��rrr�c�$�eZdZdZd�Zd�Zdd�Zy)�MethodSignaturez$
    A signature of a callable.
    c��||_y)r0N)�methodSignature)r
�sigLists  rrzMethodSignature.__init__�s
��&��rc�L�|jD]}|j|k(s�|cSyr	)r�r)r
r�as   r�getArgumentzMethodSignature.getArgument�s'���%�%�	�A��v�v��~���	rc��t|||�Sr	)�
FormMethod)r
�callable�takesRequests   r�methodzMethodSignature.method�s���$��,�7�7rN�F)rrrrrr�r�rrrr�r��s���'��
8rr�c�$�eZdZdZdd�Zd�Zd�Zy)r�z#A callable object with a signature.c�.�||_||_||_yr	)�	signaturer�r�)r
r�r�r�s    rrzFormMethod.__init__�s��"��� ��
�(��rc�@�t|jj�Sr	)r�r�r�r-s r�getArgszFormMethod.getArgs�s���T�^�^�3�3�4�4rc�&�|j|i|��Sr	)r�)r
r�kws   r�callzFormMethod.call�s���t�}�}�d�)�b�)�)rNr�)rrrrrr�r�rrrr�r��s��-�)�
5�*rr�)rr��typingrrrr
rrrr:rErGrIrNrPr\rbrgrrr~r�r�r�r�r�r�r�r�r�rrr�<module>r�s ����'�'�#�I�#����";�";�J$�X�$�N�6��8�v�8��v���V���h��4(�7�(�V8�H�8�,!=�X�!=�H%�H�%�P	��	�	��	��h��-�8�-�
�! �8�! �H.�V�.�>��8�8�$*�*r

Zerion Mini Shell 1.0