From 8fe3f029c3480dea5b603ae4770fa7724c866c75 Mon Sep 17 00:00:00 2001 From: Sebastian Bank Date: Wed, 23 Dec 2020 17:50:31 +0100 Subject: [PATCH] add newlines to napoleon docstrings --- graphviz/backend.py | 10 ++++++++-- graphviz/files.py | 7 +++++++ graphviz/lang.py | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/graphviz/backend.py b/graphviz/backend.py index 71d02566c2..846bc15901 100644 --- a/graphviz/backend.py +++ b/graphviz/backend.py @@ -194,8 +194,10 @@ def render(engine, format, filepath, renderer=None, formatter=None, quiet=False) renderer: The output renderer used for rendering (``'cairo'``, ``'gd'``, ...). formatter: The output formatter used for rendering (``'cairo'``, ``'gd'``, ...). quiet (bool): Suppress ``stderr`` output from the layout subprocess. + Returns: The (possibly relative) path of the rendered file. + Raises: ValueError: If ``engine``, ``format``, ``renderer``, or ``formatter`` are not known. graphviz.RequiredArgumentError: If ``formatter`` is given but ``renderer`` is None. @@ -230,8 +232,10 @@ def pipe(engine, format, data, renderer=None, formatter=None, quiet=False): renderer: The output renderer used for rendering (``'cairo'``, ``'gd'``, ...). formatter: The output formatter used for rendering (``'cairo'``, ``'gd'``, ...). quiet (bool): Suppress ``stderr`` output from the layout subprocess. + Returns: Binary (encoded) stdout of the layout command. + Raises: ValueError: If ``engine``, ``format``, ``renderer``, or ``formatter`` are not known. graphviz.RequiredArgumentError: If ``formatter`` is given but ``renderer`` is None. @@ -294,8 +298,9 @@ def version(): Note: Ignores the ``~dev.`` portion of development versions. - See also Graphviz Release version entry format: - https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20 + See also: + Graphviz Release version entry format + https://gitlab.com/graphviz/graphviz/-/blob/f94e91ba819cef51a4b9dcb2d76153684d06a913/gen_version.py#L17-20 """ cmd = ['dot', '-V'] out, _ = run(cmd, check=True, encoding='ascii', @@ -326,6 +331,7 @@ def view(filepath, quiet=False): filepath: Path to the file to open in viewer. quiet (bool): Suppress ``stderr`` output from the viewer process (ineffective on Windows). + Raises: RuntimeError: If the current platform is not supported. diff --git a/graphviz/files.py b/graphviz/files.py index 010d20e7a9..39b10a933c 100644 --- a/graphviz/files.py +++ b/graphviz/files.py @@ -151,8 +151,10 @@ def pipe(self, format=None, renderer=None, formatter=None, quiet=False): renderer: The output renderer used for rendering (``'cairo'``, ``'gd'``, ...). formatter: The output formatter used for rendering (``'cairo'``, ``'gd'``, ...). quiet (bool): Suppress ``stderr`` output from the layout subprocess. + Returns: Binary (encoded) stdout of the layout command. + Raises: ValueError: If ``format``, ``renderer``, or ``formatter`` are not known. graphviz.RequiredArgumentError: If ``formatter`` is given but ``renderer`` is None. @@ -180,6 +182,7 @@ def save(self, filename=None, directory=None): Args: filename: Filename for saving the source (defaults to ``name`` + ``'.gv'``) directory: (Sub)directory for source saving and rendering. + Returns: The (possibly relative) path of the saved source file. """ @@ -217,8 +220,10 @@ def render(self, filename=None, directory=None, view=False, cleanup=False, quiet (bool): Suppress ``stderr`` output from the layout subprocess. quiet_view (bool): Suppress ``stderr`` output from the viewer process (implies ``view=True``, ineffective on Windows). + Returns: The (possibly relative) path of the rendered file. + Raises: ValueError: If ``format``, ``renderer``, or ``formatter`` are not known. graphviz.RequiredArgumentError: If ``formatter`` is given but ``renderer`` is None. @@ -259,8 +264,10 @@ def view(self, filename=None, directory=None, cleanup=False, quiet (bool): Suppress ``stderr`` output from the layout subprocess. quiet_view (bool): Suppress ``stderr`` output from the viewer process (ineffective on Windows). + Returns: The (possibly relative) path of the rendered file. + Raises: graphviz.ExecutableNotFound: If the Graphviz executable is not found. subprocess.CalledProcessError: If the exit status is non-zero. diff --git a/graphviz/lang.py b/graphviz/lang.py index a4eaae2678..1e943e9a71 100644 --- a/graphviz/lang.py +++ b/graphviz/lang.py @@ -146,6 +146,7 @@ def escape(s): Args: s: String in which backslashes and ``'<...>'`` should be treated as literal. + Raises: TypeError: If ``s`` is not a ``str`` on Python 3, or a ``str``/``unicode`` on Python 2. @@ -178,6 +179,7 @@ def nohtml(s): Args: s: String in which leading ``'<'`` and trailing ``'>'`` should be treated as literal. + Raises: TypeError: If ``s`` is not a ``str`` on Python 3, or a ``str``/``unicode`` on Python 2.