From 84ab9119bb28d8c628d27eedb5185af015752cfe Mon Sep 17 00:00:00 2001 From: Amir MOHAMMADI <amir.mohammadi@idiap.ch> Date: Thu, 15 Feb 2018 15:24:39 +0100 Subject: [PATCH] rename Base to Annotator --- bob/bio/base/annotator/{Base.py => Annotator.py} | 9 ++++----- bob/bio/base/annotator/Callable.py | 15 ++++++++++++--- bob/bio/base/annotator/FailSafe.py | 4 ++-- bob/bio/base/annotator/__init__.py | 4 ++-- 4 files changed, 20 insertions(+), 12 deletions(-) rename bob/bio/base/annotator/{Base.py => Annotator.py} (84%) diff --git a/bob/bio/base/annotator/Base.py b/bob/bio/base/annotator/Annotator.py similarity index 84% rename from bob/bio/base/annotator/Base.py rename to bob/bio/base/annotator/Annotator.py index c40e028a..9a4cfb2b 100644 --- a/bob/bio/base/annotator/Base.py +++ b/bob/bio/base/annotator/Annotator.py @@ -1,9 +1,8 @@ from bob.bio.base import read_original_data as base_read -import numpy # for documentation -class Base(object): - """Base class for all annotators. This class is meant to be used in +class Annotator(object): + """Annotator class for all annotators. This class is meant to be used in conjunction with the bob bio annotate script. Attributes @@ -14,7 +13,7 @@ class Base(object): """ def __init__(self, read_original_data=None, **kwargs): - super(Base, self).__init__(**kwargs) + super(Annotator, self).__init__(**kwargs) self.read_original_data = read_original_data or base_read def annotate(self, sample, **kwargs): @@ -36,6 +35,6 @@ class Base(object): """ raise NotImplementedError - # Alisa call to annotate + # Alias call to annotate def __call__(self, sample, **kwargs): return self.annotate(sample, **kwargs) diff --git a/bob/bio/base/annotator/Callable.py b/bob/bio/base/annotator/Callable.py index b4736d2c..0858a852 100644 --- a/bob/bio/base/annotator/Callable.py +++ b/bob/bio/base/annotator/Callable.py @@ -1,9 +1,18 @@ -from .Base import Base +from . import Annotator -class Callable(Base): +class Callable(Annotator): """A class that wraps a callable object that annotates a sample into a - bob.bio.annotator object.""" + bob.bio.annotator object. + + Attributes + ---------- + callable : callable + A callable with the following signature: + ``annotations = callable(sample, **kwargs)`` that takes numpy array and + returns annotations in dictionary format for that biometric sample. + Please see :any:`Annotator` for more information. + """ def __init__(self, callable, **kwargs): super(Callable, self).__init__(**kwargs) diff --git a/bob/bio/base/annotator/FailSafe.py b/bob/bio/base/annotator/FailSafe.py index 04a443a9..ebeeb8ac 100644 --- a/bob/bio/base/annotator/FailSafe.py +++ b/bob/bio/base/annotator/FailSafe.py @@ -1,10 +1,10 @@ import logging -from . import Base +from . import Annotator logger = logging.getLogger(__name__) -class FailSafe(Base): +class FailSafe(Annotator): """A fail-safe annotator. This annotator takes a list of annotator and tries them until you get your annotations. diff --git a/bob/bio/base/annotator/__init__.py b/bob/bio/base/annotator/__init__.py index e63b7dcc..8e3546ea 100644 --- a/bob/bio/base/annotator/__init__.py +++ b/bob/bio/base/annotator/__init__.py @@ -1,4 +1,4 @@ -from .Base import Base +from .Annotator import Annotator from .FailSafe import FailSafe from .Callable import Callable @@ -23,7 +23,7 @@ def __appropriate__(*args): __appropriate__( - Base, + Annotator, FailSafe, Callable, ) -- GitLab