Created
January 12, 2016 09:24
-
-
Save vpodzime/d9c3cfa4fca7c6e45a70 to your computer and use it in GitHub Desktop.
API documentation filtering
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From e53bb4bebcfbbb859c165e3e7449ec3031e15026 Mon Sep 17 00:00:00 2001 | |
From: Vratislav Podzimek <vpodzime@redhat.com> | |
Date: Tue, 12 Jan 2016 10:16:44 +0100 | |
Subject: [PATCH] Filter items that are not part of the API for the | |
documenation | |
We can easily mark items that we don't consider to be a part of the API in their | |
docstrings and then skip them when creating documentation. | |
Signed-off-by: Vratislav Podzimek <vpodzime@redhat.com> | |
--- | |
blivet/devices/btrfs.py | 4 +++- | |
doc/conf.py | 9 +++++++++ | |
2 files changed, 12 insertions(+), 1 deletion(-) | |
diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py | |
index e2f6ee1..895f0dc 100644 | |
--- a/blivet/devices/btrfs.py | |
+++ b/blivet/devices/btrfs.py | |
@@ -70,7 +70,9 @@ class BTRFSDevice(StorageDevice): | |
super(BTRFSDevice, self).__init__(*args, **kwargs) | |
def update_sysfs_path(self): | |
- """ Update this device's sysfs path. """ | |
+ """ Update this device's sysfs path. | |
+ :noapi: | |
+ """ | |
log_method_call(self, self.name, status=self.status) | |
self.parents[0].update_sysfs_path() | |
self.sysfs_path = self.parents[0].sysfs_path | |
diff --git a/doc/conf.py b/doc/conf.py | |
index f9754c7..ccbe4bf 100644 | |
--- a/doc/conf.py | |
+++ b/doc/conf.py | |
@@ -330,3 +330,12 @@ class Mock(object): | |
MOCK_MODULES = ['parted', 'block', 'pycryptsetup', 'pykickstart', 'pykickstart.constants', '_ped', 'selinux', 'pyudev'] | |
for mod_name in MOCK_MODULES: | |
sys.modules[mod_name] = Mock() | |
+ | |
+def _skip_no_api(app, what, name, obj, skip, options): | |
+ if not skip and obj.__doc__ and (":noapi:" in obj.__doc__): | |
+ return True | |
+ else: | |
+ return skip | |
+ | |
+def setup(app): | |
+ app.connect("autodoc-skip-member", _skip_no_api) | |
-- | |
2.5.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment