403Webshell
Server IP : 93.86.61.54  /  Your IP : 216.73.216.156
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/lib/python3/dist-packages/scour/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/scour/__pycache__/svg_regex.cpython-310.pyc
o

p�_$,�@s�dZddlmZddlZddlmZmZddlmZGdd�de	�Z
e
�Zgd�ZGd	d
�d
e	�Z
e
e�ZGdd�de	�Ze�ZdS)
a� Small hand-written recursive descent parser for SVG <path> data.


In [1]: from svg_regex import svg_parser

In [3]: svg_parser.parse('M 10,20 30,40V50 60 70')
Out[3]: [('M', [(10.0, 20.0), (30.0, 40.0)]), ('V', [50.0, 60.0, 70.0])]

In [4]: svg_parser.parse('M 0.6051.5')  # An edge case
Out[4]: [('M', [(0.60509999999999997, 0.5)])]

In [5]: svg_parser.parse('M 100-200')  # Another edge case
Out[5]: [('M', [(100.0, -200.0)])]
�)�absolute_importN)�Decimal�
getcontext)�partialc@seZdZdd�ZdS)�_EOFcCsdS)N�EOF�)�selfrr�1/usr/lib/python3/dist-packages/scour/svg_regex.py�__repr__8sz
_EOF.__repr__N)�__name__�
__module__�__qualname__rrrrr
r6sr))�floatz=[-+]?(?:(?:[0-9]*\.[0-9]+)|(?:[0-9]+\.?))(?:[Ee][-+]?[0-9]+)?)�intz[-+]?[0-9]+)�commandz[AaCcHhLlMmQqSsTtVvZz]c@s eZdZdZdd�Zdd�ZdS)�Lexera Break SVG path data into tokens.

    The SVG spec requires that tokens are greedy. This lexer relies on Python's
    regexes defaulting to greediness.

    This style of implementation was inspired by this article:

        http://www.gooli.org/blog/a-simple-lexer-in-python/
    cCsH||_g}|D]
\}}|�d||f�qd�|�|_t�|j�|_dS)Nz
(?P<%s>%s)�|)�lexicon�append�join�regex_string�re�compile�regex)r	r�parts�namerrrr
�__init__PszLexer.__init__ccsR�|j�|�D]}|jD]\}}|�|�}|dur ||fVnqqtdfVdS)z� Yield (token_type, str_data) tokens.

        The last token will be (EOF, None) where EOF is the singleton object
        defined in this module.
        N)r�finditerr�groupr)r	�text�matchr�_�mrrr
�lexXs�

��z	Lexer.lexN)rr
r�__doc__rr$rrrr
rEs
rc@steZdZdZefdd�Zdd�Zdd�Zdd	�Zd
d�Z	dd
�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�ZdS)�
SVGPathParseraq Parse SVG <path> data into a list of commands.

    Each distinct command will take the form of a tuple (command, data). The
    `command` is just the character string that starts the command group in the
    <path> data, so 'M' for absolute moveto, 'm' for relative moveto, 'Z' for
    closepath, etc. The kind of data it carries with it depends on the command.
    For 'Z' (closepath), it's just None. The others are lists of individual
    argument groups. Multiple elements in these lists usually mean to repeat the
    command. The notable exception is 'M' (moveto) where only the first element
    is truly a moveto. The remainder are implicit linetos.

    See the SVG documentation for the interpretation of the individual elements
    for each command.

    The main method is `parse(text)`. It can only consume actual strings, not
    filelike objects or iterators.
    cCs�||_id|j�d|j�d|j�d|j�d|j�d|j�d|j�d|j�d	|j�d
|j�d|j�d|j�d
|j�d|j�d|j�d|j�d|j�|j|j|jd��|_t	ddg�|_
dS)N�Z�z�Mr#�L�l�H�h�V�v�C�c�S�s�Q�q�T)�t�A�arr)�lexer�rule_closepath�rule_moveto_or_lineto�rule_orthogonal_lineto�
rule_curveto3�
rule_curveto2�
rule_curveto1�rule_elliptical_arc�command_dispatch�list�
number_tokens)r	r:rrr
r}sR��������	�
���
�����
�zSVGPathParser.__init__cCs0|j�|�}ttg|f�R�}|�}|�||�S)z, Parse a string of SVG <path> data.
        )r:r$r�next�
rule_svg_path)r	r �gen�next_val_fn�tokenrrr
�parse�szSVGPathParser.parsecCs`g}|dtur.|ddkrtd|f��|j|d}|||�\}}|�|�|dtus|S)Nrrzexpecting a command; got %r�)r�SyntaxErrorrBr)r	rHrI�commands�rule�
command_grouprrr
rF�s
�zSVGPathParser.rule_svg_pathcCs|d}|�}|gf|fS)NrKr)r	rHrIrrrr
r;�szSVGPathParser.rule_closepathcC�T|d}|�}g}|d|jvr$|�||�\}}|�|�|d|jvs||f|fS�NrKr�rD�rule_coordinate_pair�extend)r	rHrIr�coordinates�pairrrr
r<��
�z#SVGPathParser.rule_moveto_or_linetocCrPrQ)rD�rule_coordinater)r	rHrIrrU�coordrrr
r=�rWz$SVGPathParser.rule_orthogonal_linetocCs�|d}|�}g}|d|jvr>|�||�\}}|�||�\}}|�||�\}}|�|�|�|�|�|�|d|jvs||f|fSrQrR)r	rHrIrrU�pair1�pair2�pair3rrr
r>�s


�zSVGPathParser.rule_curveto3cCsn|d}|�}g}|d|jvr1|�||�\}}|�||�\}}|�|�|�|�|d|jvs||f|fSrQrR)r	rHrIrrUrZr[rrr
r?�s

�zSVGPathParser.rule_curveto2cCrPrQrR)r	rHrIrrUrZrrr
r@�rWzSVGPathParser.rule_curveto1c	Cs2|d}|�}g}|d|jv�rt|d�d}|td�kr&td|f��|�}|d|jvr7td|f��t|d�d}|td�krLtd|f��|�}|d|jvr]td|f��t|d�d}|�}|dddvrwtd|f��t|dd�d}t|d�dkr�t|�}|ddd�|d<n|�}|dddvr�td|f��t|dd�d}	t|d�dkr�t|�}|ddd�|d<n|�}|d|jvr�td|f��t|d�d}
|�}|d|jvr�td|f��t|d�d}|�}|�|||||	|
|g�|d|jvs||f|fS)NrKrz0.0z&expecting a nonnegative number; got %r�expecting a number; got %r)�0�1z expecting a boolean flag; got %r)rDrrL�lenrCrT)r	rHrIr�	arguments�rx�ry�
axis_rotation�large_arc_flag�
sweep_flag�x�yrrr
rA�sV�0z!SVGPathParser.rule_elliptical_arccCs:|d|jvrtd|f��t��|d�}|�}||fS�Nrr]rK�rDrLr�create_decimal)r	rHrIrgrrr
rXs
zSVGPathParser.rule_coordinatecCsp|d|jvrtd|f��t��|d�}|�}|d|jvr'td|f��t��|d�}|�}||g|fSrirj)r	rHrIrgrhrrr
rS!sz"SVGPathParser.rule_coordinate_pairN)rr
rr%�	svg_lexerrrJrFr;r<r=r>r?r@rArXrSrrrr
r&js
		
	6r&)r%�
__future__rr�decimalrr�	functoolsr�objectrrrrrlr&�
svg_parserrrrr
�<module>s"
E

Youez - 2016 - github.com/yon3zu
LinuXploit