Add `BaseBytes` to cover `Bytes` and `BytesN`
This commit is contained in:
parent
6577f159c9
commit
d6bbd9bfa1
|
@ -54,7 +54,7 @@ from eth2spec.utils.ssz.ssz_impl import (
|
||||||
is_zero,
|
is_zero,
|
||||||
)
|
)
|
||||||
from eth2spec.utils.ssz.ssz_typing import (
|
from eth2spec.utils.ssz.ssz_typing import (
|
||||||
BasicValue, Elements, BaseList, SSZType,
|
BasicValue, Elements, BaseBytes, BaseList, SSZType,
|
||||||
Container, List, Vector, Bytes, BytesN, Bitlist, Bitvector, Bits,
|
Container, List, Vector, Bytes, BytesN, Bitlist, Bitvector, Bits,
|
||||||
Bytes1, Bytes4, Bytes8, Bytes32, Bytes48, Bytes96,
|
Bytes1, Bytes4, Bytes8, Bytes32, Bytes48, Bytes96,
|
||||||
uint64, bit, boolean,
|
uint64, bit, boolean,
|
||||||
|
|
|
@ -106,7 +106,8 @@ def item_length(typ: SSZType) -> int:
|
||||||
```
|
```
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def get_elem_type(typ: Union[BaseList, Container], index_or_variable_name: Union[int, SSZVariableName]) -> SSZType:
|
def get_elem_type(typ: Union[BaseBytes, BaseList, Container],
|
||||||
|
index_or_variable_name: Union[int, SSZVariableName]) -> SSZType:
|
||||||
"""
|
"""
|
||||||
Return the type of the element of an object of the given type with the given index
|
Return the type of the element of an object of the given type with the given index
|
||||||
or member variable name (eg. `7` for `x[7]`, `"foo"` for `x.foo`)
|
or member variable name (eg. `7` for `x[7]`, `"foo"` for `x.foo`)
|
||||||
|
|
Loading…
Reference in New Issue