Skip to content

Commit

Permalink
docs: Update docstrings to numpydoc style (#6506)
Browse files Browse the repository at this point in the history
  • Loading branch information
Azaya89 authored Feb 20, 2025
1 parent 02258ce commit 01a80f2
Show file tree
Hide file tree
Showing 123 changed files with 5,243 additions and 4,140 deletions.
1 change: 0 additions & 1 deletion doc/generate_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ def format_inheritance_diagram(module, package=None):

def create_module_file(package, module, opts):
"""Build the text of the file and write the file."""

text = format_heading(1, f'{module} Module')
text += format_inheritance_diagram(package, module)
text += format_heading(2, f':mod:`{module}` Module')
Expand Down
5 changes: 3 additions & 2 deletions holoviews/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
To ask the community go to https://discourse.holoviz.org/.
To report issues go to https://github.com/holoviz/holoviews.
"""
import builtins
import os
Expand Down Expand Up @@ -158,15 +159,15 @@ def __call__(self, *args, **kwargs):

def help(obj, visualization=True, ansi=True, backend=None,
recursive=False, pattern=None):
"""
Extended version of the built-in help that supports parameterized
"""Extended version of the built-in help that supports parameterized
functions and objects. A pattern (regular expression) may be used to
filter the output and if recursive is set to True, documentation for
the supplied object is shown. Note that the recursive option will
only work with an object instance and not a class.
If ansi is set to False, all ANSI color
codes are stripped out.
"""
backend = backend if backend else Store.current_backend
info = Store.info(obj, ansi=ansi, backend=backend, visualization=visualization,
Expand Down
1 change: 1 addition & 0 deletions holoviews/__version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Define the package version.
Called __version.py as setuptools_scm will create a _version.py
"""

import os.path
Expand Down
55 changes: 30 additions & 25 deletions holoviews/annotators.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@


def preprocess(function, current=None):
"""
Turns a param.depends watch call into a preprocessor method, i.e.
"""Turns a param.depends watch call into a preprocessor method, i.e.
skips all downstream events triggered by it.
NOTE: This is a temporary hack while the addition of preprocessors
NOTE : This is a temporary hack while the addition of preprocessors
in param is under discussion. This only works for the first
method which depends on a particular parameter.
(see https://github.com/pyviz/param/issues/332)
"""
if current is None:
current = []
Expand All @@ -40,12 +40,12 @@ def inner(*args, **kwargs):


class annotate(param.ParameterizedFunction):
"""
The annotate function allows drawing, editing and annotating any
"""The annotate function allows drawing, editing and annotating any
given Element (if it is supported). The annotate function returns
a Layout of the editable plot and an Overlay of table(s), which
allow editing the data of the element. The edited and annotated
data may be accessed using the element and selected properties.
"""

annotator = param.Parameter(doc="""The current Annotator instance.""")
Expand Down Expand Up @@ -101,11 +101,14 @@ def compose(cls, *annotators):
The composed Layout will contain all the elements in the
supplied annotators and an overlay of all editor tables.
Args:
annotators: Annotator layouts or elements to compose
Parameters
----------
annotators
Annotator layouts or elements to compose
Returns:
A new layout consisting of the overlaid plots and tables
Returns
-------
A new layout consisting of the overlaid plots and tables
"""
layers = []
tables = []
Expand Down Expand Up @@ -160,12 +163,12 @@ def __call__(self, element, **params):


class Annotator(PaneBase):
"""
An Annotator allows drawing, editing and annotating a specific
"""An Annotator allows drawing, editing and annotating a specific
type of element. Each Annotator consists of the `plot` to draw and
edit the element and the `editor`, which contains a list of tables,
which make it possible to annotate each object in the element with
additional properties defined in the `annotations`.
"""

annotations = param.ClassSelector(default=[], class_=(dict, list), doc="""
Expand Down Expand Up @@ -285,11 +288,13 @@ def compose(cls, *annotators):
The composed Panel will contain all the elements in the
supplied Annotators and Tabs containing all editors.
Args:
annotators: Annotator objects or elements to compose
Parameters
----------
annotators : Annotator objects or elements to compose
Returns:
A new Panel consisting of the overlaid plots and tables
Returns
-------
A new Panel consisting of the overlaid plots and tables
"""
layers, tables = [], []
for a in annotators:
Expand All @@ -311,9 +316,9 @@ def selected(self):


class PathAnnotator(Annotator):
"""
Annotator which allows drawing and editing Paths and associating
"""Annotator which allows drawing and editing Paths and associating
values with each path and each vertex of a path using a table.
"""

edit_vertices = param.Boolean(default=True, doc="""
Expand Down Expand Up @@ -437,9 +442,9 @@ def selected(self):


class PolyAnnotator(PathAnnotator):
"""
Annotator which allows drawing and editing Polygons and associating
"""Annotator which allows drawing and editing Polygons and associating
values with each polygon and each vertex of a Polygon using a table.
"""

object = param.ClassSelector(class_=Polygons, doc="""
Expand Down Expand Up @@ -485,9 +490,9 @@ def _process_element(self, object):


class PointAnnotator(_GeomAnnotator):
"""
Annotator which allows drawing and editing Points and associating
"""Annotator which allows drawing and editing Points and associating
values with each point using a table.
"""

default_opts = param.Dict(default={'responsive': True, 'min_height': 400,
Expand All @@ -502,9 +507,9 @@ class PointAnnotator(_GeomAnnotator):


class CurveAnnotator(_GeomAnnotator):
"""
Annotator which allows editing a Curve element and associating values
"""Annotator which allows editing a Curve element and associating values
with each vertex using a Table.
"""

default_opts = param.Dict(default={'responsive': True, 'min_height': 400,
Expand All @@ -528,9 +533,9 @@ def _init_stream(self):


class RectangleAnnotator(_GeomAnnotator):
"""
Annotator which allows drawing and editing Rectangles and associating
"""Annotator which allows drawing and editing Rectangles and associating
values with each point using a table.
"""

object = param.ClassSelector(class_=Rectangles, doc="""
Expand Down
Loading

0 comments on commit 01a80f2

Please sign in to comment.