def __init__(self, depends_on, func, encoder=ENC_BITS_DEFAULT, fuzzable=True, name=None):
'''
:param depends_on: (name of) field we depend on
:type encoder: :class:`~kitty.model.low_level.encoder.BitsEncoder`
:param func: function for processing of the dependant data. func(Bits)->Bits
:param encoder: encoder for the field
:param fuzzable: is container fuzzable
:param name: (unique) name of the container
'''
try:
res = func(empty_bits)
kassert.is_of_types(res, Bits)
self._func = func
except:
raise KittyException('func should be func(Bits)->Bits')
super(CalculatedBits, self).__init__(depends_on=depends_on, encoder=encoder, fuzzable=fuzzable, name=name)
评论列表
文章目录