add-determinism 0.7.3

RPM buildroot helper to strip nondeterministic bits in files
Documentation
f

��_?Rc
@s�dZdZdZddlZddlZddlmZmZddlTddl	m
Z
d	d
�ee
�D�gd�Z[
ze
WneyzeZ
Yn0dd
�Zdd�Zdd�Zdd�ZdZdZeede�ee�ZdZdZdZdZedd�Zeeeee�ZdZedd�ee�Zd eZeee�Z ed!e d"�Z!ee!e e�Z"d#Z#d$Z$d%Z%d&Z&d'Z'ee'd(e'd)�Z(ee'd*e'd+�Z)ed,d-d.d/d0d1d2d3d4�	Z*d5Z+ed6d7d8�Z,ee*e+e,�Z-ee"e-e)e�Z.ee.Z/ee'd9ed:d�e'd;ed<d��Z0edee(�Z1eee1e"e-e0e�Z2e3ej4e/e2e%e&f�\Z5Z6Z7Z8ed=d>d?d@�ed=d>dAdB�BhdC�BZ9e�4e#�e�4e$�e7e8dD�dEdF�e9D��dGdF�e9D��dHdF�e9D��Z:d(d)hdIdJ�e9D�BdKdJ�e9D�BZ;d:d<hdLdJ�e9D�BdMdJ�e9D�BZ<dNZ=GdOdP�dPe>�Z?GdQdR�dRe>�Z@dSdT�ZAeAfdUdV�ZBdWdX�ZCGdYdZ�dZ�ZDe�4d[ejE�ZFe�4d\ejE�ZGd]d^�ZHd_d`�ZIdadb�ZJdcdd�ZKeLdek�r�ddlMZMeNeMjO�dk�r|eBePeMjOd�jQ�neBeMjRjQ�dS)fa�Tokenization help for Python programs.

generate_tokens(readline) is a generator that breaks a stream of
text into Python tokens.  It accepts a readline-like method which is called
repeatedly to get the next line of input (or "" for EOF).  It generates
5-tuples with these members:

    the token type (see token.py)
    the token (a string)
    the starting (row, column) indices of the token (a 2-tuple of ints)
    the ending (row, column) indices of the token (a 2-tuple of ints)
    the original line (string)

It is designed to match the working of the Python tokenizer exactly, except
that it produces COMMENT tokens for comments and gives type OP for all
operators

Older entry points
    tokenize_loop(readline, tokeneater)
    tokenize(readline, tokeneater=printtoken)
are the same, except instead of generating tokens, tokeneater is a callback
function to which the 5 fields described above are passed as 5 arguments,
each time a new token is found.zKa-Ping Yee <ping@lfw.org>z@GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, Skip Montanaro�N)�BOM_UTF8�lookup)�*�)�tokencCsg|]}|ddkr|�qS)r�_�)�.0�xrr�//usr/lib64/python3.10/lib2to3/pgen2/tokenize.py�
<listcomp>%�r)�tokenize�generate_tokens�
untokenizecGsdd�|�dS)Nz(z|z))�join�Zchoicesrrr
�group0rrcG�t|�dS)Nr�rrrrr
�any1rrcGr)Nz?rrrrr
�maybe2rrcst�fdd��D��S)Nc3s4|],}�dD]}|��|��kr||VqqdS))�N)Zcasefold)rr	Zy�Zlrr
Z	<genexpr>4sz _combinations.<locals>.<genexpr>)Zsetrrrr
�
_combinations3s�rz[ \f\t]*z	#[^\r\n]*z\\\r?\nz\w+z0[bB]_?[01]+(?:_[01]+)*z(0[xX]_?[\da-fA-F]+(?:_[\da-fA-F]+)*[lL]?z0[oO]?_?[0-7]+(?:_[0-7]+)*[lL]?z[1-9]\d*(?:_\d+)*[lL]?z0[lL]?z[eE][-+]?\d+(?:_\d+)*z\d+(?:_\d+)*\.(?:\d+(?:_\d+)*)?z\.\d+(?:_\d+)*z\d+(?:_\d+)*z\d+(?:_\d+)*[jJ]z[jJ]z[^'\\]*(?:\\.[^'\\]*)*'z[^"\\]*(?:\\.[^"\\]*)*"z%[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''z%[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""z'(?:[uUrRbBfF]|[rR][fFbB]|[fFbBuU][rR])?�'''�"""z'[^\n'\\]*(?:\\.[^\n'\\]*)*'z"[^\n"\\]*(?:\\.[^\n"\\]*)*"z\*\*=?z>>=?z<<=?z<>z!=z//=?z->z[+\-*/%&@|^=<>]=?z~z[][(){}]z\r?\nz:=z[:;.,`@]z'[^\n'\\]*(?:\\.[^\n'\\]*)*�'z"[^\n"\\]*(?:\\.[^\n"\\]*)*�"ZrZRZfZFZbZB>ZUZUrZurZURZuZuR)rrrrcC�i|]}|�d�t�qS�r)�single3prog�rZprefixrrr
�
<dictcomp>yrr"cCr�r)�double3progr!rrr
r"zrcCsi|]
}|d�qS�Nrr!rrr
r"{rcC�h|]}|�d��qSrrr!rrr
�	<setcomp>rr'cCr&r#rr!rrr
r'�rcCr&)rrr!rrr
r'�rcCr&)rrr!rrr
r'�ric@�eZdZdS)�
TokenErrorN��__name__�
__module__�__qualname__rrrr
r)�rr)c@r()�StopTokenizingNr*rrrr
r.�rr.c		Cs4|\}}|\}}td||||t|t|�f�dS)Nz%d,%d-%d,%d:	%s	%s)ZprintZtok_nameZrepr)	ZtyperZxxx_todo_changemeZxxx_todo_changeme1�lineZsrowZscolZerowZecolrrr
�
printtoken�s
�r0cCs&zt||�Wnty Yn0dS)a:
    The tokenize() function accepts two parameters: one representing the
    input stream, and one providing an output mechanism for tokenize().

    The first parameter, readline, must be a callable object which provides
    the same interface as the readline() method of built-in file objects.
    Each call to the function should return one line of input as a string.

    The second parameter, tokeneater, must also be a callable object. It is
    called once for each token, with five arguments, corresponding to the
    tuples generated by generate_tokens().
    N)�
tokenize_loopr.)�readline�
tokeneaterrrr
r
�s
r
cCst|�D]}||�qdSr%)r)r2r3Z
token_inforrr
r1�sr1c@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�UntokenizercCsg|_d|_d|_dS)Nrr)�tokens�prev_row�prev_col)�selfrrr
�__init__�szUntokenizer.__init__cCs*|\}}||j}|r&|j�d|�dS)N� )r7r5�append)r8�startZrowZcolZ
col_offsetrrr
�add_whitespace�s
zUntokenizer.add_whitespacecCs�|D]p}t|�dkr$|�||�qv|\}}}}}|�|�|j�|�|\|_|_|ttfvr|jd7_d|_qd�	|j�S)N�rrr)
�len�compatr=r5r;r6r7�NEWLINE�NLr)r8�iterableZtZtok_typerr<�endr/rrr
r�s
zUntokenizer.untokenizec	Cs�d}g}|jj}|\}}|ttfvr,|d7}|ttfvr<d}|D]�}|dd�\}}|ttttfvrl|d7}|tkr�|�|�q@n>|t	kr�|�
�q@n*|ttfvr�d}n|r�|r�||d�d}||�q@dS)NFr:Tr>�����)r5r;�NAME�NUMBERrArB�ASYNC�AWAIT�INDENT�DEDENTZpop)	r8rrCZ	startline�indentsZtoks_appendZtoknumZtokval�tokrrr
r@�s0
zUntokenizer.compatN)r+r,r-r9r=rr@rrrr
r4�sr4z&^[ \t\f]*#.*?coding[:=][ \t]*([-\w.]+)s^[ \t\f]*(?:[#\r\n]|$)cCsH|dd����dd�}|dks*|�d�r.dS|dvs@|�d�rDd	S|S)
z(Imitates get_normal_name in tokenizer.c.Nirz-�utf-8zutf-8-)zlatin-1�
iso-8859-1ziso-latin-1)zlatin-1-ziso-8859-1-ziso-latin-1-rO)ZlowerZreplace�
startswith)Zorig_encZencrrr
�_get_normal_name�s�rQcs�d�d}d}�fdd�}�fdd�}|�}|�t�rHd�|d	d�}d
}|sT|gfS||�}|rj||gfSt�|�s~||gfS|�}|s�||gfS||�}|r�|||gfS|||gfS)a
    The detect_encoding() function is used to detect the encoding that should
    be used to decode a Python source file. It requires one argument, readline,
    in the same way as the tokenize() generator.

    It will call readline a maximum of twice, and return the encoding used
    (as a string) and a list of any lines (left as bytes) it has read
    in.

    It detects the encoding from the presence of a utf-8 bom or an encoding
    cookie as specified in pep-0263. If both a bom and a cookie are present, but
    disagree, a SyntaxError will be raised. If the encoding cookie is an invalid
    charset, raise a SyntaxError.  Note that if a utf-8 bom is found,
    'utf-8-sig' is returned.

    If no encoding is specified, then the default of 'utf-8' will be returned.
    FNrNcs"z��WSty t�YS0r%)�
StopIteration�bytesr)r2rr
�read_or_stopsz%detect_encoding.<locals>.read_or_stopcs�z|�d�}Wnty"YdS0t�|�}|s6dSt|�d��}zt|�}Wntyntd|��Yn0�r�|j	dkr�td��|d7}|S)NZasciirzunknown encoding: rNzencoding problem: utf-8z-sig)
ZdecodeZUnicodeDecodeError�	cookie_re�matchrQrrZLookupErrorZSyntaxErrorZname)r/Zline_stringrV�encodingZcodec)�	bom_foundrr
�find_cookies"

z$detect_encoding.<locals>.find_cookieT�z	utf-8-sig)rPr�blank_rerV)r2rWZdefaultrTrYZfirstZsecondr)rXr2r
�detect_encoding�s0




r\cCst�}|�|�S)a�Transform tokens back into Python source code.

    Each element returned by the iterable must be a token sequence
    with at least two elements, a token number and token value.  If
    only two tokens are passed, the resulting output is poor.

    Round-trip invariant for full input:
        Untokenized source will match input source exactly

    Round-trip invariant for limited input:
        # Output text will tokenize the back to the input
        t1 = [tok[:2] for tok in generate_tokens(f.readline)]
        newcode = untokenize(t1)
        readline = iter(newcode.splitlines(1)).next
        t2 = [tok[:2] for tokin generate_tokens(readline)]
        assert t1 == t2
    )r4r)rCZutrrr
r:srccs|d}}}d\}}d}dg}d}d}	d}
d}z
|�}WntyNd}Yn0|d}dt|�}
}|�r4|sztd|��|�|�}|r�|�d�}
}t||d|�|||f||fVd\}}d}�n�|�r|dd�d	k�r|d
d�dk�rt||||t|�f|fVd}d}q.�nX||}||}q.�nB|dk�r^|�s^|�sN�q$d}|
|k�r�||
dk�rt|d}n8||
d
k�r�|tdt}n||
dk�r�d}n�q�|
d}
�qR|
|k�rƐq$|�r�|Vd}||
dv�r�||
dk�rV||
d��d�}|
t|�}t	|||
f||
t|�f|fVt
||d�||f|t|�f|fVq.t
t	f||
dk||
d�||
f|t|�f|fVq.||dk�r�|�|�t|d|
�|df||
f|fV||dk�r6||v�r�t
dd||
|f��|dd�}|	�r|
|dk�rd}	d}d}
td||
f||
f|fV�q�|	�rv|�rv|
|dk�rvd}	d}d}
n|�srtd|df��d}|
|kr.t�||
�}|�r�|�d�\}}||f||f|}}}
|||�||}}|tjv�s�|dk�r|dk�rt||||fV�n|dv�rLt}|dk�rt
}n
|	�r(d}|�r8|Vd}|||||fV�n�|dk�rz|�rf|Vd}t	||||fV�n�|tv�r�t|}|�||
�}|�r�|�d�}
|||
�}|�r�|Vd}t||||
f|fV�n||f}||d�}|}q.�n$|tv�s(|dd�tv�s(|dd�tv�r�|ddk�r~||f}t|�p`t|d�p`t|d}||d�d}}|}q.�nt|�r�|Vd}t||||fV�n||���rx|dv�r�|	�r�|dk�r�tnt||||fV�qvt||||f}|dk�r|�s|}�qv|dk�r`|�r`|dtk�r`|ddk�r`d}	|d}
t|d|d|d|dfVd}|�rp|Vd}|Vn�|dk�r�|�r�|Vd}t
||||
f|fVd}nr|d v�r�|d}n|d!v�r�|d}|�r�|Vd}t||||fV�qvt||
||
f||
df|fV|
d}
�qvq.|�r4|Vd}|dd�D]}td|df|dfdfV�q@td|df|dfdfVdS)"a4
    The generate_tokens() generator requires one argument, readline, which
    must be a callable object which provides the same interface as the
    readline() method of built-in file objects. Each call to the function
    should return one line of input as a string.  Alternately, readline
    can be a callable function terminating with StopIteration:
        readline = open(myfile).next    # Example of alternate readline

    The generator produces 5-tuples with these members: the token type; the
    token string; a 2-tuple (srow, scol) of ints specifying the row and
    column where the token begins in the source; a 2-tuple (erow, ecol) of
    ints specifying the row and column where the token ends in the source;
    and the line on which the token was found. The line passed is the
    physical line.
    r)rrNFrrzEOF in multi-line stringi����z\
i����z\
r:z	zz#
z#z
rEz3unindent does not match any outer indentation levelz
<tokenize>zEOF in multi-line statementZ.Tr>rZZ
)�asyncZawaitr]Zdefiz\z([{z)]})rRr?r)rVrDZSTRINGZ
ERRORTOKEN�tabsizeZrstripZCOMMENTrBr;rJZIndentationErrorrK�
pseudoprogZspan�stringZdigitsrGrA�
triple_quoted�endprogs�
single_quotedZisidentifierrHrIrFZOPZ	ENDMARKER)r2ZlnumZparenlevZ	continuedZcontstrZneedcontZcontlinerLZstashedZ	async_defZasync_def_indentZasync_def_nlr/ZposZmaxZstrstartZendprogZendmatchrDZcolumnZ
comment_tokenZnl_posZpseudomatchr<ZsposZeposrZinitialZnewlinerMZindentrrr
rOs�



�*�

 ���
 

���





��
�

�

�
��
�rZ__main__)SZ__doc__Z
__author__Z__credits__r`ZreZcodecsrrZlib2to3.pgen2.tokenrrZdirZ__all__rSZ	NameErrorZstrrrrrZ
WhitespaceZCommentZIgnoreZNameZ	BinnumberZ	HexnumberZ	OctnumberZ	DecnumberZ	IntnumberZExponentZ
PointfloatZExpfloatZFloatnumberZ
ImagnumberZNumberZSingleZDoubleZSingle3ZDouble3Z
_litprefixZTripleZStringZOperatorZBracketZSpecialZFunnyZ
PlainTokenZTokenZContStrZPseudoExtrasZPseudoTokenZmapZcompileZ	tokenprogr_r r$Z_strprefixesrbrarcr^Z	Exceptionr)r.r0r
r1r4ZASCIIrUr[rQr\rrr+Zsysr?ZargvZopenr2Zstdinrrrr
Z<module>s��


�������������������8Ib
&