changeset 56:1f11672c4615

Optimize the documentation: make references working with Sphinx using :role:`target`
author Franz Glasner <hg@dom66.de>
date Wed, 28 Feb 2018 00:36:11 +0100
parents 51a8fa011659
children a3f64253de70
files configmix/__init__.py configmix/config.py configmix/ini.py configmix/yaml.py doc/apidoc.rst
diffstat 5 files changed, 21 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/configmix/__init__.py	Tue Feb 27 23:57:57 2018 +0100
+++ b/configmix/__init__.py	Wed Feb 28 00:36:11 2018 +0100
@@ -29,7 +29,7 @@
 
 def load(*files):
     """Load the given configuration files, merge them in the given order
-    and return the resulting `Configuration` dictionary.
+    and return the resulting :class:`configmix.config.Configuration` dictionary.
 
     """
     if not files:
@@ -99,7 +99,7 @@
 
 
 def safe_merge(user, default, _first=True):
-    """A more safe version of `merge()` that makes shallow copies of
+    """A more safe version of :func:`merge()` that makes shallow copies of
     the returned container objects.
 
     .. note:: `_first` is an internal argument.
--- a/configmix/config.py	Tue Feb 27 23:57:57 2018 +0100
+++ b/configmix/config.py	Wed Feb 28 00:36:11 2018 +0100
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
-r"""configmix.config
+r"""
+configmix.config
 ^^^^^^^^^^^^^^^^
 
 The unified configuration dictionary with attribute support or
--- a/configmix/ini.py	Tue Feb 27 23:57:57 2018 +0100
+++ b/configmix/ini.py	Wed Feb 28 00:36:11 2018 +0100
@@ -63,9 +63,15 @@
         return v.split(os.pathsep)
 
     def read(self, filenames):
+        """Not implemented. Use :meth:`readfp` instead"""
         raise NotImplementedError("use `readfp()' instead")
 
     def readfp(self, fp, filename):
+        """Read from a file-like object `fp`.
+
+        The `fp` argument must have a `readline()` method. 
+
+        """
         if hasattr(self, "filename"):
             raise RuntimeError("already initialized")
         filename = os.path.normpath(os.path.abspath(filename))
@@ -80,9 +86,9 @@
         self.root = os.path.dirname(self.executable)
 
     def getx(self, section, option):
-        """Extended get() with some automatic type conversion support.
+        """Extended `get()` with some automatic type conversion support.
 
-        Default: Fetch as string (like `get()`).
+        Default: Fetch as string (like :meth:`get`).
 
         If annotated with ``:bool:`` fetch as bool, if annotated with
         ``:int:`` fetch as int, if annotated with ``:float:`` fetch as
@@ -113,7 +119,7 @@
 
     def itemsx(self, section, options):
         """Get all the options given in `options` of section `section`.
-        Fetch them with `self.getx()` in the order given.
+        Fetch them with :meth:`getx` in the order given.
 
         Return a list of ``(name, value)`` pairs for each option in
         `options` in the given `section`.
@@ -130,7 +136,7 @@
         return d
 
     def items_as_dictx(self, section, options):
-        """Similar to `self.itemsx()` but return a (possibly ordered)
+        """Similar to :meth:`itemsx` but return a (possibly ordered)
         dict instead of a list of key-value pairs.
 
         """
--- a/configmix/yaml.py	Tue Feb 27 23:57:57 2018 +0100
+++ b/configmix/yaml.py	Wed Feb 28 00:36:11 2018 +0100
@@ -28,8 +28,8 @@
 
 class ConfigLoader(yaml.Loader):
 
-    """A YAML loader, which makes all !!str strings to Unicode.  Standard
-    PyYAML does this only in the non-ASCII case.
+    """A YAML loader, which makes all ``!!str`` strings to Unicode.
+    Standard PyYAML does this only in the non-ASCII case.
 
     If an `OrderedDict` implementation is available then all "map" and
     "omap" nodes are constructed as `OrderedDict`.
@@ -90,7 +90,7 @@
 
 class ConfigSafeLoader(yaml.SafeLoader):
 
-    """A safe YAML loader, which makes all !!str strings to Unicode.
+    """A safe YAML loader, which makes all ``!!str`` strings to Unicode.
     Standard PyYAML does this only in the non-ASCII case.
 
     If an `OrderedDict` implementation is available then all "map" and
--- a/doc/apidoc.rst	Tue Feb 27 23:57:57 2018 +0100
+++ b/doc/apidoc.rst	Wed Feb 28 00:36:11 2018 +0100
@@ -10,15 +10,15 @@
 .. automodule:: configmix.compat
    :members:
    :ignore-module-all:
+      
+.. automodule:: configmix.config
+   :members:
+   :ignore-module-all:
 
 .. automodule:: configmix.ini
    :members:
    :ignore-module-all:      
 
-.. automodule:: configmix.ini
-   :members:
-   :ignore-module-all:
-
 .. automodule:: configmix.py
    :members:
    :ignore-module-all: