Your IP : 216.73.216.52


Current Path : /snap/certbot/current/lib64/python3.12/site-packages/pyparsing/__pycache__/
Upload File :
Current File : //snap/certbot/current/lib64/python3.12/site-packages/pyparsing/__pycache__/common.cpython-312.pyc

�

tI�i5C����ddl�ddlmZmZmZddlmZddlZejdk\ZGd�d�Z	e
e	�j�D�cgc]}e|e
�s�
|��c}Zycc}w)	�)�*)�
DelimitedList�any_open_tag�
any_close_tag�)�datetimeN)��
c�
�eZdZdZed��Zed��Zee�jd�jerend��Z	ee
�jd�jeed��Z	ed�jd	�jerend
��Z	e�jerend��dze�jerend
��zjd�Z	ej)d��eeeed�j-�ez�zzjd�Z	ej)e�ed�jd�jerend��Z	ed�jd�jerend��Z	eezezjd�j7�Z	ed�jd�jerend��Z	ed�jd�jerend��Z	eee �jd�Z!	ed �jd!�Z"	ed"�jd#�Z#e#d$e#zd%zzjd&�Z$ee#d$e#zd'zz�d(zee#d$e#zd'zz�zjd)�Z%e%jMd*��d+e"zjd,�Z'e(e$e'ze%zjd-��jd-�Z)	ed.�jd/�Z*	edQd0e+fd1��Z,edRd0e+fd2��Z-ed3�jd4�Z.	ed5�jd6�Z/	ed7��Z0er.e.�j)e0�Z1	e/�j)e0�Z2	ed8�jd9�Z3	e4j,�e5j,�zZ6ed:e+d;ed<e7fd=��Z8e(e9e:d>�e;�zee<d>�?�zee=d@�e>e;�d>z�z�z��j7�jdA�Z?e@eeAj��e?zdB�C��jdD�ZC	edE��ZDedF��ZEedG�jdH�ZF	eeGdIe��ZHeeGdJe��ZIeeGdKe,��ZJeeGdLe-��ZKeeGdMe8��ZLeeGdNeD��ZMeeGdOeE��ZNyP)S�pyparsing_commona
Here are some common low-level expressions that may be useful in
    jump-starting parser development:

    - numeric forms (:class:`integers<integer>`, :class:`reals<real>`,
      :class:`scientific notation<sci_real>`)
    - common :class:`programming identifiers<identifier>`
    - network addresses (:class:`MAC<mac_address>`,
      :class:`IPv4<ipv4_address>`, :class:`IPv6<ipv6_address>`)
    - ISO8601 :class:`dates<iso8601_date>` and
      :class:`datetime<iso8601_datetime>`
    - :class:`UUID<uuid>`
    - :class:`comma-separated list<comma_separated_list>`
    - :class:`url`

    Parse actions:

    - :class:`convert_to_integer`
    - :class:`convert_to_float`
    - :class:`convert_to_date`
    - :class:`convert_to_datetime`
    - :class:`strip_html_tags`
    - :class:`upcase_tokens`
    - :class:`downcase_tokens`

    Examples:

    .. testcode::

        pyparsing_common.number.run_tests('''
            # any int or real number, returned as the appropriate type
            100
            -100
            +100
            3.14159
            6.02e23
            1e-12
            ''')

    .. testoutput::
        :options: +NORMALIZE_WHITESPACE


        # any int or real number, returned as the appropriate type
        100
        [100]

        -100
        [-100]

        +100
        [100]

        3.14159
        [3.14159]

        6.02e23
        [6.02e+23]

        1e-12
        [1e-12]

    .. testcode::

        pyparsing_common.fnumber.run_tests('''
            # any int or real number, returned as float
            100
            -100
            +100
            3.14159
            6.02e23
            1e-12
            ''')

    .. testoutput::
        :options: +NORMALIZE_WHITESPACE


        # any int or real number, returned as float
        100
        [100.0]

        -100
        [-100.0]

        +100
        [100.0]

        3.14159
        [3.14159]

        6.02e23
        [6.02e+23]

        1e-12
        [1e-12]

    .. testcode::

        pyparsing_common.hex_integer.run_tests('''
            # hex numbers
            100
            FF
            ''')

    .. testoutput::
        :options: +NORMALIZE_WHITESPACE


        # hex numbers
        100
        [256]

        FF
        [255]

    .. testcode::

        pyparsing_common.fraction.run_tests('''
            # fractions
            1/2
            -3/4
            ''')

    .. testoutput::
        :options: +NORMALIZE_WHITESPACE


        # fractions
        1/2
        [0.5]

        -3/4
        [-0.75]

    .. testcode::

        pyparsing_common.mixed_integer.run_tests('''
            # mixed fractions
            1
            1/2
            -3/4
            1-3/4
            ''')

    .. testoutput::
        :options: +NORMALIZE_WHITESPACE


        # mixed fractions
        1
        [1]

        1/2
        [0.5]

        -3/4
        [-0.75]

        1-3/4
        [1.75]
    .. testcode::

        import uuid
        pyparsing_common.uuid.set_parse_action(token_map(uuid.UUID))
        pyparsing_common.uuid.run_tests('''
            # uuid
            12345678-1234-5678-1234-567812345678
            ''')

    .. testoutput::
        :options: +NORMALIZE_WHITESPACE


        # uuid
        12345678-1234-5678-1234-567812345678
        [UUID('12345678-1234-5678-1234-567812345678')]
    c�>�|D�cgc]
}t|���c}Scc}w)zK
        Parse action for converting parsed integers to Python int
        ��int��_�__�t�tts    ��/build/snapcraft-certbot-53a6961353a63169611ae8a78f6bfa4f/parts/certbot/install/lib/python3.12/site-packages/pyparsing/common.py�convert_to_integerz#pyparsing_common.convert_to_integer�s��
#$�$�B��B��$�$��$��c�>�|D�cgc]
}t|���c}Scc}w)zL
        Parse action for converting parsed numbers to Python float
        ��floatrs    r�convert_to_floatz!pyparsing_common.convert_to_float�s��
%&�&�b��b�	�&�&��&r�integerc�>�|D�cgc]
}t|���c}Scc}w�Nr�rrs  r�<lambda>zpyparsing_common.<lambda>����a�0��C��G�0���0rzhex integer�z[+-]?\d+zsigned integerc�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>�r!rc�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>�����2�"�E�"�I�2���2r�/c�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>�r%r�fractionc��|d|dzS)Nr����)rs rr zpyparsing_common.<lambda>�s���A���B�����-z"fraction or mixed integer-fractionz[+-]?(?:\d+\.\d*|\.\d+)zreal numberc�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>r%rz@[+-]?(?:\d+(?:[eE][+-]?\d+)|(?:\d+\.\d*|\.\d+)(?:[eE][+-]?\d+)?)z$real number with scientific notationc�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>r%r�numberz[+-]?\d+\.?\d*(?:[eE][+-]?\d+)?�fnumberc�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>r%rz;(?i:[+-]?(?:(?:\d+\.?\d*(?:e[+-]?\d+)?)|nan|inf(?:inity)?))�
ieee_floatc�>�|D�cgc]
}t|���c}Scc}wrrrs  rr zpyparsing_common.<lambda>)r%r�
identifierzQ(?:25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})(?:\.(?:25[0-5]|2[0-4][0-9]|1?[0-9]{1,2})){3}zIPv4 addressz[0-9a-fA-F]{1,4}�hex_integer�:�zfull IPv6 address)r�z::zshort IPv6 addressc�,�td�|D��dkS)Nc3�`K�|]&}tjj|�s�#d���(y�w)rN)r�
_ipv6_part�matches)�.0rs  r�	<genexpr>z,pyparsing_common.<lambda>.<locals>.<genexpr>@s$����O�B�'7�'B�'B�'J�'J�2�'N�a�O�s�$.�.�)�sum)rs rr zpyparsing_common.<lambda>@s��#�O�!�O�O�RS�S�r,z::ffff:zmixed IPv6 addresszIPv6 addressz:[0-9a-fA-F]{2}([:.-])[0-9a-fA-F]{2}(?:\1[0-9a-fA-F]{2}){4}zMAC address�fmtc����fd�}|S)a
        Helper to create a parse action for converting parsed date string to Python datetime.date

        Params -
        - fmt - format to be passed to datetime.strptime (default= ``"%Y-%m-%d"``)

        Example:

        .. testcode::

            date_expr = pyparsing_common.iso8601_date.copy()
            date_expr.set_parse_action(pyparsing_common.convert_to_date())
            print(date_expr.parse_string("1999-12-31"))

        prints:

        .. testoutput::

            [datetime.date(1999, 12, 31)]
        c���	tj|d��j�S#t$r}t	||t|���d}~wwxYw�Nr)r�strptime�date�
ValueError�ParseException�str)�ss�llr�verBs    �r�cvt_fnz0pyparsing_common.convert_to_date.<locals>.cvt_fnfsK���
6��(�(��A���4�9�9�;�;���
6�$�R��S��W�5�5��
6�s�&*�	A�A	�	Ar+�rBrNs` r�convert_to_datez pyparsing_common.convert_to_dateOs���.	6��
r,c����fd�}|S)a[Helper to create a parse action for converting parsed
        datetime string to Python :class:`datetime.datetime`

        Params -
        - fmt - format to be passed to :class:`datetime.strptime` (default= ``"%Y-%m-%dT%H:%M:%S.%f"``)

        Example:

        .. testcode::

            dt_expr = pyparsing_common.iso8601_datetime.copy()
            dt_expr.set_parse_action(pyparsing_common.convert_to_datetime())
            print(dt_expr.parse_string("1999-12-31T23:59:59.999"))

        prints:

        .. testoutput::

            [datetime.datetime(1999, 12, 31, 23, 59, 59, 999000)]
        c���	tj|d��S#t$r}t||t	|���d}~wwxYwrE)rrFrHrIrJ)�s�lrrMrBs    �rrNz4pyparsing_common.convert_to_datetime.<locals>.cvt_fn�sB���
4��(�(��1��s�3�3���
4�$�Q��3�r�7�3�3��
4�s��	A�;�Ar+rOs` r�convert_to_datetimez$pyparsing_common.convert_to_datetimens���.	4��
r,z7(?P<year>\d{4})(?:-(?P<month>\d\d)(?:-(?P<day>\d\d))?)?zISO8601 datez�(?P<year>\d{4})-(?P<month>\d\d)-(?P<day>\d\d)[T ](?P<hour>\d\d):(?P<minute>\d\d)(:(?P<second>\d\d(\.\d*)?)?)?(?P<tz>Z|[+-]\d\d:?\d\d)?zISO8601 datetimec��t|jjd�xsd�}t|jxsd�}t|jxsd�}t|j
xsd�}t|jxsd�}t|jxsd�}	t|||||t|�t|dzdz��S#t$r/}	t||d|	���j|	j�d�d}	~	wwxYw)aParse action to convert parsed dates or datetimes to a Python
        :class:`datetime.datetime`.

        This parse action will use the year, month, day, etc. results
        names defined in the ISO8601 date expressions, but it can be
        used with any expression that provides one or more of these fields.

        Omitted fields will default to fields from Jan 1, 00:00:00.

        Invalid dates will raise a :class:`ParseException` with the
        error message indicating the invalid date fields.
        �0rri�zInvalid date/time: N)r�year�lstrip�month�day�hour�minuter�secondrrHrI�with_traceback�
__traceback__)
rSrTrrXrZr[r\r]r^rMs
          r�as_datetimezpyparsing_common.as_datetime�s����1�6�6�=�=��%�*��+���A�G�G�L�q�!���!�%�%�*�1�o���1�6�6�;�Q����Q�X�X�]��#���q�x�x�}�1�%��	���e�S�$���F��S�&�1�*�PT�AT�=U��
���	� ��A�)<�R�D�'A�B�Q�Q�� � ���
��	�s�'(C�	D�*D�Dz4[0-9a-fA-F]{8}(?:-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}�UUIDrSrT�tokensc�F�tjj|d�S)a\Parse action to remove HTML tags from web page HTML source

        Example:

        .. testcode::

            # strip HTML links from normal text
            text = '<td>More info at the <a href="https://github.com/pyparsing/pyparsing/wiki">pyparsing</a> wiki page</td>'
            td, td_end = make_html_tags("TD")
            table_text = td + SkipTo(td_end).set_parse_action(
                pyparsing_common.strip_html_tags)("body") + td_end
            print(table_text.parse_string(text).body)

        Prints:

        .. testoutput::

            More info at the pyparsing wiki page
        r)r�_html_stripper�transform_string)rSrTrcs   r�strip_html_tagsz pyparsing_common.strip_html_tags�s��* �.�.�?�?��q�	�J�Jr,�,)�
exclude_charsz 	�	commaItem�)�defaultzcomma separated listc�H�|D�cgc]}|j���c}Scc}w)z-Parse action to convert tokens to upper case.)�upper�rSrTrrs    r�
upcase_tokenszpyparsing_common.upcase_tokens����&'�'�r����
�'�'��'��c�H�|D�cgc]}|j���c}Scc}w)z-Parse action to convert tokens to lower case.)�lowerros    r�downcase_tokensz pyparsing_common.downcase_tokens�rqrra�(?P<url>(?:(?:(?P<scheme>https?|ftp):)?\/\/)(?:(?P<auth>\S+(?::\S*)?)@)?(?P<host>(?!(?:10|127)(?:\.\d{1,3}){3})(?!(?:169\.254|192\.168)(?:\.\d{1,3}){2})(?!172\.(?:1[6-9]|2\d|3[0-1])(?:\.\d{1,3}){2})(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z0-9\u00a1-\uffff][a-z0-9\u00a1-\uffff_-]{0,62})?[a-z0-9\u00a1-\uffff]\.)+(?:[a-z\u00a1-\uffff]{2,}\.?))(:(?P<port>\d{2,5}))?(?P<path>\/[^?# ]*)?(\?(?P<query>[^#]*))?(#(?P<fragment>\S*))?)�url�convertToInteger�convertToFloat�
convertToDate�convertToDatetime�
stripHTMLTags�upcaseTokens�downcaseTokensN)z%Y-%m-%d)z%Y-%m-%dT%H:%M:%S.%f)O�__name__�
__module__�__qualname__�__doc__�staticmethodrr�Word�nums�set_name�set_parse_action�PY_310_OR_LATERr�hexnums�	token_maprr6�Regex�signed_integerr(�add_parse_action�Opt�suppress�
mixed_integerrA�real�sci_real�
streamliner0r1r3�
identchars�identbodycharsr5�ipv4_addressr<�_full_ipv6_address�_short_ipv6_address�
add_condition�_mixed_ipv6_address�Combine�ipv6_address�mac_addressrJrPrU�iso8601_date�iso8601_datetimera�iso8601_date_validated�iso8601_datetime_validated�uuidrrre�ParseResultsrg�	OneOrMore�Literal�LineEnd�
printables�White�
FollowedBy�
_commasepitemr�
quoted_string�copy�comma_separated_listrprurv�replaced_by_pep8rwrxryrzr{r|r}r+r,rrrsx��p�d�%��%��'��'�	
�T�
�	��)�	�	�	��
�0�

��I�	
�W�
���}�-�>�>�y��b�?Q�R��K�	�k��	��"�	#�	�	��
�0�

��[�	��)�)��
�2�	
�
�	��
�
+�
+��
�2�
�
	
��h�z��
�Y����7�8�	�>�C��C��(9�(9�(;�h�(F�$G�G�G��h�3�4��m��"�"�3�'�	�(�)�	��-�	 �	�	��
�2�

�	�N�	�Q�R�	��8�	9�	�	��
�2�

�
�0���o��.�
8�
8��
B�
M�
M�
O�F�K�	�0�1�	��)�	�	�	��
�2�

��=�	�L�M�	��,�	�	�	��
�2�

��_��j�.�1�:�:�<�H�J�d��\���h�~���3��*�+�4�4�]�C�J�$��j�(8�A�'=�=�G�G����	�J�#�
�*�f�4�4�5�
�	�

�j�C�*�,��6�6�
7�	8��h�#�$�	�
�%�%�S��%�|�3�=�=�>R�S���	�1�	1�4G�	G�Q�Q��	
���h�~��	�
0��E���h�}���G���S����<������<�B���h�~���$��	R���h�!�"��]�����8�!-��!@�!@��!M��b�%5�%7�%H�%H��%U�"�p��H�I�R�R���D�6�*�\�*�*�,�/E�}�/E�/E�/G�G�N��K�3�K�3�K��K��K�.	�����
��9�*���z��5�6��e�E�l�j���S��&A�%A�A�B�C�
�	
�
���	��+�	��)��M��� �=�0�"�=���h�%�&��e��(��(��(��(�
�*	
�.�\�h�u�o�]�^�$�$4�5G�I[�$\�]��!�"2�3C�EU�"V�W�N� �!1�/�?�!S�T�M�$�%5�6I�K^�%_�`�� �!1�/�?�!S�T�M�� 0��� O�P�L�!�"2�3C�_�"U�V�Nr,r)�core�helpersrrrr�sys�version_infor�r�vars�values�
isinstance�
ParserElement�_builtin_exprs)�vs0r�<module>r�sg���?�?��
��"�"�g�-��iW�iW�\�$�%�,�,�.��
�*�Q�
�2N�A����s�A"�A"