Exert

Latest version: v0.3.3

Safety actively analyzes 682361 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

42.0

print(foo.c) prints 22

0.3.3

* Publish Python 3.11 wheels.

0.3.1

* Compile the library into native code with the help of [mypyc](https://mypyc.readthedocs.io/en/latest/index.html).
* Build the wheels with [cibuildwheel](https://cibuildwheel.readthedocs.io/en/stable/).
* The c extension makes attribute access a tiny bit faster.

0.3.0

* Redesign the public API to be compatible with other bespoke tools that might be working on the same class.
* To apply a converter, now, you'll have to wrap it with `Mark`. Otherwise, it'll be ignored. Credit to adriangb.

python

from __future__ import annotations

from typing import Annotated
from exert import exert, Mark
from dataclasses import dataclass

exert(converters=(str, ), apply_last=True)
dataclass
class Foo:
a: Annotated[int, Mark(lambda x: x**2)] First the marked converter and then the common converter will be applied.
b: Annotated[float, lambda x: x / 2] Only the common converter `str` will be applied.
c: int No conversion will happen here.


foo = Foo(2, 42.0, 22)

print(foo.a) prints '4'. [2**2=4, str(4)='4']

0.2.3

First working version.

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.