From 8edbed315c02ec48cde7a4018e7ae04c56fce8b1 Mon Sep 17 00:00:00 2001
From: Pavel Korshunov <pavel.korshunov@idiap.ch>
Date: Sun, 23 Oct 2016 20:30:40 +0200
Subject: [PATCH] Fixing issues with sphinx docs

---
 bob/bio/face/algorithm/__init__.py    | 17 +++++++++++++++
 bob/bio/face/database/__init__.py     | 30 +++++++++++++++++++++++++++
 bob/bio/face/extractor/GridGraph.py   |  2 +-
 bob/bio/face/extractor/__init__.py    | 19 +++++++++++++++++
 bob/bio/face/preprocessor/FaceCrop.py |  4 ++--
 bob/bio/face/preprocessor/__init__.py | 23 ++++++++++++++++++++
 doc/baselines.rst                     |  6 ------
 doc/implementation.rst                |  2 +-
 doc/nitpick-exceptions.txt            |  1 +
 9 files changed, 94 insertions(+), 10 deletions(-)
 create mode 100644 doc/nitpick-exceptions.txt

diff --git a/bob/bio/face/algorithm/__init__.py b/bob/bio/face/algorithm/__init__.py
index 6f36b2ed..94897572 100644
--- a/bob/bio/face/algorithm/__init__.py
+++ b/bob/bio/face/algorithm/__init__.py
@@ -2,4 +2,21 @@ from .GaborJet import GaborJet
 from .Histogram import Histogram
 
 # gets sphinx autodoc done right - don't remove it
+def __appropriate__(*args):
+  """Says object was actually declared here, and not in the import module.
+  Fixing sphinx warnings of not being able to find classes, when path is shortened.
+  Parameters:
+
+    *args: An iterable of objects to modify
+
+  Resolves `Sphinx referencing issues
+  <https://github.com/sphinx-doc/sphinx/issues/3048>`
+  """
+
+  for obj in args: obj.__module__ = __name__
+
+__appropriate__(
+    GaborJet,
+    Histogram,
+    )
 __all__ = [_ for _ in dir() if not _.startswith('_')]
diff --git a/bob/bio/face/database/__init__.py b/bob/bio/face/database/__init__.py
index 7b1e187e..e6a26fe3 100644
--- a/bob/bio/face/database/__init__.py
+++ b/bob/bio/face/database/__init__.py
@@ -18,4 +18,34 @@ from .cuhk_cufs import CUHK_CUFSBioDatabase
 from .scface import SCFaceBioDatabase
 
 # gets sphinx autodoc done right - don't remove it
+def __appropriate__(*args):
+  """Says object was actually declared here, and not in the import module.
+  Fixing sphinx warnings of not being able to find classes, when path is shortened.
+  Parameters:
+
+    *args: An iterable of objects to modify
+
+  Resolves `Sphinx referencing issues
+  <https://github.com/sphinx-doc/sphinx/issues/3048>`
+  """
+
+  for obj in args: obj.__module__ = __name__
+
+__appropriate__(
+    FaceBioFile,
+    MobioBioDatabase,
+    ReplayBioDatabase,
+    AtntBioDatabase,
+    BancaBioDatabase,
+    GBUBioDatabase,
+    ARFaceBioDatabase,
+    CaspealBioDatabase,
+    LFWBioDatabase,
+    MultipieBioDatabase,
+    IJBABioDatabase,
+    XM2VTSBioDatabase,
+    FRGCBioDatabase,
+    CUHK_CUFSBioDatabase,
+    SCFaceBioDatabase,
+    )
 __all__ = [_ for _ in dir() if not _.startswith('_')]
diff --git a/bob/bio/face/extractor/GridGraph.py b/bob/bio/face/extractor/GridGraph.py
index c1b15ae8..387d86be 100644
--- a/bob/bio/face/extractor/GridGraph.py
+++ b/bob/bio/face/extractor/GridGraph.py
@@ -204,7 +204,7 @@ class GridGraph (Extractor):
 
 
   def write_feature(self, feature, feature_file):
-    """Writes the feature extracted by the :py:meth:`__call__` function to the given file.
+    """Writes the feature extracted by the `__call__` function to the given file.
 
     **Parameters:**
 
diff --git a/bob/bio/face/extractor/__init__.py b/bob/bio/face/extractor/__init__.py
index 0226aadf..b1b7826d 100644
--- a/bob/bio/face/extractor/__init__.py
+++ b/bob/bio/face/extractor/__init__.py
@@ -4,4 +4,23 @@ from .LGBPHS import LGBPHS
 from .Eigenface import Eigenface
 
 # gets sphinx autodoc done right - don't remove it
+def __appropriate__(*args):
+  """Says object was actually declared here, and not in the import module.
+  Fixing sphinx warnings of not being able to find classes, when path is shortened.
+  Parameters:
+
+    *args: An iterable of objects to modify
+
+  Resolves `Sphinx referencing issues
+  <https://github.com/sphinx-doc/sphinx/issues/3048>`
+  """
+
+  for obj in args: obj.__module__ = __name__
+
+__appropriate__(
+    DCTBlocks,
+    GridGraph,
+    LGBPHS,
+    Eigenface,
+    )
 __all__ = [_ for _ in dir() if not _.startswith('_')]
diff --git a/bob/bio/face/preprocessor/FaceCrop.py b/bob/bio/face/preprocessor/FaceCrop.py
index 5b928ad4..43c1b518 100644
--- a/bob/bio/face/preprocessor/FaceCrop.py
+++ b/bob/bio/face/preprocessor/FaceCrop.py
@@ -33,7 +33,7 @@ class FaceCrop (Base):
 
   Some image databases do not provide eye locations, but rather bounding boxes.
   This is not a problem at all.
-  Simply define the coordinates, where you want your ``cropped_positions`` to be in the cropped image, by specifying the same keys in the dictionary that will be given as ``annotations`` to the :py:meth:`face_crop` function.
+  Simply define the coordinates, where you want your ``cropped_positions`` to be in the cropped image, by specifying the same keys in the dictionary that will be given as ``annotations`` to the :py:meth:`crop_face` function.
 
   .. note;::
     These locations can even be outside of the cropped image boundary, i.e., when the crop should be smaller than the annotated bounding boxes.
@@ -57,7 +57,7 @@ class FaceCrop (Base):
   cropped_positions : dict
     The coordinates in the cropped image, where the annotated points should be put to.
     This parameter is a dictionary with usually two elements, e.g., ``{'reye':(RIGHT_EYE_Y, RIGHT_EYE_X) , 'leye':(LEFT_EYE_Y, LEFT_EYE_X)}``.
-    However, also other parameters, such as ``{'topleft' : ..., 'bottomright' : ...}`` are supported, as long as the ``annotations`` in the :py:meth:`__call__` function are present.
+    However, also other parameters, such as ``{'topleft' : ..., 'bottomright' : ...}`` are supported, as long as the ``annotations`` in the `__call__` function are present.
 
   fixed_positions : dict or None
     If specified, ignore the annotations from the database and use these fixed positions throughout.
diff --git a/bob/bio/face/preprocessor/__init__.py b/bob/bio/face/preprocessor/__init__.py
index c2241a86..e8fc5645 100644
--- a/bob/bio/face/preprocessor/__init__.py
+++ b/bob/bio/face/preprocessor/__init__.py
@@ -8,4 +8,27 @@ from .HistogramEqualization import HistogramEqualization
 from .SelfQuotientImage import SelfQuotientImage
 
 # gets sphinx autodoc done right - don't remove it
+def __appropriate__(*args):
+    """Says object was actually declared here, and not in the import module.
+    Fixing sphinx warnings of not being able to find classes, when path is shortened.
+    Parameters:
+
+      *args: An iterable of objects to modify
+
+    Resolves `Sphinx referencing issues
+    <https://github.com/sphinx-doc/sphinx/issues/3048>`
+    """
+
+    for obj in args: obj.__module__ = __name__
+
+
+__appropriate__(
+    Base,
+    FaceCrop,
+    FaceDetect,
+    TanTriggs,
+    INormLBP,
+    HistogramEqualization,
+    SelfQuotientImage,
+)
 __all__ = [_ for _ in dir() if not _.startswith('_')]
diff --git a/doc/baselines.rst b/doc/baselines.rst
index a40d06b5..b3ede11c 100644
--- a/doc/baselines.rst
+++ b/doc/baselines.rst
@@ -85,12 +85,6 @@ The algorithms present an (incomplete) set of state-of-the-art face recognition
   - algorithm : :py:class:`bob.bio.face.algorithm.GaborJet`
 
 
-* ``lgbphs``: *Local Gabor Binary Pattern Histogram Sequences* (LGBPHS) [ZSG+05]_ are extracted from the images and compares using the histogram intersection measure:
-
-  - preprocessor : :py:class:`bob.bio.face.preprocessor.TanTriggs`
-  - feature : :py:class:`bob.bio.face.extractor.LGBPHS`
-  - algorithm : :py:class:`bob.bio.face.algorithm.LGBPHS`
-
 * ``plda``: *Probabilistic LDA* (PLDA) [Pri07]_ is a probabilistic generative version of the LDA, in its scalable formulation of [ESM+13]_.
   Here, we also apply it on pixel-based representations of the image, though also other features should be possible.
 
diff --git a/doc/implementation.rst b/doc/implementation.rst
index 88490b21..6b813752 100644
--- a/doc/implementation.rst
+++ b/doc/implementation.rst
@@ -94,7 +94,7 @@ Databases
 ~~~~~~~~~
 
 One important aspect of :ref:`bob.bio.face <bob.bio.face>` is the relatively large list of supported image data sets, including well-defined evaluation protocols.
-All databases rely on the :py:class:`bob.bio.base.database.DatabaseBob` interface, which in turn uses the `verification_databases <https://gitlab.idiap.ch/bob/bob/wikis/Packages>`_.
+All databases rely on the :py:class:`bob.bio.base.database.BioDatabase` interface, which in turn uses the `verification_databases <https://gitlab.idiap.ch/bob/bob/wikis/Packages>`_.
 Please check the link above for information on how to obtain the original data of those data sets.
 
 After downloading and extracting the original data of the data sets, it is necessary that the scripts know, where the data was installed.
diff --git a/doc/nitpick-exceptions.txt b/doc/nitpick-exceptions.txt
new file mode 100644
index 00000000..14c3632e
--- /dev/null
+++ b/doc/nitpick-exceptions.txt
@@ -0,0 +1 @@
+py:exc ValueError
-- 
GitLab