403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/sphinx/ext/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/sphinx/ext/__pycache__/inheritance_diagram.cpython-39.pyc
a

�ab!C�@s�dZddlZddlZddlZddlmZddlmZmZm	Z	m
Z
mZmZddl
mZddlmZddlmZddlZddlmZdd	lmZdd
lmZddlmZmZmZmZmZddlm Z dd
l!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*e�+dej,�Z-dd�e.e��/�D�Z0e1ed�dd�Z2e1e1ed�dd�Z3Gdd�de4�Z5Gdd�d�Z6Gdd �d e�Z7Gd!d"�d"e"�Z8e7e1d#�d$d%�Z9e&e7dd&�d'd(�Z:e(e7dd&�d)d*�Z;e*e7dd&�d+d,�Z<ej=e7dd&�d-d.�Z>eee1efd/�d0d1�Z?dS)2a[
    sphinx.ext.inheritance_diagram
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Defines a docutils directive for inserting inheritance diagrams.

    Provide the directive with one or more classes or modules (separated
    by whitespace).  For modules, all of the classes in that module will
    be used.

    Example::

       Given the following classes:

       class A: pass
       class B(A): pass
       class C(A): pass
       class D(B, C): pass
       class E(B): pass

       .. inheritance-diagram: D E

       Produces a graph like the following:

                   A
                  / \
                 B   C
                / \ /
               E   D

    The graph is inserted as a PNG+image map into HTML and a PDF in
    LaTeX.

    :copyright: Copyright 2007-2022 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
�N)�
import_module)�Any�Dict�Iterable�List�Tuple�cast)�nodes)�Node)�
directives)�addnodes)�Sphinx)�BuildEnvironment)�figure_wrapper�graphviz�render_dot_html�render_dot_latex�render_dot_texinfo)�md5)�SphinxDirective)�
OptionSpec)�HTMLTranslator)�LaTeXTranslator)�TexinfoTranslatorz�^(?:([\w.]*)\.)?  # module names
                           (\w+)  \s* $          # class/final module name
                           cCsg|]}t�|�r|�qS�)�inspect�isclass)�.0�objrr�B/usr/lib/python3.9/site-packages/sphinx/ext/inheritance_diagram.py�
<listcomp>Bs
�r )�objname�returncCs�z
t|�WStyYdSty�t�|�}|s>YdS|��\}}|durXYdSzt|�}t||d�WYSty�YYdS0Yn0dS)z�Import a object or module using *name* and *currentmodule*.
    *name* should be a relative name from *currentmodule* or
    a fully-qualified name.

    Returns imported object or module.  If failed, returns None value.
    N)r�	TypeError�ImportError�
module_sig_re�match�groups�getattr)r!Zmatched�modname�attrname�modulerrr�
try_importFs 

r,)�name�
currmoduler"cCs�d}|rt|d|�}|dur(t|�}|dur<td|��t�|�rL|gSt�|�r�g}|j��D]$}t�|�rd|j|jkrd|�	|�qd|Std|��dS)z0Import a class using its fully-qualified *name*.N�.zECould not import class or module %r specified for inheritance diagramz=%r specified for inheritance diagram is not a class or module)
r,�InheritanceExceptionrrZismodule�__dict__�values�
__module__�__name__�append)r-r.�target�classes�clsrrr�import_classescs,��

�r9c@seZdZdS)r0N)r4r3�__qualname__rrrrr0�sr0c@s>eZdZdZddddgfeeeeeeeeefee	dd�dd�Z
eeeee	d�d	d
�Zee	eeeeeefee	eeeeeeefd�dd
�Z
d*e	eeeefed�dd�Zeed�dd�Zdddd�Zddddddd�Zdd d!�Zeed"�d#d$�Zeed"�d%d&�Zidiiifeeeeeeed'�d(d)�ZdS)+�InheritanceGraphz�
    Given a list of classes, determines the set of classes that they inherit
    from all the way to the root "object", and then is able to generate a
    graphviz dot graph from them.
    FrN)�class_namesr.�
show_builtins�
private_bases�parts�aliases�top_classesr"c	Cs:||_|�||�}|�||||||�|_|js6td��dS)z�*class_names* is a list of child classes to show bases from.

        If *show_builtins* is True, then Python builtins will be shown
        in the graph.
        z(No classes found for inheritance diagramN)r<�_import_classes�_class_info�
class_infor0)	�selfr<r.r=r>r?r@rAr7rrr�__init__�s�zInheritanceGraph.__init__)r<r.r"cCs"g}|D]}|�t||��q|S)zImport a list of classes.)�extendr9)rEr<r.r7r-rrrrB�sz InheritanceGraph._import_classes)r7r=r>r?r@rAr"c	sDi�tdd���������fdd��|D]}�|�q*t����S)a�Return name and bases for all classes that are ancestors of
        *classes*.

        *parts* gives the number of dotted name parts to include in the
        displayed node names, from right to left. If given as a negative, the
        number of parts to drop from the left. A value of 0 displays the full
        dotted name. E.g. ``sphinx.ext.inheritance_diagram.InheritanceGraph``
        with ``parts=2`` or ``parts=-2`` gets displayed as
        ``inheritance_diagram.InheritanceGraph``, and as
        ``ext.inheritance_diagram.InheritanceGraph`` with ``parts=3`` or
        ``parts=-1``.

        *top_classes* gives the name(s) of the top most ancestor class to
        traverse to. Multiple names can be specified separated by comma.
        N)r8r"cs��s|tvrdS�s$|j�d�r$dS��|���}��|d��}d}z2|jrt|j���d�d}|rtd|�dd�}Wnty�Yn0g}||||f�|<|�vr�dS|j	D]H}�s�|tvr�q��s�|j�d�r�q�|�
��|����|�vr��|�q�dS)N�_r�
�"%s"�"z\")�py_builtinsr4�
startswith�
class_name�__doc__�strip�split�replace�	Exception�	__bases__r5)r8�nodename�fullname�tooltip�docZbaselist�base�r@Zall_classesr?r>�recurserEr=rArrr[�s4
z-InheritanceGraph._class_info.<locals>.recurse)r�listr2)rEr7r=r>r?r@rAr8rrZrrC�s
""
zInheritanceGraph._class_info)r8r?r@r"cCsl|j}|dvr|j}nd||jf}|dkr2|}n|�d�}d�||d��}|durh||vrh||S|S)z�Given a class object, return a fully-qualified name.

        This works for things I've tested in matplotlib so far, but may not be
        completely general.
        )Z__builtin__�builtinsz%s.%srr/N)r3r4r:rQ�join)rEr8r?r@r+rV�resultZ
name_partsrrrrN�s
zInheritanceGraph.class_name�r"cCsdd�|jD�S)z1Get all of the class names involved in the graph.cSsg|]\}}}}|�qSrr)rrHrVrrrr ��z8InheritanceGraph.get_all_class_names.<locals>.<listcomp>)rD)rErrr�get_all_class_names�sz$InheritanceGraph.get_all_class_namesZLRz"8.0, 12.0"Ztransparent)Zrankdir�sizeZbgcolorZbox�
g�?zA"Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans"z"setlinewidth(0.5),filled"Zwhite)�shapeZfontsizeZheightZfontname�styleZ	fillcolorg�?z"setlinewidth(0.5)")Z	arrowsizerf)�attrsr"cCsd�dd�t|���D��S)N�,cSsg|]}d|�qS)z%s=%sr�r�xrrrr raz7InheritanceGraph._format_node_attrs.<locals>.<listcomp>�r^�sorted�items�rErgrrr�_format_node_attrs
sz#InheritanceGraph._format_node_attrscCsd�dd�t|���D��S)N�cSsg|]}d|�qS)z%s=%s;
rrirrrr raz8InheritanceGraph._format_graph_attrs.<locals>.<listcomp>rkrnrrr�_format_graph_attrs
sz$InheritanceGraph._format_graph_attrs)r-�urls�env�graph_attrs�
node_attrs�
edge_attrsr"c
Cs(|j��}|j��}|j��}	|�|�|�|�|	�|�|rj|�|jj�|�|jj�|	�|jj�g}
|
�	d|�|
�	|�
|��t|j�D]|\}}}}
|��}||vr�d|||d<d|d<|
r�|
|d<|
�	d||�
|�f�|D]}|
�	d|||�
|	�f�q�q�|
�	d	�d
�|
�S)aVGenerate a graphviz dot graph from the classes that were passed in
        to __init__.

        *name* is the name of the graph.

        *urls* is a dictionary mapping class names to HTTP URLs.

        *graph_attrs*, *node_attrs*, *edge_attrs* are dictionaries containing
        key/value pairs to pass on as graphviz properties.
        z
digraph %s {
rJZURLz"_top"r6rWz
  "%s" [%s];
z  "%s" -> "%s" [%s];
z}
rp)�default_graph_attrs�copy�default_node_attrs�default_edge_attrs�update�config�inheritance_graph_attrs�inheritance_node_attrs�inheritance_edge_attrsr5rqrlrDror^)rEr-rrrsrtrurvZg_attrsZn_attrsZe_attrs�resrV�basesrWZthis_node_attrs�	base_namerrr�generate_dots>





���

zInheritanceGraph.generate_dot)rN)r4r3r:rOr�str�bool�intrrrFrBrrCrNrbrwryrzrorqrr�rrrrr;�sJ��
�;��
���r;c@seZdZdZdS)�inheritance_diagramzN
    A docutils node to use as a placeholder for the inheritance diagram.
    N)r4r3r:rOrrrrr�@sr�c@sPeZdZUdZdZdZdZdZee	j
e	je	jd�Z
eed<eed�d	d
�ZdS)�InheritanceDiagramzJ
    Run when the inheritance_diagram directive is first encountered.
    F�rT)r?�
private-bases�caption�top-classes�option_specr`c
Cs|t�}|jj|_|jd��}|j�d��d�}|j�	dd�|d<d�
|�|d<g|d<|j�	dd��d	�D]}|��}|rl|d�|�qlz4t
||jj�	d
�|dd|jv|jj|dd�}Wn<t�y�}z"|jjj||jd
�gWYd}~Sd}~00|��D]*}|dd||d|j�\}}	|�|��q||d<d|jv�rV|�|�|gSt|||jd�}
|�|
�|
gSdS)Nr�py�classr?z, �contentr�rprhz	py:moduler�)r?r>r@rA)�linez:class:`%s`�graphr�)r��stateZdocumentZ	argumentsrQrsZ
get_domainZrole�options�getr^rPr5r;Zref_contextr|�inheritance_aliasr0ZreporterZwarning�linenorbrGZadd_namer)rE�noder<Z
class_roler8r��errr-ZrefnodesrjZfigurerrr�runVsB
�
,�

zInheritanceDiagram.runN)r4r3r:rOZhas_contentZrequired_argumentsZoptional_argumentsZfinal_argument_whitespacer�r�flagZ	unchangedZunchanged_requiredr�r�__annotations__rr
r�rrrrr�Gs
�r�)r�r"cCs,|dt|d���}t|���dd�S)Nr�r?i����)r��encoderZ	hexdigest)r�Zencodedrrr�get_graph_hash�sr�)rEr�r"c
Cs |d}t|�}d|}|jjjj��}|jj|jj}i}tt	t
j|�}|D]�}	|	�d�dur�|dkr�d|	�d�||	d<q�|	�d�||	d<qP|	�d�durP|dkr�d|d	|	�d�||	d<qPd	|	�d�||	d<qP|j
|||jjd
�}
t|||
iddd|d
d�tj�dS)zZ
    Output the graph for HTML.  This will insert a PNG with clickable
    image map.
    r��
inheritance%sZrefuriNZSVGz../ZreftitleZrefid�#)rs�inheritancezInheritance diagram of r�)Zalt)r��builderrsr|�graphviz_output_format�upperZcurrent_docnameZ
out_suffixrrrZpending_xrefr�r�rr	�SkipNode)rEr�r��
graph_hashr-r�Zcurrent_filenamerrZ
pending_xrefs�child�dotcoderrr�html_visit_inheritance_diagram�s* 
�r�cCsJ|d}t|�}d|}|j||jjddid�}t|||id�tj�dS)z>
    Output the graph for LaTeX.  This will insert a PDF.
    r�r�rc�	"6.0,6.0"�rsrtr�N)r�r�r�rsrr	r��rEr�r�r�r-r�rrr�latex_visit_inheritance_diagram�s�r�cCsJ|d}t|�}d|}|j||jjddid�}t|||id�tj�dS)z@
    Output the graph for Texinfo.  This will insert a PNG.
    r�r�rcr�r�r�N)r�r�r�rsrr	r�r�rrr�!texinfo_visit_inheritance_diagram�s�r�cCs
tj�dS)N)r	r�)rEr�rrr�skip�sr�)�appr"cCs�|�d�|jttdftdftdftdftdfd�|�dt�|�	did�|�	did�|�	did�|�	did�t
jd	d
�S)Nzsphinx.ext.graphviz)ZlatexZhtml�textZmanZtexinfozinheritance-diagramr}Fr~rr�T)�versionZparallel_read_safe)Zsetup_extensionZadd_noder�r�r�r�r�Z
add_directiver�Zadd_config_value�sphinxZ__display_version__)r�rrr�setup�s
�r�)@rOr]r�re�	importlibr�typingrrrrrrZdocutilsr	Zdocutils.nodesr
Zdocutils.parsers.rstrr�rZsphinx.applicationr
Zsphinx.environmentrZsphinx.ext.graphvizrrrrrZsphinx.utilrZsphinx.util.docutilsrZsphinx.util.typingrZsphinx.writers.htmlrZsphinx.writers.latexrZsphinx.writers.texinfor�compile�VERBOSEr%�varsr2rLr�r,r9rSr0r;r�r�r�r�r�r�ZNodeVisitorr�r�rrrr�<module>sL% �;=!�

Youez - 2016 - github.com/yon3zu
LinuXploit