def __init__(self, inner, values): self.inner = inner self.values = dicts.frozendict(values) keys = {} for k, v in values.iteritems(): if v in keys: raise ValueError('duplicate value in values') keys[v] = k self.keys = dicts.frozendict(keys)
def write(self, file, item): if item == self.none_value: raise ValueError('none_value used') return self.inner.write(file, self.none_value if item is None else item) address_type = ComposedType([ ('services', StructType('<Q')), ('address', IPV6AddressType()), ('port', StructType('>H')), ]) tx_type = ComposedType([ ('version', StructType('<I')), ('tx_ins', ListType(ComposedType([ ('previous_output', PossiblyNoneType(dicts.frozendict(hash=0, index=2**32 - 1), ComposedType([ ('hash', HashType()), ('index', StructType('<I')), ]))), ('script', VarStrType()), ('sequence', PossiblyNoneType(2**32 - 1, StructType('<I'))), ]))), ('tx_outs', ListType(ComposedType([ ('value', StructType('<Q')), ('script', VarStrType()), ]))), ('lock_time', StructType('<I')), ]) merkle_branch_type = ListType(HashType())
address_type = ComposedType([ ('services', StructType('<Q')), ('address', IPV6AddressType()), ('port', StructType('>H')), ]) tx_type = ComposedType([ ('version', StructType('<I')), ('tx_ins', ListType( ComposedType([ ('previous_output', PossiblyNoneType( dicts.frozendict(hash=0, index=2**32 - 1), ComposedType([ ('hash', HashType()), ('index', StructType('<I')), ]))), ('script', VarStrType()), ('sequence', PossiblyNoneType(2**32 - 1, StructType('<I'))), ]))), ('tx_outs', ListType( ComposedType([ ('value', StructType('<Q')), ('script', VarStrType()), ]))), ('lock_time', StructType('<I')), ])