Mercurial > hgrepos > Python > libs > ConfigMix
diff configmix/ini.py @ 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 | aa8345dae995 |
| children | a43749f751e0 |
line wrap: on
line diff
--- 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. """
