优秀attrs库的一组补丁
pedroasad-attrs-patch的Python项目详细描述
python应用程序模板
优秀attrs库的一组补丁
For | See |
---|---|
Documentation | https://psa-exe.gitlab.io/python-attrs-patch |
Issue tracker | https://gitlab.com/psa-exe/python-attrs-patch/issues |
Repository contents | MANIFEST |
History of changes | CHANGELOG |
Contribution/development guide | CONTRIBUTING |
Copy of MIT License | LICENSE |
安装
pip install pedroasad-attrs-patch
此库包含对attrs frozen classes中的Numpy数组的可选支持。
安装时可以通过传递[numpy]
选项来安装它。
用法
它充当attrs的替换项。 下面的示例演示如何使用它,包括当前所有的改进。
fromattrs_patchimportattr@attr.autodoc@attr.s(frozen=True)classSomeClass:a=attr.ib(metadata={"help":"An immutable numpy array."},converter=attr.frozen_numpy_array,hash=False)b=attr.ib(metadata={"help":"A positive integer."},converter=int,validator=attr.validators.positive)c=attr.ib(metadata={"help":"A non-zero integer."},converter=int,validator=attr.validators.nonzero)
-由GitLab CI
-由Pedro Asad <pasad@lcg.ufrj.br>使用cookiecutter和@pedroasad.com/templates/python/python-app-1.0