diff --git a/docs/src/developers_guide/contributing_documentation_full.rst b/docs/src/developers_guide/contributing_documentation_full.rst index 41314e80ac..44c75ed279 100755 --- a/docs/src/developers_guide/contributing_documentation_full.rst +++ b/docs/src/developers_guide/contributing_documentation_full.rst @@ -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: diff --git a/docs/src/sphinxext/generate_package_rst.py b/docs/src/sphinxext/generate_package_rst.py index 8f4119944f..b50403b901 100644 --- a/docs/src/sphinxext/generate_package_rst.py +++ b/docs/src/sphinxext/generate_package_rst.py @@ -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)) @@ -32,7 +38,7 @@ def autolog(message): .. autoclass:: {object_name} :members: :undoc-members: - :inherited-members: + {inherited_members_setting} """, "function": """ @@ -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) diff --git a/docs/src/userguide/cube_statistics.rst b/docs/src/userguide/cube_statistics.rst index 79478e4ac6..9dc21f91b5 100644 --- a/docs/src/userguide/cube_statistics.rst +++ b/docs/src/userguide/cube_statistics.rst @@ -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