Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.11/site-packages/graphviz/base.py: 89%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Iterables of DOT source code lines (including final newline)."""
3import typing
5from . import copying
7__all__ = ['Base']
10class LineIterable:
11 """Iterable of DOT Source code lines
12 (mimics ``file`` objects in text mode)."""
14 def __iter__(self) -> typing.Iterator[str]: # pragma: no cover
15 r"""Yield the generated DOT source line by line.
17 Yields: Line ending with a newline (``'\n'``).
18 """
19 raise NotImplementedError('to be implemented by concrete subclasses')
22# Common base interface for all exposed classes
23class Base(LineIterable, copying.CopyBase):
24 """LineIterator with ``.source`` attribute, that it returns for ``str()``."""
26 @property
27 def source(self) -> str: # pragma: no cover
28 raise NotImplementedError('to be implemented by concrete subclasses')
30 def __str__(self) -> str:
31 """The DOT source code as string."""
32 return self.source