403Webshell
Server IP : 192.158.238.246  /  Your IP : 18.222.94.214
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib/python3.7/site-packages/pyparsing/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib/python3.7/site-packages/pyparsing/__pycache__/testing.cpython-37.pyc
B

o|SeZ4�@sBddlmZddlZddlmZmZmZmZmZGdd�d�Z	dS)�)�contextmanagerN�)�
ParserElement�ParseException�Keyword�__diag__�
__compat__c@sfeZdZdZGdd�d�ZGdd�d�Zedeej	e
ej	e
eeej	eej	eed	�d
d��ZdS)
�pyparsing_testzB
    namespace class for classes useful in writing unit tests
    c@s@eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)z&pyparsing_test.reset_pyparsing_contexta�
        Context manager to be used when writing unit tests that modify pyparsing config values:
        - packrat parsing
        - bounded recursion parsing
        - default whitespace characters.
        - default keyword characters
        - literal string auto-conversion class
        - __diag__ settings

        Example::

            with reset_pyparsing_context():
                # test that literals used to construct a grammar are automatically suppressed
                ParserElement.inlineLiteralsUsing(Suppress)

                term = Word(alphas) | Word(nums)
                group = Group('(' + term[...] + ')')

                # assert that the '()' characters are not included in the parsed tokens
                self.assertParseAndCheckList(group, "(abc 123 def)", ['abc', '123', 'def'])

            # after exiting context manager, literals are converted to Literal expressions again
        cCs
i|_dS)N)�
_save_context)�self�r��/builddir/build/BUILDROOT/alt-python37-pyparsing-3.0.9-2.el8.x86_64/opt/alt/python37/lib/python3.7/site-packages/pyparsing/testing.py�__init__-sz/pyparsing_test.reset_pyparsing_context.__init__cCs�tj|jd<tj|jd<tj|jd<tj|jd<tj|jd<tjrRtjj	|jd<n
d|jd<tj
|jd<tj|jd<d	d
�tj
D�|jd<dtji|jd
<|S)N�default_whitespace�default_keyword_chars�literal_string_class�verbose_stacktrace�packrat_enabled�packrat_cache_size�
packrat_parse�recursion_enabledcSsi|]}tt|�|�qSr)�getattrr)�.0�namerrr
�
<dictcomp>Fsz?pyparsing_test.reset_pyparsing_context.save.<locals>.<dictcomp>r�collect_all_And_tokensr)r�DEFAULT_WHITE_CHARSr
r�DEFAULT_KEYWORD_CHARS�_literalStringClassr�_packratEnabled�
packrat_cache�size�_parse�_left_recursion_enabledr�
_all_namesrr)rrrr
�save0s
z+pyparsing_test.reset_pyparsing_context.savecCs�tj|jdkr t�|jd�|jdt_|jdt_t�|jd�x.|jd��D]\}}|rjt	j
nt	j|�qXWdt_|jdr�t�
|jd�n|jd	t_|jd
t_|jdt_|S)NrrrrrFrrrrr)rrr
Zset_default_whitespace_charsrrr�inlineLiteralsUsing�itemsr�enable�disablerZenable_packratr"r#rr)rr�valuerrr
�restorePs$
z.pyparsing_test.reset_pyparsing_context.restorecCst|��}|j�|j�|S)N)�typer
�update)r�retrrr
�copyqs
z+pyparsing_test.reset_pyparsing_context.copycCs|��S)N)r%)rrrr
�	__enter__vsz0pyparsing_test.reset_pyparsing_context.__enter__cGs|��dS)N)r+)r�argsrrr
�__exit__ysz/pyparsing_test.reset_pyparsing_context.__exit__N)
�__name__�
__module__�__qualname__�__doc__rr%r+r/r0r2rrrr
�reset_pyparsing_contexts !r7c@sJeZdZdZddd�Zddd�Zddd	�Zdd
d�Zee	dfdd
��Z
dS)z&pyparsing_test.TestParseResultsAssertszk
        A mixin class to add parse results assertion methods to normal unittest.TestCase classes.
        NcCs<|dk	r|j||��|d�|dk	r8|j||��|d�dS)z�
            Unit test assertion to compare a :class:`ParseResults` object with an optional ``expected_list``,
            and compare any defined results names with an optional ``expected_dict``.
            N)�msg)�assertEqual�as_listZas_dict)r�result�
expected_list�
expected_dictr8rrr
�assertParseResultsEquals�sz?pyparsing_test.TestParseResultsAsserts.assertParseResultsEqualsTcCs@|j|dd�}|r t|���nt|���|j|||d�dS)z�
            Convenience wrapper assert to test a parser element and input string, and assert that
            the resulting ``ParseResults.asList()`` is equal to the ``expected_list``.
            T)Z	parse_all)r<r8N)�parse_string�print�dumpr:r>)r�expr�test_stringr<r8�verboser;rrr
�assertParseAndCheckList�s
z>pyparsing_test.TestParseResultsAsserts.assertParseAndCheckListcCs@|j|dd�}|r t|���nt|���|j|||d�dS)z�
            Convenience wrapper assert to test a parser element and input string, and assert that
            the resulting ``ParseResults.asDict()`` is equal to the ``expected_dict``.
            T)�parseAll)r=r8N)r?r@rAr:r>)rrBrCr=r8rDr;rrr
�assertParseAndCheckDict�s
z>pyparsing_test.TestParseResultsAsserts.assertParseAndCheckDictc
Cs|\}}|dk	r�dd�t||�D�}x�|D]�\}}}	tdd�|	D�d�}
tdd�|	D�d�}|dk	r�|j||
pp|d��t|t�r�|�WdQRXq*tdd�|	D�d�}td	d�|	D�d�}
||
fd
kr�|j|||
|
p�|d�q*td�|��q*W|j||dk	�r|nd
d�dS)ah
            Unit test assertion to evaluate output of ``ParserElement.runTests()``. If a list of
            list-dict tuples is given as the ``expected_parse_results`` argument, then these are zipped
            with the report tuples returned by ``runTests`` and evaluated using ``assertParseResultsEquals``.
            Finally, asserts that the overall ``runTests()`` success value is ``True``.

            :param run_tests_report: tuple(bool, [tuple(str, ParseResults or Exception)]) returned from runTests
            :param expected_parse_results (optional): [tuple(str, list, dict, Exception)]
            NcSsg|]\}}||f��qSrr)r�rpt�expectedrrr
�
<listcomp>�szOpyparsing_test.TestParseResultsAsserts.assertRunTestResults.<locals>.<listcomp>css|]}t|t�r|VqdS)N)�
isinstance�str)r�exprrr
�	<genexpr>�szNpyparsing_test.TestParseResultsAsserts.assertRunTestResults.<locals>.<genexpr>css&|]}t|t�rt|t�r|VqdS)N)rKr,�
issubclass�	Exception)rrMrrr
rN�s)�expected_exceptionr8css|]}t|t�r|VqdS)N)rK�list)rrMrrr
rN�scss|]}t|t�r|VqdS)N)rK�dict)rrMrrr
rN�s)NN)r<r=r8zno validation for {!r}zfailed runTests)r8)	�zip�next�assertRaisesrKrPr>r@�format�
assertTrue)r�run_tests_report�expected_parse_resultsr8�run_test_success�run_test_results�mergedrCr;rI�fail_msgrQr<r=rrr
�assertRunTestResults�s:
z;pyparsing_test.TestParseResultsAsserts.assertRunTestResultsc	cs$|j||d��dVWdQRXdS)N)r8)rV)r�exc_typer8rrr
�assertRaisesParseException�szApyparsing_test.TestParseResultsAsserts.assertRaisesParseException)NNN)NT)NT)NN)r3r4r5r6r>rErGr_rrrarrrr
�TestParseResultsAsserts|s



>rbNT�|)�s�
start_line�end_line�expand_tabs�eol_mark�mark_spaces�mark_control�returncs|r|��}�dk	r��dkrPt�dd�ttdd�tdd��D�d	d
iB�}d�n(t��fdd�ttdd
��d	gD��}|�|�}|dk	r�|dkr�|dkr�t�ddd��}|�|�}n|�d|�}|dkr�d}|dkr�t|�}t	|t|��}t	t
d|�|�}�dk�r|��|d|�}n dd�|�d�|d|�D�}|�sFdStt|���t
dd�|D��}	d�d}
|	dk�r�|
d�
dd�tt
|	dd��D��d}nd}||
d�
dd�t|	d�D��d}|
d|	dd}
||
d�
��fdd�t||d �D��dS)!u	
        Helpful method for debugging a parser - prints a string with line and column numbers.
        (Line and column numbers are 1-based.)

        :param s: tuple(bool, str - string to be printed with line and column numbers
        :param start_line: int - (optional) starting line number in s to print (default=1)
        :param end_line: int - (optional) ending line number in s to print (default=len(s))
        :param expand_tabs: bool - (optional) expand tabs to spaces, to match the pyparsing default
        :param eol_mark: str - (optional) string to mark the end of lines, helps visualize trailing spaces (default="|")
        :param mark_spaces: str - (optional) special character to display in place of spaces
        :param mark_control: str - (optional) convert non-printing control characters to a placeholding
                                 character; valid values:
                                 - "unicode" - replaces control chars with Unicode symbols, such as "␍" and "␊"
                                 - any single character string - replace control characters with given string
                                 - None (default) - string is displayed as-is

        :return: str - input string with leading line numbers and column number headers
        N�unicodecSsi|]\}}||�qSrr)r�c�urrr
rsz4pyparsing_test.with_line_numbers.<locals>.<dictcomp>r�!i$i3$�i!$�csi|]
}�|�qSrr)rrm)rjrr
rs� � i	$i#$)�	rrrcSsg|]}|d�qS)u␊r)r�linerrr
rJ'sz4pyparsing_test.with_line_numbers.<locals>.<listcomp>u␊css|]}t|�VqdS)N)�len)rrurrr
rN,sz3pyparsing_test.with_line_numbers.<locals>.<genexpr>�ccss"|]}d�d|dd�VqdS)z{}{}zc                                                                                                   r�dN)rW)r�irrr
rN2srx�
css |]}d�|dd�VqdS)z         {}r�
N)rW)rryrrr
rN=sr{Z
1234567890c3s"|]\}}d�|�|��VqdS)z{:{}d}:{}{}N)rW)rryru)rh�lineno_widthrr
rNGs)�start)�
expandtabsrL�	maketransrT�rangerR�	translate�replacerv�min�max�
splitlines�split�join�	enumerate)rdrerfrgrhrirjZtblZs_linesZmax_line_lenZleadZheader0Zheader1Zheader2r)rhr|rjr
�with_line_numbers�sH$

 
,,z pyparsing_test.with_line_numbers)NNTrcNN)
r3r4r5r6r7rb�staticmethodrL�typing�Optional�int�boolr�rrrr
r	shq(r	)
�
contextlibrr��corerrrrrr	rrrr
�<module>s	

Youez - 2016 - github.com/yon3zu
LinuXploit