From 975882ff21ba558025005acf02df712be0ef309d Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 15 May 2023 04:46:11 +0000 Subject: automatic import of python-jsoncodable --- .gitignore | 1 + python-jsoncodable.spec | 428 ++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 430 insertions(+) create mode 100644 python-jsoncodable.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..7af9c19 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/jsoncodable-0.1.7.tar.gz diff --git a/python-jsoncodable.spec b/python-jsoncodable.spec new file mode 100644 index 0000000..5542193 --- /dev/null +++ b/python-jsoncodable.spec @@ -0,0 +1,428 @@ +%global _empty_manifest_terminate_build 0 +Name: python-jsoncodable +Version: 0.1.7 +Release: 1 +Summary: to_dict +License: MIT License +URL: https://github.com/kkristof200/py_jsoncodable +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/98/fd/d7acfde399f802e6b60c38555ffcd320e057a0a8e0b5aaf6dadb5dc125c4/jsoncodable-0.1.7.tar.gz +BuildArch: noarch + +Requires: python3-jsonpickle +Requires: python3-noraise + +%description +# jsoncodable + +![PyPI - package version](https://img.shields.io/pypi/v/jsoncodable?logo=pypi&style=flat-square) +![PyPI - license](https://img.shields.io/pypi/l/jsoncodable?label=package%20license&style=flat-square) +![PyPI - python version](https://img.shields.io/pypi/pyversions/jsoncodable?logo=pypi&style=flat-square) +![PyPI - downloads](https://img.shields.io/pypi/dm/jsoncodable?logo=pypi&style=flat-square) + +![GitHub - last commit](https://img.shields.io/github/last-commit/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - commit activity](https://img.shields.io/github/commit-activity/m/kkristof200/py_jsoncodable?style=flat-square) + +![GitHub - code size in bytes](https://img.shields.io/github/languages/code-size/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - repo size](https://img.shields.io/github/repo-size/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - lines of code](https://img.shields.io/tokei/lines/github/kkristof200/py_jsoncodable?style=flat-square) + +![GitHub - license](https://img.shields.io/github/license/kkristof200/py_jsoncodable?label=repo%20license&style=flat-square) + +## Description + +Easily create object from any dict/jsonstr/jsonfile and dict/jsonstr/jsonfile from any object + +From v0.1.0 it is based on [jsonpickle](https://github.com/jsonpickle/jsonpickle) + +## Install + +~~~~bash +pip install jsoncodable +# or +pip3 install jsoncodable +~~~~ + +## Usage + +~~~~python +from jsoncodable import JSONCodable, CompressionAlgorithm + +class BirthDay(JSONCodable): + def __init__( + self, + month: int, + day: int + ): + self.month = month + self.day = day + +class Person(JSONCodable): + def __init__( + self, + name: str, + birth_month: int, + birth_day: int + ): + self.name = name + self.birth_day = BirthDay(birth_month, birth_day) + +person = Person( + name='John', + birth_month=7, + birth_day=7 +) + + +person.jsonprint() + +# prints +# +# { +# "name": "John", +# "birth_day": { +# "month": 7, +# "day": 7 +# } +# } + + +Person.load(person.json).jsonprint() + +# prints +# +# { +# "name": "John", +# "birth_day": { +# "month": 7, +# "day": 7 +# } +# } + +import os + +# Save with compression +json_file_path = 'test.json' + +for c in CompressionAlgorithm: + compressed_file_path = person.save(json_file_path, compression=c) + # returns a file path which has the compressed extension if not present at the end of your provided path + # also prints a message to let you know, that the path had been modified + + + Person.load(compressed_file_path).jsonprint() + # prints + # + # { + # "name": "John", + # "birth_day": { + # "month": 7, + # "day": 7 + # } + # } + + + # Cleaning up + + os.remove(compressed_file_path) +~~~~ + +## Dependencies + +[jsonpickle](https://pypi.org/project/jsonpickle), [noraise](https://pypi.org/project/noraise) + + + +%package -n python3-jsoncodable +Summary: to_dict +Provides: python-jsoncodable +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-jsoncodable +# jsoncodable + +![PyPI - package version](https://img.shields.io/pypi/v/jsoncodable?logo=pypi&style=flat-square) +![PyPI - license](https://img.shields.io/pypi/l/jsoncodable?label=package%20license&style=flat-square) +![PyPI - python version](https://img.shields.io/pypi/pyversions/jsoncodable?logo=pypi&style=flat-square) +![PyPI - downloads](https://img.shields.io/pypi/dm/jsoncodable?logo=pypi&style=flat-square) + +![GitHub - last commit](https://img.shields.io/github/last-commit/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - commit activity](https://img.shields.io/github/commit-activity/m/kkristof200/py_jsoncodable?style=flat-square) + +![GitHub - code size in bytes](https://img.shields.io/github/languages/code-size/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - repo size](https://img.shields.io/github/repo-size/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - lines of code](https://img.shields.io/tokei/lines/github/kkristof200/py_jsoncodable?style=flat-square) + +![GitHub - license](https://img.shields.io/github/license/kkristof200/py_jsoncodable?label=repo%20license&style=flat-square) + +## Description + +Easily create object from any dict/jsonstr/jsonfile and dict/jsonstr/jsonfile from any object + +From v0.1.0 it is based on [jsonpickle](https://github.com/jsonpickle/jsonpickle) + +## Install + +~~~~bash +pip install jsoncodable +# or +pip3 install jsoncodable +~~~~ + +## Usage + +~~~~python +from jsoncodable import JSONCodable, CompressionAlgorithm + +class BirthDay(JSONCodable): + def __init__( + self, + month: int, + day: int + ): + self.month = month + self.day = day + +class Person(JSONCodable): + def __init__( + self, + name: str, + birth_month: int, + birth_day: int + ): + self.name = name + self.birth_day = BirthDay(birth_month, birth_day) + +person = Person( + name='John', + birth_month=7, + birth_day=7 +) + + +person.jsonprint() + +# prints +# +# { +# "name": "John", +# "birth_day": { +# "month": 7, +# "day": 7 +# } +# } + + +Person.load(person.json).jsonprint() + +# prints +# +# { +# "name": "John", +# "birth_day": { +# "month": 7, +# "day": 7 +# } +# } + +import os + +# Save with compression +json_file_path = 'test.json' + +for c in CompressionAlgorithm: + compressed_file_path = person.save(json_file_path, compression=c) + # returns a file path which has the compressed extension if not present at the end of your provided path + # also prints a message to let you know, that the path had been modified + + + Person.load(compressed_file_path).jsonprint() + # prints + # + # { + # "name": "John", + # "birth_day": { + # "month": 7, + # "day": 7 + # } + # } + + + # Cleaning up + + os.remove(compressed_file_path) +~~~~ + +## Dependencies + +[jsonpickle](https://pypi.org/project/jsonpickle), [noraise](https://pypi.org/project/noraise) + + + +%package help +Summary: Development documents and examples for jsoncodable +Provides: python3-jsoncodable-doc +%description help +# jsoncodable + +![PyPI - package version](https://img.shields.io/pypi/v/jsoncodable?logo=pypi&style=flat-square) +![PyPI - license](https://img.shields.io/pypi/l/jsoncodable?label=package%20license&style=flat-square) +![PyPI - python version](https://img.shields.io/pypi/pyversions/jsoncodable?logo=pypi&style=flat-square) +![PyPI - downloads](https://img.shields.io/pypi/dm/jsoncodable?logo=pypi&style=flat-square) + +![GitHub - last commit](https://img.shields.io/github/last-commit/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - commit activity](https://img.shields.io/github/commit-activity/m/kkristof200/py_jsoncodable?style=flat-square) + +![GitHub - code size in bytes](https://img.shields.io/github/languages/code-size/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - repo size](https://img.shields.io/github/repo-size/kkristof200/py_jsoncodable?style=flat-square) +![GitHub - lines of code](https://img.shields.io/tokei/lines/github/kkristof200/py_jsoncodable?style=flat-square) + +![GitHub - license](https://img.shields.io/github/license/kkristof200/py_jsoncodable?label=repo%20license&style=flat-square) + +## Description + +Easily create object from any dict/jsonstr/jsonfile and dict/jsonstr/jsonfile from any object + +From v0.1.0 it is based on [jsonpickle](https://github.com/jsonpickle/jsonpickle) + +## Install + +~~~~bash +pip install jsoncodable +# or +pip3 install jsoncodable +~~~~ + +## Usage + +~~~~python +from jsoncodable import JSONCodable, CompressionAlgorithm + +class BirthDay(JSONCodable): + def __init__( + self, + month: int, + day: int + ): + self.month = month + self.day = day + +class Person(JSONCodable): + def __init__( + self, + name: str, + birth_month: int, + birth_day: int + ): + self.name = name + self.birth_day = BirthDay(birth_month, birth_day) + +person = Person( + name='John', + birth_month=7, + birth_day=7 +) + + +person.jsonprint() + +# prints +# +# { +# "name": "John", +# "birth_day": { +# "month": 7, +# "day": 7 +# } +# } + + +Person.load(person.json).jsonprint() + +# prints +# +# { +# "name": "John", +# "birth_day": { +# "month": 7, +# "day": 7 +# } +# } + +import os + +# Save with compression +json_file_path = 'test.json' + +for c in CompressionAlgorithm: + compressed_file_path = person.save(json_file_path, compression=c) + # returns a file path which has the compressed extension if not present at the end of your provided path + # also prints a message to let you know, that the path had been modified + + + Person.load(compressed_file_path).jsonprint() + # prints + # + # { + # "name": "John", + # "birth_day": { + # "month": 7, + # "day": 7 + # } + # } + + + # Cleaning up + + os.remove(compressed_file_path) +~~~~ + +## Dependencies + +[jsonpickle](https://pypi.org/project/jsonpickle), [noraise](https://pypi.org/project/noraise) + + + +%prep +%autosetup -n jsoncodable-0.1.7 + +%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-jsoncodable -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon May 15 2023 Python_Bot - 0.1.7-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..b5f8e3e --- /dev/null +++ b/sources @@ -0,0 +1 @@ +834763d94cb6c728ee5d38408b1df89b jsoncodable-0.1.7.tar.gz -- cgit v1.2.3