File: __init__.py

package info (click to toggle)
python-graphviz 0.20.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,188 kB
  • sloc: python: 4,098; makefile: 13
file content (109 lines) | stat: -rw-r--r-- 3,504 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# graphviz - create dot, save, render, view

"""Assemble DOT source code and render it with Graphviz.

Example:
    >>> import graphviz  # doctest: +NO_EXE
    >>> dot = graphviz.Digraph(comment='The Round Table')

    >>> dot.node('A', 'King Arthur')
    >>> dot.node('B', 'Sir Bedevere the Wise')
    >>> dot.node('L', 'Sir Lancelot the Brave')

    >>> dot.edges(['AB', 'AL'])

    >>> dot.edge('B', 'L', constraint='false')

    >>> print(dot)  #doctest: +NORMALIZE_WHITESPACE
    // The Round Table
    digraph {
        A [label="King Arthur"]
        B [label="Sir Bedevere the Wise"]
        L [label="Sir Lancelot the Brave"]
        A -> B
        A -> L
        B -> L [constraint=false]
    }
"""

from ._defaults import set_default_engine, set_default_format, set_jupyter_format

from .backend import (DOT_BINARY, UNFLATTEN_BINARY,
                      render, pipe, pipe_string, pipe_lines, pipe_lines_string,
                      unflatten, version, view)
from .exceptions import (ExecutableNotFound, CalledProcessError,
                         RequiredArgumentError, FileExistsError,
                         UnknownSuffixWarning, FormatSuffixMismatchWarning,
                         DotSyntaxWarning)
from .graphs import Graph, Digraph
from .jupyter_integration import SUPPORTED_JUPYTER_FORMATS
from .parameters import ENGINES, FORMATS, RENDERERS, FORMATTERS
from .quoting import escape, nohtml
from .sources import Source

__all__ = ['ENGINES', 'FORMATS', 'RENDERERS', 'FORMATTERS',
           'DOT_BINARY', 'UNFLATTEN_BINARY',
           'SUPPORTED_JUPYTER_FORMATS',
           'Graph', 'Digraph',
           'Source',
           'escape', 'nohtml',
           'render', 'pipe', 'pipe_string', 'pipe_lines', 'pipe_lines_string',
           'unflatten', 'version', 'view',
           'ExecutableNotFound', 'CalledProcessError',
           'RequiredArgumentError', 'FileExistsError',
           'UnknownSuffixWarning', 'FormatSuffixMismatchWarning',
           'DotSyntaxWarning',
           'set_default_engine', 'set_default_format', 'set_jupyter_format']

__title__ = 'graphviz'
__version__ = '0.20.2'
__author__ = 'Sebastian Bank <sebastian.bank@uni-leipzig.de>'
__license__ = 'MIT, see LICENSE.txt'
__copyright__ = 'Copyright (c) 2013-2024 Sebastian Bank'

ENGINES = ENGINES
""":class:`set` of known layout commands used for rendering
(``'dot'``, ``'neato'``, ...)."""

FORMATS = FORMATS
""":class:`set` of known output formats for rendering
(``'pdf'``, ``'png'``, ...)."""

RENDERERS = RENDERERS
""":class:`set` of known output renderers for rendering
(``'cairo'``, ``'gd'``, ...)."""

FORMATTERS = FORMATTERS
""":class:`set` of known output formatters for rendering
(``'cairo'``, ``'gd'``, ...)."""

SUPPORTED_JUPYTER_FORMATS = SUPPORTED_JUPYTER_FORMATS
""":class:`set` of supported formats for ``_repr_mimebundle_()``
(``'svg'``, ``'png'``, ...)."""

DOT_BINARY = DOT_BINARY
""":class:`pathlib.Path` of rendering command (``Path('dot')``)."""

UNFLATTEN_BINARY = UNFLATTEN_BINARY
""":class:`pathlib.Path` of unflatten command (``Path('unflatten')``)."""


ExecutableNotFound = ExecutableNotFound


CalledProcessError = CalledProcessError


RequiredArgumentError = RequiredArgumentError


FileExistsError = FileExistsError


UnknownSuffixWarning = UnknownSuffixWarning


FormatSuffixMismatchWarning = FormatSuffixMismatchWarning


DotSyntaxWarning = DotSyntaxWarning