https://github.com/i80and/flutter
A magical type-checked deserialization library for Python
https://github.com/i80and/flutter
Last synced: 8 months ago
JSON representation
A magical type-checked deserialization library for Python
- Host: GitHub
- URL: https://github.com/i80and/flutter
- Owner: i80and
- License: isc
- Created: 2012-03-28T02:32:25.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T17:54:46.000Z (about 5 years ago)
- Last Synced: 2025-09-28T00:11:58.439Z (9 months ago)
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 1
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- License: LICENSE.ISC
- Code of conduct: code-of-conduct.md
Awesome Lists containing this project
README
flutter.py
==========
Example
-------
.. code-block:: python
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=[])