Skip to content

Commit 3b05f05

Browse files
committed
Do not import inherited functions for Weights anymore to avoid doctest failures
1 parent 58f5195 commit 3b05f05

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

docs/src/developers_guide/contributing_documentation_full.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,9 @@ If there is a particularly troublesome module that breaks the ``make html`` you
149149
can exclude the module from the API documentation. Add the entry to the
150150
``exclude_modules`` tuple list in the
151151
``docs/src/sphinxext/generate_package_rst.py`` file.
152+
If you want to avoid adding all methods of a parent class to a subclass, you
153+
can add that class to the ``classes_no_inherited_members`` list at the top of
154+
the ``docs/src/sphinxext/generate_package_rst.py`` file.
152155

153156

154157
.. _contributing.documentation.gallery:

docs/src/sphinxext/generate_package_rst.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
]
1818

1919

20+
# List of classes for which no inherited members are shown
21+
classes_no_inherited_members = [
22+
"iris.analysis.Weights", # avoid showing all methods of np.ndarray
23+
]
24+
25+
2026
# print to stdout, including the name of the python file
2127
def autolog(message):
2228
print("[{}] {}".format(ntpath.basename(__file__), message))
@@ -32,7 +38,7 @@ def autolog(message):
3238
.. autoclass:: {object_name}
3339
:members:
3440
:undoc-members:
35-
:inherited-members:
41+
{inherited_members_setting}
3642
3743
""",
3844
"function": """
@@ -160,10 +166,16 @@ def sort_key(arg):
160166
lines = []
161167
for element, obj in document_these:
162168
object_name = import_name + "." + element
169+
if object_name in classes_no_inherited_members:
170+
inherited_members_setting = ":no-inherited-members:"
171+
else:
172+
inherited_members_setting = ":inherited-members:"
163173
obj_content = document_dict[lookup_object_type(obj)].format(
174+
inherited_members_setting=inherited_members_setting,
164175
object_name=object_name,
165176
object_name_header_line="+" * len(object_name),
166177
object_docstring=inspect.getdoc(obj),
178+
167179
)
168180
lines.append(obj_content)
169181

docs/src/userguide/cube_statistics.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ These areas can now be passed to the ``collapsed`` method as weights:
141141
altitude - x
142142
Scalar coordinates:
143143
forecast_reference_time 2009-11-19 04:00:00
144-
grid_latitude 1.5145501 degrees, bound=(0.14430022, 2.8848) degrees
145-
grid_longitude 358.74948 degrees, bound=(357.494, 360.00497) degrees
144+
grid_latitude 1.5145501 degrees, bound=(0.13755022, 2.89155) degrees
145+
grid_longitude 358.74948 degrees, bound=(357.48724, 360.01172) degrees
146146
surface_altitude 399.625 m, bound=(-14.0, 813.25) m
147147
Cell methods:
148148
mean grid_longitude, grid_latitude

0 commit comments

Comments
 (0)