diff --git a/bob/db/cuhk_cufsf/models.py b/bob/db/cuhk_cufsf/models.py index c3a4f3ccb873d9bdb189f54b2fbd576d5867f7ef..bfd6ec98e8c420949218a021c99743cb111a7205 100644 --- a/bob/db/cuhk_cufsf/models.py +++ b/bob/db/cuhk_cufsf/models.py @@ -29,9 +29,8 @@ from bob.db.base.sqlalchemy_migration import Enum, relationship from sqlalchemy.orm import backref from sqlalchemy.ext.declarative import declarative_base -import bob.db.verification.utils - import os +import bob.db.base Base = declarative_base() @@ -119,7 +118,7 @@ class Annotation(Base): -class File(Base, bob.db.verification.utils.File): +class File(Base, bob.db.base.File): """ Information about the files of the CUHK-CUFS database. @@ -141,7 +140,7 @@ class File(Base, bob.db.verification.utils.File): def __init__(self, id, image_name, client_id, modality): # call base class constructor - bob.db.verification.utils.File.__init__(self, file_id = id, client_id = client_id, path = image_name) + bob.db.base.File.__init__(self, file_id = id, client_id = client_id, path = image_name) self.modality = modality diff --git a/bob/db/cuhk_cufsf/query.py b/bob/db/cuhk_cufsf/query.py index 7d7e7a274bf7762c8e2939990698dd7579a8cf02..68a8e2a7087e9c1f247e8adac439e57e7e49fe8d 100644 --- a/bob/db/cuhk_cufsf/query.py +++ b/bob/db/cuhk_cufsf/query.py @@ -25,11 +25,11 @@ from .models import PROTOCOLS, GROUPS, PURPOSES from .driver import Interface -import bob.db.verification.utils +import bob.db.base SQLITE_FILE = Interface().files()[0] -class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.utils.ZTDatabase): +class Database(bob.db.base.SQLiteDatabase): """Wrapper class for the CUHK-CUFSF database for Heterogeneous face recognition recognition (http://mmlab.ie.cuhk.edu.hk/archive/cufsf/). """ @@ -45,8 +45,9 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti """ # call base class constructors to open a session to the database - bob.db.verification.utils.SQLiteDatabase.__init__(self, SQLITE_FILE, File) - bob.db.verification.utils.ZTDatabase.__init__(self, original_directory=original_directory, original_extension=original_extension) + super(Database, self).__init__(SQLITE_FILE, File) + self.original_directory = original_directory + self.original_extension = original_extension self.feret_directory = feret_directory @@ -96,7 +97,7 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti def annotations(self, file, annotation_type="eyes_center"): """This function returns the annotations for the given file id as a dictionary. Keyword parameters: - file : :py:class:`bob.db.verification.utils.File` or one of its derivatives + file : :py:class:`bob.db.base.File` or one of its derivatives The File object you want to retrieve the annotations for, Return value: A dictionary of annotations, for face images usually something like {'leye':(le_y,le_x), 'reye':(re_y,re_x), ...}, @@ -176,20 +177,3 @@ class Database(bob.db.verification.utils.SQLiteDatabase, bob.db.verification.uti """This function returns the list of groups for this database.""" return GROUPS - - - def tmodel_ids(self, groups = None, protocol = None, **kwargs): - """This function returns the ids of the T-Norm models of the given groups for the given protocol.""" - - return [] - - - def tobjects(self, protocol=None, model_ids=None, groups=None): - #No TObjects - return [] - - - def zobjects(self, protocol=None, groups=None): - #No TObjects - return [] - diff --git a/doc/conf.py b/doc/conf.py index 35b86cc2d58f4db24ead98dc5c467ec4b1047bb2..2cbc65f3130f6e9c16a1d9a4d7cfb44ef0beae2c 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -1,46 +1,68 @@ #!/usr/bin/env python # vim: set fileencoding=utf-8 : -# Andre Anjos <andre.anjos@idiap.ch> -# Mon 13 Aug 2012 12:38:15 CEST -# -# Copyright (C) 2011-2014 Idiap Research Institute, Martigny, Switzerland import os import sys import glob import pkg_resources -# If extensions (or modules to document with autodoc) are in another directory, -# add these directories to sys.path here. If the directory is relative to the -# documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +needs_sphinx = '1.3' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ - 'sphinx.ext.todo', - 'sphinx.ext.coverage', - 'sphinx.ext.pngmath', - 'sphinx.ext.ifconfig', - 'sphinx.ext.autodoc', - 'sphinx.ext.autosummary', - 'sphinx.ext.doctest', - 'sphinx.ext.intersphinx', - ] + 'sphinx.ext.todo', + 'sphinx.ext.coverage', + 'sphinx.ext.ifconfig', + 'sphinx.ext.autodoc', + 'sphinx.ext.autosummary', + 'sphinx.ext.doctest', + 'sphinx.ext.graphviz', + 'sphinx.ext.intersphinx', + 'sphinx.ext.napoleon', + 'sphinx.ext.viewcode', + #'matplotlib.sphinxext.plot_directive' + ] -# The viewcode extension appeared only on Sphinx >= 1.0.0 import sphinx -if sphinx.__version__ >= "1.0": - extensions.append('sphinx.ext.viewcode') +if sphinx.__version__ >= "1.4.1": + extensions.append('sphinx.ext.imgmath') + imgmath_image_format = 'svg' +else: + extensions.append('sphinx.ext.pngmath') + +# Be picky about warnings +nitpicky = True + +# Ignores stuff we can't easily resolve on other project's sphinx manuals +nitpick_ignore = [] + +# Allows the user to override warnings from a separate file +if os.path.exists('nitpick-exceptions.txt'): + for line in open('nitpick-exceptions.txt'): + if line.strip() == "" or line.startswith("#"): + continue + dtype, target = line.split(None, 1) + target = target.strip() + try: # python 2.x + target = unicode(target) + except NameError: + pass + nitpick_ignore.append((dtype, target)) # Always includes todos todo_include_todos = True +# Generates auto-summary automatically +autosummary_generate = True + +# Create numbers on figures with captions +numfig = True + # If we are on OSX, the 'dvipng' path maybe different dvipng_osx = '/opt/local/libexec/texlive/binaries/dvipng' if os.path.exists(dvipng_osx): pngmath_dvipng = dvipng_osx @@ -58,12 +80,12 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'CUHK Face Sketch FERET Database (CUFSF) (Bob API)' +project = u'bob.db.cuhk_cufsf' import time copyright = u'%s, Idiap Research Institute' % time.strftime('%Y') # Grab the setup entry -distribution = pkg_resources.require('bob.db.cuhk_cufsf')[0] +distribution = pkg_resources.require(project)[0] # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -86,7 +108,7 @@ release = distribution.version # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. -exclude_patterns = ['**/links.rst'] +exclude_patterns = ['links.rst'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None @@ -108,13 +130,18 @@ pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] +# Some variables which are useful for generated material +project_variable = project.replace('.', '_') +short_description = u'CUFSF Database' +owner = [u'Idiap Research Institute'] + # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -if sphinx.__version__ >= "1.0": - html_theme = 'nature' +import sphinx_rtd_theme +html_theme = 'sphinx_rtd_theme' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -122,14 +149,14 @@ if sphinx.__version__ >= "1.0": #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = 'bob' +#html_short_title = project_variable # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -187,67 +214,57 @@ html_favicon = 'img/favicon.ico' #html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'bob_db_ldhf_doc' - - -# -- Options for LaTeX output -------------------------------------------------- - -# The paper size ('letter' or 'a4'). -latex_paper_size = 'a4' - -# The font size ('10pt', '11pt' or '12pt'). -latex_font_size = '10pt' - -# Grouping the document tree into LaTeX files. List of tuples -# (source start file, target name, title, author, documentclass [howto/manual]). -latex_documents = [ - ('index', 'bob_db_ldhf.tex', u'Bob', - u'Biometrics Group, Idiap Research Institute', 'manual'), -] - -# The name of an image file (relative to this directory) to place at the top of -# the title page. -latex_logo = '' +htmlhelp_basename = project_variable + u'_doc' -# For "manual" documents, if this is true, then toplevel headings are parts, -# not chapters. -#latex_use_parts = False -# If true, show page references after internal links. -#latex_show_pagerefs = False - -# If true, show URL addresses after external links. -#latex_show_urls = False - -# Additional stuff for the LaTeX preamble. -#latex_preamble = '' - -# Documents to append as an appendix to all manuals. -#latex_appendices = [] - -# If false, no module index is generated. -#latex_domain_indices = True +# -- Post configuration -------------------------------------------------------- # Included after all input documents -rst_epilog = '' - -# -- Options for manual page output -------------------------------------------- - -# One entry per manual page. List of tuples -# (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'bob', u'Long Distance Heterogeneous Face Database (LDHF-DB) (Bob API) Documentation', [u'Idiap Research Institute'], 1) -] +rst_epilog = """ +.. |project| replace:: Bob +.. |version| replace:: %s +.. |current-year| date:: %%Y +""" % (version,) # Default processing flags for sphinx -autoclass_content = 'both' +autoclass_content = 'class' autodoc_member_order = 'bysource' -autodoc_default_flags = ['members', 'undoc-members', 'inherited-members', 'show-inheritance'] +autodoc_default_flags = [ + 'members', + 'undoc-members', + 'inherited-members', + 'show-inheritance', + ] # For inter-documentation mapping: -from bob.extension.utils import link_documentation -intersphinx_mapping = link_documentation(['python', 'bob.db.base', 'bob.db.verification.utils']) - +from bob.extension.utils import link_documentation, load_requirements +sphinx_requirements = "extra-intersphinx.txt" +if os.path.exists(sphinx_requirements): + intersphinx_mapping = link_documentation( + additional_packages=['python','numpy'] + \ + load_requirements(sphinx_requirements) + ) +else: + intersphinx_mapping = link_documentation() + + +# We want to remove all private (i.e. _. or __.__) members +# that are not in the list of accepted functions +accepted_private_functions = ['__array__'] + +def member_function_test(app, what, name, obj, skip, options): + # test if we have a private function + if len(name) > 1 and name[0] == '_': + # test if this private function should be allowed + if name not in accepted_private_functions: + # omit privat functions that are not in the list of accepted private functions + return skip + else: + # test if the method is documented + if not hasattr(obj, '__doc__') or not obj.__doc__: + return skip + return False def setup(app): - pass + app.connect('autodoc-skip-member', member_function_test) +