Skip to content

Commit

Permalink
Do not import inherited functions for Weights anymore to avoid doctes…
Browse files Browse the repository at this point in the history
…t failures
  • Loading branch information
schlunma committed Nov 25, 2022
1 parent 58f5195 commit 3b05f05
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/src/developers_guide/contributing_documentation_full.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ If there is a particularly troublesome module that breaks the ``make html`` you
can exclude the module from the API documentation. Add the entry to the
``exclude_modules`` tuple list in the
``docs/src/sphinxext/generate_package_rst.py`` file.
If you want to avoid adding all methods of a parent class to a subclass, you
can add that class to the ``classes_no_inherited_members`` list at the top of
the ``docs/src/sphinxext/generate_package_rst.py`` file.


.. _contributing.documentation.gallery:
Expand Down
14 changes: 13 additions & 1 deletion docs/src/sphinxext/generate_package_rst.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
]


# List of classes for which no inherited members are shown
classes_no_inherited_members = [
"iris.analysis.Weights", # avoid showing all methods of np.ndarray
]


# print to stdout, including the name of the python file
def autolog(message):
print("[{}] {}".format(ntpath.basename(__file__), message))
Expand All @@ -32,7 +38,7 @@ def autolog(message):
.. autoclass:: {object_name}
:members:
:undoc-members:
:inherited-members:
{inherited_members_setting}
""",
"function": """
Expand Down Expand Up @@ -160,10 +166,16 @@ def sort_key(arg):
lines = []
for element, obj in document_these:
object_name = import_name + "." + element
if object_name in classes_no_inherited_members:
inherited_members_setting = ":no-inherited-members:"
else:
inherited_members_setting = ":inherited-members:"
obj_content = document_dict[lookup_object_type(obj)].format(
inherited_members_setting=inherited_members_setting,
object_name=object_name,
object_name_header_line="+" * len(object_name),
object_docstring=inspect.getdoc(obj),

)
lines.append(obj_content)

Expand Down
4 changes: 2 additions & 2 deletions docs/src/userguide/cube_statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,8 @@ These areas can now be passed to the ``collapsed`` method as weights:
altitude - x
Scalar coordinates:
forecast_reference_time 2009-11-19 04:00:00
grid_latitude 1.5145501 degrees, bound=(0.14430022, 2.8848) degrees
grid_longitude 358.74948 degrees, bound=(357.494, 360.00497) degrees
grid_latitude 1.5145501 degrees, bound=(0.13755022, 2.89155) degrees
grid_longitude 358.74948 degrees, bound=(357.48724, 360.01172) degrees
surface_altitude 399.625 m, bound=(-14.0, 813.25) m
Cell methods:
mean grid_longitude, grid_latitude
Expand Down

0 comments on commit 3b05f05

Please sign in to comment.