Convert unstructured data into type-safe dataclasses.
Project description
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=[])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flutter-0.1.tar.gz
(8.6 kB
view hashes)
Built Distribution
flutter-0.1-py3-none-any.whl
(12.8 kB
view hashes)