Coverage for src/bob/bio/base/annotator/Callable.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.6.5, created at 2024-11-14 21:41 +0100

1from . import Annotator 

2 

3 

4class Callable(Annotator): 

5 """A class that wraps a callable object that annotates a sample into a 

6 bob.bio.annotator object. 

7 

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 """ 

16 

17 def __init__(self, callable, **kwargs): 

18 super(Callable, self).__init__(**kwargs) 

19 self.callable = callable 

20 

21 def transform(self, sample, **kwargs): 

22 return self.callable(sample, **kwargs)