HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //proc/self/root/usr/lib/python3/dist-packages/automat/__pycache__/_visualize.cpython-38.pyc
U

��Y��@s�ddlmZddlZddlZddlZddlmZdd�Zdd�Zd	d
�Z	e	fdd�Z
eeefd
d�Zej
dej
dd�ejeefdd�ZdS)�)�print_functionN�)�findMachinescCsd�|�dd��S)Nz"{}"�"z\")�format�replace��s�r
�4/usr/lib/python3/dist-packages/automat/_visualize.py�_gvquote
srcCs
d�|�S)Nz<{}>)rrr
r
r�_gvhtmlsr
cOs6d�dd�t|���D��}d�|�}dj|||d�S)z?
    Construct a string from the HTML element description.
    � css&|]\}}d�|tt|���VqdS)z{}={}N)rr�str)�.0�key�valuer
r
r�	<genexpr>s�zelementMaker.<locals>.<genexpr>�z#<{name} {attrs}>{children}</{name}>)�name�attrs�children)�join�sorted�itemsr)rrrZformattedAttrsZformattedChildrenr
r
r�elementMakers

�
�rcs�i}|rtt|��|d<�d�d|dd�fd|d�|��}dd	i���fd
d�|D�}�d|�g}|rx|��d|����d|��S)z>
    Construct an HTML table to label a state transition.
    �colspan�td�fontzmenlo-italic)ZfaceZpurple)�color�portz
point-size�9cs$g|]}�d�d|f��dd��qS)rrZpink)rr
)rZoutputLabel��_EZ	pointSizer
r�
<listcomp>0s����ztableMaker.<locals>.<listcomp>�tr�table)r%)r&)r�len�append)�
inputLabelZoutputLabelsr r#rZinputLabelCellZoutputLabelCellsZrowsr
r"r�
tableMakers,�����r*cstjddd�ddiddid�}|��D]8}||jkr>d}d}nd	}d}|j||�|d
|dd�q&t|���D]�\}}	|	\}
}}}
d
�|�}||�}d}t|�fdd�|
D�|d�}|j|t	|�ddd�|j
||
�d�||�dd�|�
d�||�||��ql|S)zA
    Produce a L{graphviz.Digraph} object from an automaton.
    �trueZ100)ZpackZdpiZfontnameZMenlo)Z
graph_attrZ	node_attrZ	edge_attrZboldz
Menlo-BoldrZellipseZblue)Zfontame�shapeZstylerzt{}Z	tableportcsg|]}�|��qSr
r
)rZoutputSymbol��outputAsStringr
rr$\s�zmakeDigraph.<locals>.<listcomp>)r z0.2Znone)ZlabelZmarginr,z{}:{}:w)Z	arrowheadz{}:{}:e)�graphvizZDigraphZstatesZinitialStateZnode�	enumerateZallTransitionsrr*r
Zedge)Z	automatonZ
inputAsStringr.Z
stateAsString�digraph�stateZ
stateShapeZfontName�nZeachTransitionZinStateZinputSymbolZoutStateZ
outputSymbolsZthisTransitionr)r r&r
r-r�makeDigraph?sR��

�
���

��r4cCsxd}d}|dr|�dd�tj|||d�}|jddd�|jd	d
ddd
d�|jddddd�|jddddd�|jdddtjdd�|jddddd
d�|�|�}|jo�|jp�|j|jk}	|j	r�dd �}||j
�D]�\}
}||
d!�|��}|	�r|jd"�
|
�|jd#�||
d$|j�|jr�|j�p.|	}
|j|_
|jd"�
|
�|j|j|
d%�|
�r`d&}nd'}||
||j�q�d(S))z/
    Entry point for command line utility.
    zB
    Visualize automat.MethodicalMachines as graphviz graphs.
    zz
    You must have the graphviz tool suite installed.  Please visit
    http://www.graphviz.org for more information.
    rr)�progZdescriptionZepilog�fqpnz@A Fully Qualified Path name representing where to find machines.)�helpz--quietz-qzsuppress outputF�
store_true)r7�default�actionz--dot-directoryz-dzWhere to write out .dot files.z.automat_visualize)r7r9z--image-directoryz-izWhere to write out image files.z--image-typez-tzThe image format.Zpng)r7�choicesr9z--viewz-vz.View rendered graphs with default image viewercWsdS)Nr
)�argsr
r
r�_print�sztool.<locals>._printz
...discoveredz{}.dot)�filename�	directoryz...wrote dot into)r>r?�viewZcleanupz...wrote image intoz...wrote image and dot intoN)�insert�argparse�ArgumentParser�add_argumentr/ZFORMATS�
parse_argsZ
dot_directoryZimage_directory�quietr6Z	asDigraphZsaverZ
image_typeZrenderr@)Z	_prognameZ_argvZ_syspathZ
_findMachinesr=ZDESCRIPTIONZEPILOGZargumentParserr<ZexplicitlySaveDotr6�machiner1Z	deleteDot�msgr
r
r�toolls|	�������

�
��rI)Z
__future__rrB�sysr/Z	_discoverrrr
rr*�reprr4�argv�path�printrIr
r
r
r�<module>s$
 �
-�