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 details)
Built Distribution
flutter-0.1-py3-none-any.whl
(12.8 kB
view details)
File details
Details for the file flutter-0.1.tar.gz
.
File metadata
- Download URL: flutter-0.1.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.21.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f19a8b2ebf0a3379792cd064c18e95d6c2ac91d365fbfc1c7f80e5938f586ecd |
|
MD5 | bfbd7d98a85121ec1a10cafe545a68ad |
|
BLAKE2b-256 | 0cde136b23d4075219ba36fdd0a8baa44b9e2d2c8ae604c66d2b61d812820cfe |
File details
Details for the file flutter-0.1-py3-none-any.whl
.
File metadata
- Download URL: flutter-0.1-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.21.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13bc3a93a5370c54656252d4dd0e11b48a9cca5b6f02892909d5c560eecb5494 |
|
MD5 | 8b339c8546a664033a4e1eb7d4a2f9e5 |
|
BLAKE2b-256 | 703f9da3ca46667609ac3ff0c75631a9df8313b95c5b5f3c53f3c4de70a4b005 |