Coverage for src/bob/bio/base/annotator/Callable.py: 100%
7 statements
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-12 22:34 +0200
« prev ^ index » next coverage.py v7.6.0, created at 2024-07-12 22:34 +0200
1from . import Annotator
4class Callable(Annotator):
5 """A class that wraps a callable object that annotates a sample into a
6 bob.bio.annotator object.
8 Attributes
9 ----------
10 callable
11 A callable with the following signature:
12 ``annotations = callable(sample, **kwargs)`` that takes numpy array and
13 returns annotations in dictionary format for that biometric sample.
14 Please see :any:`Annotator` for more information.
15 """
17 def __init__(self, callable, **kwargs):
18 super(Callable, self).__init__(**kwargs)
19 self.callable = callable
21 def transform(self, sample, **kwargs):
22 return self.callable(sample, **kwargs)