Add column type to columns method

This commit is contained in:
Daniel Sanchez Quiros 2024-03-06 17:53:27 +01:00
parent 3019a92460
commit a421df9566
1 changed files with 4 additions and 3 deletions

View File

@ -13,7 +13,8 @@ class Chunk(Bytes32):
class Column(List[Bytes32]):
pass
def as_bytes(self) -> bytes:
return bytes(chain.from_iterable(self))
class Row(List[Bytes32]):
@ -21,10 +22,10 @@ class Row(List[Bytes32]):
return bytes(chain.from_iterable(self))
class ChunksMatrix(List[Row]):
class ChunksMatrix(List[Row | Column]):
@property
def columns(self) -> Generator[List[Chunk], None, None]:
yield from map(Row, zip(*self))
yield from map(Column, zip(*self))
def transposed(self) -> Self:
return ChunksMatrix(self.columns)