from dataclasses import dataclass, field
from flutter import checked, check_type
from typing import List
@checked
@dataclass
class Node:
line: int
@checked
@dataclass
class Parent(Node):
children: List[Node] = field(default_factory=list)
assert check_type(Parent, {
'line': 0,
'children': [{'line': 1}]
}) == Parent(line=0, children=[Node(1)])
assert check_type(Parent, {
'line': 10
}) == Parent(line=10, children=[])
A magical type-checked deserialization library for Python
License
i80and/flutter
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
A magical type-checked deserialization library for Python
Resources
License
Code of conduct
Stars
Watchers
Forks
Packages 0
No packages published