oelin / valory

Validated dataclasses for Python.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Valory

Validated dataclasses for Python.

Installation

pip install git+https://github.com/oelin/valory

Usage

from valory import dataclass

@dataclass
class User:
    username: str
    password: str

    def validate(self) -> None:
        assert isinstance(self.username, str)
        assert isinstance(self.password, str)
user = User('Alice', 1234)  # Throws an exception.

About

Validated dataclasses for Python.

License:MIT License


Languages

Language:Python 100.0%