feat: speed up constructing Variant objects (#256)
This commit is contained in:
parent
eeabcd536f
commit
0d7a6652d7
@ -18,6 +18,9 @@ cdef class SignatureTree:
|
||||
|
||||
cdef class Variant:
|
||||
|
||||
cdef public object type
|
||||
cdef public object signature
|
||||
cdef public SignatureType type
|
||||
cdef public str signature
|
||||
cdef public object value
|
||||
|
||||
@cython.locals(signature_tree=SignatureTree)
|
||||
cdef _init_variant(self, object signature, object value, bint verify)
|
||||
|
||||
@ -400,6 +400,14 @@ class Variant:
|
||||
verify: bool = True,
|
||||
) -> None:
|
||||
"""Init a new Variant."""
|
||||
self._init_variant(signature, value, verify)
|
||||
|
||||
def _init_variant(
|
||||
self,
|
||||
signature: Union[str, SignatureTree, SignatureType],
|
||||
value: Any,
|
||||
verify: bool,
|
||||
) -> None:
|
||||
if type(signature) is SignatureTree:
|
||||
signature_tree = signature
|
||||
self.signature = signature_tree.signature
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user