Repository: GPflow/GPflow

Issue:
Missing documentation for SquaredExponential kernel
# Documentation

*Is there anything missing in the docs?*

Documentation of gpflow.kernels.stationaries.SquaredExponential went missing sometime after 2.4.0

It is there in [2.4.0](https://gpflow.github.io/GPflow/2.4.0/api/gpflow/kernels/index.html#gpflow-kernels-squaredexponential).

In [2.5.0](https://gpflow.github.io/GPflow/2.5.0/api/gpflow/kernels/index.html#gpflow-kernels-rbf) (and [currently](https://gpflow.github.io/GPflow/develop/api/gpflow/kernels/index.html#gpflow-kernels-rbf)), the entry was replaced by the RBF "as an alias of `gpflow.kernels.stationaries.SquaredExponential`", but there is no `SquaredExponential` entry.



Discussion:
Good catch! Thank you for reporting it. I hope @khurram-ghani might be able to look into this and fix it:)
Thank you. I'll look into this next week.

Resolving patch:
diff --git a/doc/generate_module_rst.py b/doc/generate_module_rst.py
--- a/doc/generate_module_rst.py
+++ b/doc/generate_module_rst.py
@@ -18,7 +18,7 @@
 from dataclasses import dataclass
 from pathlib import Path
 from types import ModuleType
-from typing import Any, Callable, Deque, Dict, List, Mapping, Set, TextIO, Type, Union
+from typing import Any, Callable, Deque, Dict, List, Mapping, Set, TextIO, Tuple, Type, Union
 
 from gpflow.utilities import Dispatcher
 
@@ -165,17 +165,19 @@ def _should_ignore(child: Union[Callable[..., Any], Type[Any]]) -> bool:
 
         return DocumentableModule(root_name, root, modules, classes, functions)
 
-    def seen_in_dispatchers(self, seen: Set[int]) -> None:
+    def seen_in_dispatchers(self, seen: Set[Tuple[str, int]]) -> None:
         for module in self.modules:
             module.seen_in_dispatchers(seen)
         for function in self.functions:
             if isinstance(function, DocumentableDispatcher):
                 impls = function.obj.funcs.values()
                 for impl in impls:
-                    seen.add(id(impl))
+                    # See comment below (for classes) about aliases.
+                    key = (impl.__name__, id(impl))
+                    seen.add(key)
 
     def prune_duplicates(self) -> None:
-        seen: Set[int] = set()
+        seen: Set[Tuple[str, int]] = set()
         self.seen_in_dispatchers(seen)
 
         # Breadth-first search so that we prefer objects with shorter names.
@@ -185,15 +187,20 @@ def prune_duplicates(self) -> None:
 
             new_classes = []
             for c in module.classes:
-                if id(c.obj) not in seen:
-                    seen.add(id(c.obj))
+                # Account for objects to have aliases, hence include the object name in the key.
+                # We want to generate documentation for both the alias and the original object.
+                key = (c.name[c.name.rfind(".") + 1 :], id(c.obj))
+                if key not in seen:
+                    seen.add(key)
                     new_classes.append(c)
             module.classes = new_classes
 
             new_functions = []
             for f in module.functions:
-                if id(f.obj) not in seen:
-                    seen.add(id(f.obj))
+                # See comment above (for classes) about aliases.
+                key = (f.name[f.name.rfind(".") + 1 :], id(f.obj))
+                if key not in seen:
+                    seen.add(key)
                     new_functions.append(f)
             module.functions = new_functions
 


Test patch: