feat: add accessor and iterator method on data field
This commit is contained in:
parent
562ecf366c
commit
f691669d76
|
|
@ -56,6 +56,13 @@ class DataField:
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return str(self.__value)
|
return str(self.__value)
|
||||||
|
|
||||||
|
def __getitem__(self, key: Any) -> Any:
|
||||||
|
return DataField(self.__file, self.__value.get(key))
|
||||||
|
|
||||||
|
def __iter__(self) -> Iterator[Any]:
|
||||||
|
for it in self.__value:
|
||||||
|
yield DataField(self.__file, it)
|
||||||
|
|
||||||
|
|
||||||
class DataFile(Content):
|
class DataFile(Content):
|
||||||
def __init__(self, path: Path) -> None:
|
def __init__(self, path: Path) -> None:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue