diff --git a/bob/bio/base/algorithm/__init__.py b/bob/bio/base/algorithm/__init__.py index 7e8b84119505a2c834139c3e39a15663ee3de4da..d5e2f3fd6a94c926f0b65d8d6ef79328aa77be48 100644 --- a/bob/bio/base/algorithm/__init__.py +++ b/bob/bio/base/algorithm/__init__.py @@ -5,13 +5,35 @@ from .LDA import LDA from .PLDA import PLDA from .BIC import BIC -# to fix sphinx warnings of not being able to find classes, when path is shortened -Algorithm.__module__ = "bob.bio.base.algorithm" -Distance.__module__ = "bob.bio.base.algorithm" -PCA.__module__ = "bob.bio.base.algorithm" -LDA.__module__ = "bob.bio.base.algorithm" -PLDA.__module__ = "bob.bio.base.algorithm" -BIC.__module__ = "bob.bio.base.algorithm" +# # to fix sphinx warnings of not being able to find classes, when path is shortened +# Algorithm.__module__ = "bob.bio.base.algorithm" +# Distance.__module__ = "bob.bio.base.algorithm" +# PCA.__module__ = "bob.bio.base.algorithm" +# LDA.__module__ = "bob.bio.base.algorithm" +# PLDA.__module__ = "bob.bio.base.algorithm" +# BIC.__module__ = "bob.bio.base.algorithm" # 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__( + Algorithm, + Distance, + PCA, + LDA, + PLDA, + BIC, + ) + __all__ = [_ for _ in dir() if not _.startswith('_')] diff --git a/bob/bio/base/database/__init__.py b/bob/bio/base/database/__init__.py index 3c4f8673a599888bd9b9af5c4f29df4c2d61a6bc..f0d04d6697c2f91cc6aa409a91e91d8bd21abed9 100644 --- a/bob/bio/base/database/__init__.py +++ b/bob/bio/base/database/__init__.py @@ -10,4 +10,23 @@ BioDatabase.__module__ = "bob.bio.base.database" ZTBioDatabase.__module__ = "bob.bio.base.database" # 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__( + BioFile, + BioFileSet, + BioDatabase, + ZTBioDatabase, + ) __all__ = [_ for _ in dir() if not _.startswith('_')] diff --git a/bob/bio/base/extractor/__init__.py b/bob/bio/base/extractor/__init__.py index deae933a0162c647e6308ee17b3121d7e726cd47..e8aab1a33840f4145c85a466d9f48ef9b2c4afd8 100644 --- a/bob/bio/base/extractor/__init__.py +++ b/bob/bio/base/extractor/__init__.py @@ -6,4 +6,21 @@ Extractor.__module__ = "bob.bio.base.extractor" Linearize.__module__ = "bob.bio.base.extractor" # 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__( + Extractor, + Linearize, + ) __all__ = [_ for _ in dir() if not _.startswith('_')] diff --git a/bob/bio/base/preprocessor/__init__.py b/bob/bio/base/preprocessor/__init__.py index fb7b2eb6fbbafed49d2798ac5a173ad6dbc2aa84..3f426657336da86df2f9037624bcf9b7000ab9b9 100644 --- a/bob/bio/base/preprocessor/__init__.py +++ b/bob/bio/base/preprocessor/__init__.py @@ -6,4 +6,21 @@ Preprocessor.__module__ = "bob.bio.base.preprocessor" Filename.__module__ = "bob.bio.base.preprocessor" # 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__( + Preprocessor, + Filename, + ) __all__ = [_ for _ in dir() if not _.startswith('_')]