403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.60
Web Server : Apache/2.4.62 (Ubuntu)
System : Linux rasin.ddns.net 6.8.0-124-generic #124~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 21:05:19 UTC x86_64
User : www-data ( 33)
PHP Version : 8.4.22
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/share/inkscape/extensions/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/share/inkscape/extensions/__pycache__/render_barcode_datamatrix.cpython-310.pyc
o

5�a~M�@sJdZddlZddlmZdZidd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd �d!d"�d#d$�d%d&�d'd(d)d*d+d,d-d.d/d0d1d2d3d4�
�Zd5d6�Zd7d8�Zd9d:�Zd;d<�Zd=d>�Z	d?d@�Z
dAdB�ZdCdD�ZdEdF�Z
dGdH�ZdIdJ�ZdKdL�ZdMdN�ZdOdP�ZdQdR�ZGdSdT�dTej�ZedUkr�e���dSdS)Va
This extension renders a DataMatrix 2D barcode, as specified in
BS ISO/IEC 16022:2006. Only ECC200 codes are considered, as these are the only
ones recommended for an "open" system.

The size of the DataMatrix is variable between 10x10 to 144x144

The absolute size of the DataMatrix modules (the little squares) is also
variable.

If more data is given than can be contained in one DataMatrix,
more than one DataMatrices will be produced.

Text is encoded as ASCII (the standard provides for other options, but these are
not implemented). Consecutive digits are encoded in a compressed form, halving
the space required to store them.

The basis processing flow is;
    * Convert input string to codewords (modified ASCII and compressed digits)
    * Split codewords into blocks of the right size for Reed-Solomon coding
    * Interleave the blocks if required
    * Apply Reed-Solomon coding
    * De-interleave the blocks if required
    * Place the codewords into the matrix bit by bit
    * Render the modules in the matrix as squares
�N)�	Rectangle��sq10)	�
r�r�r��r�sq12)	�rrrrrr	�r�sq14)	�rrrrrrrr�sq16)	�rrrrrrrr�sq18)	�rrrrrrrr�sq20)	�rrrrr�rr�sq22)	rrrrrr�rr�sq24)	�rrrrr�$rr�sq26)	�rrrrr�,�r�sq32)	� r rrrr�>rr�sq36)	rrrrrr�V�*r�sq40)	�(r&rrrr�r�0r�sq44)	rrrrrr��8r�sq48)	r(r(rrrr��Dr�sq52)	�4r0rrrr�fr$r�sq64)	�@r3rr�r4�r+r�sq72)	�Hr7rrr4r4�\rr4)	�Pr9rrr4r4r'r(r4)	�Xr:rrr4r4r*r+r4)	�`r;rrr4r4r-r.r4)	�hr<rrr4r4�r+�)	�xr?rrr>r>�r.r>)	�rArrr>r>�r!r)	r*r*rrr>r>rrr)	rrr>rrrr	rr)	rr r>rrrr�r)	rrrrrrrrr)	rrrrrrrrr)	rrrrrrr rr)	rr(rrrr�1rr)
�sq80�sq88�sq96�sq104�sq120�sq132�sq144�rect8x18�rect8x32�	rect12x26�	rect12x36�	rect16x36�	rect16x48cCs�tt|��}|s$t|||�}t||�}t|||�}t||||d�}|St|d�}tt|��D]K}d}d}d}||dd�}t|g|�}t|||�}d}d	}d}||dd�}	t|	g|�}	t|	||�}	|}
|
�|	�t|
d
||d�}
|
d||<q/|S)NF�r�r!ri�r�rT)	�list�encode_to_ascii�partition_data�
interleave�reed_solomon�combine_interleaved�range�len�extend)�text�nd�nc�inter�size144�data�data_blocks�i�block1�block2�blocks�ri�;/usr/share/inkscape/extensions/render_barcode_datamatrix.py�
get_codewordsgs4

�
rkcs�|dkr|Sg}|D]4}tt|�|���fdd�t|�D�}t��D]}t|�D]}|||||||<q)q#|�|�q
|S)Nrc�g|]}dg��qS�rri��.0re��block_lengthrirj�
<listcomp>��zinterleave.<locals>.<listcomp>)�intr\r[r])rhra�result�block�inter_blocksre�jrirprjrX�s�rXcCs�|dkr|Sg}tt|�|�D]J}g}|rd}d}	n||}||}	t|�D]}
|�||||
||
|�q't|	�D]}
|�||||
|||
|�q?|�|�q|S)NrrRil)r[r\�append)rhrar_r`rbrure�data_codewords�nd_range�nc_rangerxririrjrZ�s $(rZccs��d}|t|�krH||��r3|t|�dkr3||d��r3t||||d�dV|d7}n
t||�dV|d7}|t|�ks	dSdS)z-Encode this text into chunks, ascii or digitsrr�rN)r\�isdigitrt�ord)r^reririrjrV�s�,
�rVcCs�d}g}d}|t|�krbt|�||kr$|�||||��||}n8||t|��}t|�}d}t|�|krT|sB|�|�d}n|�t||��|d7}t|�|ks8|�|�	|S|t|�ks|S)N�rFTr)r\ry�randomise_pad_253)rc�rs_data�PAD_VALrdre�
data_block�pad_pos�paddedririrjrW�s,

�
�rWcCs,d|dd}||}|dkr|S|dS)N��r�ri)�	pad_value�pad_position�pseudo_random_number�
randomisedririrjr��s
r�cCs4|dks|dkr
dS||||||d}|S�Nrrri)�x�y�log�alog�gfruririrj�prod�sr�cCs|dg|}dg|}d||d<d|d<td|�D] }||dd||<|||kr3|||A||<||||<q||fS)Nrrr�r[)r��ppr�r�reririrj�gen_log_alogs

r�cCs�dg|d}d|d<td|d�D]<}||d||<|d}|dkr@||dt|||||||�A||<|d8}|dks$t|d|||||�|d<q|Sr�)r[r�)r`r�r�r��crerxririrj�gen_poly_coeffss(�r�c
Cs�d}d}t||�\}}t||||�}|D]B}|�dg|d�td|�D],}	||||	A}
td|�D]}|||dt|
|||d|||�A|||<q4q%|��q|S)N�i-rr)r�r�r]r[r��pop)rcr_r`r�r�r�r�r�rvre�krxririrjrY)s6�
rYcCs|d|?dS)z(bit() returns the bit'th bit of the byterrri)�byte�bit_chririrj�bitEsr�cCsX|dkr||}|d|dd}|dkr$||}|d|dd}||||<dS)z8place a given bit with appropriate wrapping within arrayrr4rNri)�array�nrow�ncol�row�colr�ririrj�moduleKsr�c
Cs�td�D]�}|ddf|ddf|ddfd|dfd|dfd|dfd|dfd|dfg|ddf|ddf|ddfd|dfd|dfd|dfd|dfd|dfg|ddf|ddf|ddfd|dfd|dfd|dfd|dfd|dfg|ddf|d|dfd|dfd|dfd|dfd|dfd|dfd|dfg|d|df|d|df|d|df|d|df|d|f||df||df||fgg||\}}	t|||||	t||d��qdS)z.Populate corner cases (0-3) and utah case (-1)rrrrrr4)r[r�r�)
�caser�r�r�r�r��charrer�r�ririrj�place_squareXs.((�((�((�,(�8$��
�
�r�c
s��fdd�t|�D�}d}d}d}	||kr)|dkr)|td||�|�||�7}nZ||dkrF|dkrF�drF|td||�|�||�7}n=||dkre|dkre�ddkre|td||�|�||�7}n||dkr�|dkr��ddkr�|td	||�|�||�7}|dkr�|�kr�||kr�|dkr�|||tkr�|td
||�||||�7}|d8}|d7}|dkr�|�ks�|d7}|d	7}||kr�|dkr�|dkr�|�kr�|||tkr�|td
||�||||�7}|d7}|d8}||kr�|dks�|d	7}|d7}||k�s
|�k�s
nq||d�dtk�r@d||d�d<d||d�d<d||d�d<d||d�d<|S)zCfill an nrow x ncol array with the bits from the codewords in data.csg|]}tg��qSri)�INVALID_BITrn�r�rirjrrorszplace_bits.<locals>.<listcomp>rr4Trrrr���)r[r�r�)rcr�r�r�r�r�r�rir�rj�
place_bitslsL   � ��%r�cs6|d|}|d|��fdd�t|�D�}t|�D]#}t|�D]}d||||d<|d||||d|d<q!qt|�D]%}t��D]}d|||d|d|<|dd|||d|<qIqCt||�D])}t||�D] }|dd||}	|dd||}
|||||
|	<qwqo|S)Nrcrlrmrirnr�rirjrr�rsz&add_finder_pattern.<locals>.<listcomp>rr�)r��	data_nrow�	data_ncol�reg_row�reg_colr��
datamatrixrerx�dest_col�dest_rowrir�rj�add_finder_pattern�s("���r�c@s<eZdZdZdd�Zedd��Zdd�Zdd�Zd	d
�Z	dS)�
DataMatrixcCs4|jddd�|jd|jdd�|jdtdd	�dS)
Nz--text�Inkscape)�defaultz--symbolT)�type�requiredz--sizer4)r�r�)�add_argument�arg_symbolsrt)�self�parsririrj�
add_arguments�szDataMatrix.add_argumentscCs$zt|WStyt�d��w)z%Turn a symbol key into matrix metricszInvalid symbol size.)�SYMBOLS�KeyError�inkex�AbortExtension)�valueririrjr��s


�zDataMatrix.arg_symbolsccs��t|jj�}t�dddd��}t|�||d�}|jjs!t�d��|j|jjg|jj�R�}|�	|�D]\}}|�
t|�t|�d��tdi|��Vq3dS)	N�none�1z#000000)�strokezstroke-width�fill)�style�height�widthzPlease enter an input string.)r�r�ri)�str�options�sizer��Styler^r��encode�symbol�render_data_matrix�updater)r�r�r��attribs�encodedr�r�ririrj�generate�s�
�zDataMatrix.generatec	CsPt|||	|
|dk�}g}|D]}
t|
||||�}|�t|||||��q|S)z�
        Take an input string and convert it to a sequence (or sequences)
        of codewords as specified in ISO/IEC 16022:2006 (section 5.2.3)
        r*)rkr�ryr�)r�r^r�r�r�r�r�r�r_r`ra�	codewords�
module_arrays�codeword_stream�	bit_arrayririrjr��szDataMatrix.encodec	cs��|jjd}|jj}||d}t|�D]F\}}t|�}t|d�}t|�D]3}	t|�D],}
||	|
dkrE|
||||	|fVq-||	|
tkrYt�d�	||	|
��q-q'qdS)z:turn a 2D array of 1's and 0's into a set of black squaresrg�?rzInvalid bit value, {}!N)
r�r�r��	enumerater\r[r�r��errormsg�format)r�r�r�r��spacingre�liner�r�r�r�ririrjr��s"�����zDataMatrix.render_data_matrixN)
�__name__�
__module__�__qualname__�container_labelr��staticmethodr�r�r�r�riririrjr��s
r��__main__)�__doc__r�rr�r�rkrXrZrVrWr�r�r�r�rYr�r�r�r�r��GenerateExtensionr�r��runriririrj�<module>s�
�������	�
���
�������+,	
6@�

Youez - 2016 - github.com/yon3zu
LinuXploit