From ef159765e80f5149255a17b2540ed9592d274799 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20M=C3=BCller?= <mueller.seb@posteo.de>
Date: Fri, 25 Oct 2024 17:15:45 +0200
Subject: [PATCH] Docs: better docs for Enums

---
 docs/source/_templates/autosummary/class.rst |  2 +-
 docs/source/conf.py                          | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/docs/source/_templates/autosummary/class.rst b/docs/source/_templates/autosummary/class.rst
index 590af265..a64371c6 100644
--- a/docs/source/_templates/autosummary/class.rst
+++ b/docs/source/_templates/autosummary/class.rst
@@ -7,7 +7,7 @@
    :private-members: _initialize, _connect, _validate, _update, _finalize, _get_data, _get_info, _source_updated, _pulled
    :special-members: __getitem__
    :undoc-members:
-   :inherited-members:
+   :inherited-members: object, int
    :show-inheritance:
 
 .. raw:: latex
diff --git a/docs/source/conf.py b/docs/source/conf.py
index a8dc741e..3b343032 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -1,7 +1,22 @@
 import datetime
+import inspect
+from enum import Enum
 
 from finam import __version__ as finam_version
 
+
+def skip_member(app, what, name, obj, skip, options):
+    # Check if we're dealing with an Enum
+    if inspect.isclass(obj) and issubclass(obj, Enum):
+        if name not in [e.name for e in obj]:
+            return True  # Skip anything that isn’t an enum member
+    return skip
+
+
+def setup(app):
+    app.connect("autodoc-skip-member", skip_member)
+
+
 # Configuration file for the Sphinx documentation builder.
 #
 # For the full list of built-in configuration values, see the documentation:
-- 
GitLab