[0ce940]: / tests / configurables.py

Download this file

34 lines (25 with data), 868 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import gin
class DummyModiscoResult:
def save_hdf5(self, grp):
pass
@gin.configurable
class DummyModiscoWorkflow:
"""Dummy configurable to test
"""
def __init__(self, *args, **kwargs):
self.args = args
self.kwargs = kwargs
print(f"Recieved args: {args}")
print(f"Recieved kwargs: {kwargs}")
def __call__(self, *args, **kwargs):
req_kwargs = ['task_names',
'contrib_scores',
'hypothetical_contribs',
'one_hot',
'null_per_pos_scores']
for kw in req_kwargs:
assert kw in kwargs
assert kwargs['contrib_scores'].keys() == kwargs['hypothetical_contribs'].keys()
print(f"Recieved args: {args}")
print(f"Recieved kwargs: {kwargs}")
return DummyModiscoResult()