diff options
author | CoprDistGit <infra@openeuler.org> | 2023-03-09 16:23:32 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-03-09 16:23:32 +0000 |
commit | 7a0955608372dfaee3cc97d6e0d66bf481ec094b (patch) | |
tree | 9b14a094f44d00b95f322ddc820d9c6a6e4d176c | |
parent | efb8ff2993d3293d187a1fc448e707c361fcbd01 (diff) |
automatic import of python-represent
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-represent.spec | 322 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 324 insertions, 0 deletions
@@ -0,0 +1 @@ +/Represent-1.6.0.post0.tar.gz diff --git a/python-represent.spec b/python-represent.spec new file mode 100644 index 0000000..2bc9902 --- /dev/null +++ b/python-represent.spec @@ -0,0 +1,322 @@ +%global _empty_manifest_terminate_build 0 +Name: python-Represent +Version: 1.6.0.post0 +Release: 1 +Summary: Create __repr__ automatically or declaratively. +License: MIT +URL: https://github.com/RazerM/represent +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/e1/ec/ea9c10142e6d65e9e12eea4678bf531b65e07a491e0071358d4ea3bae901/Represent-1.6.0.post0.tar.gz +BuildArch: noarch + +Requires: python3-six +Requires: python3-ipython +Requires: python3-pytest +Requires: python3-mock + +%description +## Represent +[![PyPI Version][ppi]][ppl] [![Documentation][di]][dl] [![CI Status][gai]][gal] [![Coverage][cvi]][cvl] [![Python Version][pvi]][pvl] [![MIT License][mli]][mll] + + [ppi]: https://img.shields.io/pypi/v/represent.svg?style=flat-square + [ppl]: https://pypi.python.org/pypi/represent/ + [pvi]: https://img.shields.io/badge/python-2.7%2C%203-brightgreen.svg?style=flat-square + [pvl]: https://www.python.org/downloads/ + [mli]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square + [mll]: https://raw.githubusercontent.com/RazerM/represent/master/LICENSE + [di]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat-square + [dl]: https://represent.readthedocs.io/en/latest/ + [gai]: https://github.com/RazerM/represent/workflows/CI/badge.svg?branch=master + [gal]: https://github.com/RazerM/represent/actions?workflow=CI + [cvi]: https://img.shields.io/codecov/c/github/RazerM/represent/master.svg?style=flat-square + [cvl]: https://codecov.io/github/RazerM/represent?branch=master + +### Installation + +```bash +$ pip install represent +``` + +### Automatic Generation + +```python +from represent import autorepr + + +@autorepr +class Rectangle: + def __init__(self, name, color, width, height): + self.name = name + self.color = color + self.width = width + self.height = height + +rect = Rectangle('Timothy', 'red', 15, 4.5) +print(rect) +``` + +``` +Rectangle(name='Timothy', color='red', width=15, height=4.5) +``` + +### Declarative Generation + +```python +from represent import ReprHelperMixin + + +class ContrivedExample(ReprHelperMixin, object): + def __init__(self, description, radians, shape, color, miles): + self.description = description + self.degrees = radians * 180 / 3.141592654 + self.shape = shape + self._color = color + self.km = 1.60934 * miles + + def _repr_helper_(self, r): + r.positional_from_attr('description') + r.positional_with_value(self.degrees * 3.141592654 / 180) + r.keyword_from_attr('shape') + r.keyword_from_attr('color', '_color') + r.keyword_with_value('miles', self.km / 1.60934) + +ce = ContrivedExample('does something', 0.345, 'square', 'red', 22) + +print(ce) +from IPython.lib.pretty import pprint +pprint(ce) +``` + +``` +ContrivedExample('does something', 0.345, shape='square', color='red', miles=22.0) +ContrivedExample('does something', + 0.345, + shape='square', + color='red', + miles=22.0) +``` + + + + +%package -n python3-Represent +Summary: Create __repr__ automatically or declaratively. +Provides: python-Represent +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-Represent +## Represent +[![PyPI Version][ppi]][ppl] [![Documentation][di]][dl] [![CI Status][gai]][gal] [![Coverage][cvi]][cvl] [![Python Version][pvi]][pvl] [![MIT License][mli]][mll] + + [ppi]: https://img.shields.io/pypi/v/represent.svg?style=flat-square + [ppl]: https://pypi.python.org/pypi/represent/ + [pvi]: https://img.shields.io/badge/python-2.7%2C%203-brightgreen.svg?style=flat-square + [pvl]: https://www.python.org/downloads/ + [mli]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square + [mll]: https://raw.githubusercontent.com/RazerM/represent/master/LICENSE + [di]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat-square + [dl]: https://represent.readthedocs.io/en/latest/ + [gai]: https://github.com/RazerM/represent/workflows/CI/badge.svg?branch=master + [gal]: https://github.com/RazerM/represent/actions?workflow=CI + [cvi]: https://img.shields.io/codecov/c/github/RazerM/represent/master.svg?style=flat-square + [cvl]: https://codecov.io/github/RazerM/represent?branch=master + +### Installation + +```bash +$ pip install represent +``` + +### Automatic Generation + +```python +from represent import autorepr + + +@autorepr +class Rectangle: + def __init__(self, name, color, width, height): + self.name = name + self.color = color + self.width = width + self.height = height + +rect = Rectangle('Timothy', 'red', 15, 4.5) +print(rect) +``` + +``` +Rectangle(name='Timothy', color='red', width=15, height=4.5) +``` + +### Declarative Generation + +```python +from represent import ReprHelperMixin + + +class ContrivedExample(ReprHelperMixin, object): + def __init__(self, description, radians, shape, color, miles): + self.description = description + self.degrees = radians * 180 / 3.141592654 + self.shape = shape + self._color = color + self.km = 1.60934 * miles + + def _repr_helper_(self, r): + r.positional_from_attr('description') + r.positional_with_value(self.degrees * 3.141592654 / 180) + r.keyword_from_attr('shape') + r.keyword_from_attr('color', '_color') + r.keyword_with_value('miles', self.km / 1.60934) + +ce = ContrivedExample('does something', 0.345, 'square', 'red', 22) + +print(ce) +from IPython.lib.pretty import pprint +pprint(ce) +``` + +``` +ContrivedExample('does something', 0.345, shape='square', color='red', miles=22.0) +ContrivedExample('does something', + 0.345, + shape='square', + color='red', + miles=22.0) +``` + + + + +%package help +Summary: Development documents and examples for Represent +Provides: python3-Represent-doc +%description help +## Represent +[![PyPI Version][ppi]][ppl] [![Documentation][di]][dl] [![CI Status][gai]][gal] [![Coverage][cvi]][cvl] [![Python Version][pvi]][pvl] [![MIT License][mli]][mll] + + [ppi]: https://img.shields.io/pypi/v/represent.svg?style=flat-square + [ppl]: https://pypi.python.org/pypi/represent/ + [pvi]: https://img.shields.io/badge/python-2.7%2C%203-brightgreen.svg?style=flat-square + [pvl]: https://www.python.org/downloads/ + [mli]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square + [mll]: https://raw.githubusercontent.com/RazerM/represent/master/LICENSE + [di]: https://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat-square + [dl]: https://represent.readthedocs.io/en/latest/ + [gai]: https://github.com/RazerM/represent/workflows/CI/badge.svg?branch=master + [gal]: https://github.com/RazerM/represent/actions?workflow=CI + [cvi]: https://img.shields.io/codecov/c/github/RazerM/represent/master.svg?style=flat-square + [cvl]: https://codecov.io/github/RazerM/represent?branch=master + +### Installation + +```bash +$ pip install represent +``` + +### Automatic Generation + +```python +from represent import autorepr + + +@autorepr +class Rectangle: + def __init__(self, name, color, width, height): + self.name = name + self.color = color + self.width = width + self.height = height + +rect = Rectangle('Timothy', 'red', 15, 4.5) +print(rect) +``` + +``` +Rectangle(name='Timothy', color='red', width=15, height=4.5) +``` + +### Declarative Generation + +```python +from represent import ReprHelperMixin + + +class ContrivedExample(ReprHelperMixin, object): + def __init__(self, description, radians, shape, color, miles): + self.description = description + self.degrees = radians * 180 / 3.141592654 + self.shape = shape + self._color = color + self.km = 1.60934 * miles + + def _repr_helper_(self, r): + r.positional_from_attr('description') + r.positional_with_value(self.degrees * 3.141592654 / 180) + r.keyword_from_attr('shape') + r.keyword_from_attr('color', '_color') + r.keyword_with_value('miles', self.km / 1.60934) + +ce = ContrivedExample('does something', 0.345, 'square', 'red', 22) + +print(ce) +from IPython.lib.pretty import pprint +pprint(ce) +``` + +``` +ContrivedExample('does something', 0.345, shape='square', color='red', miles=22.0) +ContrivedExample('does something', + 0.345, + shape='square', + color='red', + miles=22.0) +``` + + + + +%prep +%autosetup -n Represent-1.6.0.post0 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-Represent -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu Mar 09 2023 Python_Bot <Python_Bot@openeuler.org> - 1.6.0.post0-1 +- Package Spec generated @@ -0,0 +1 @@ +e9a54492225eebd6b4a1427409b6425e Represent-1.6.0.post0.tar.gz |