From fc53577fdf08a83f871e68b39d438a7ae90a631d Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 10 Apr 2023 16:18:25 +0000 Subject: automatic import of python-dynamodb-json --- python-dynamodb-json.spec | 333 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 333 insertions(+) create mode 100644 python-dynamodb-json.spec (limited to 'python-dynamodb-json.spec') diff --git a/python-dynamodb-json.spec b/python-dynamodb-json.spec new file mode 100644 index 0000000..b28d915 --- /dev/null +++ b/python-dynamodb-json.spec @@ -0,0 +1,333 @@ +%global _empty_manifest_terminate_build 0 +Name: python-dynamodb-json +Version: 1.3 +Release: 1 +Summary: A DynamoDB json util from and to python objects +License: Mozilla +URL: https://github.com/Alonreznik/dynamodb-json +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a3/cb/951fe17016ea768a73eb046effd8762a93bd4f3ae7a420833f1e642e86da/dynamodb-json-1.3.tar.gz +BuildArch: noarch + +Requires: python3-simplejson +Requires: python3-boto3 +Requires: python3-six + +%description +# DynamoDB Json +DynamoDB json util to load and dump strings of Dynamodb json format to python object and vise-versa + +# Install +just use pip: +``` +pip install dynamodb-json +``` +# Use + +The dynamodb-json util works the same as json loads and dumps functions: +```python +import time +import uuid +from datetime import datetime +from decimal import Decimal + +from dynamodb_json import json_util as json + +json_ = {"MyString": "a", + "num": 4, + "MyBool": False, + "my_dict": {"my_date": datetime.utcnow()}, + "MyNone": None, + "MyZero": 0, + "myDecimal": Decimal("19.2"), # converts Decimal to float, load it as float + "myLong": long(1938475658493), + "MyNestedDict": { + "my_other_nested": { + "name": "John", + "surname": "Lennon", + "MyOtherNone": None, + "floaty": float(29.4), + "myList": [1, 3, 4, 5, 6, "This Is Sparta!"], + "mySet": {1, 3, 4, 5, 6}, # converts set to list, returns as list + "myUUID": uuid.uuid4(), # converts uuid to string, loads it as string + "time": time.time() # converts it to seconds python float, loads it as float + } + } + } + +dynamodb_json = json.dumps(json_) + +# { +# "my_dict": {"M": {"my_date": {"S": "2017-04-22T14:41:35.780000"}}}, +# "MyBool": {"BOOL": false}, "MyNone": {"NULL": true}, +# "MyNestedDict": { +# "M": {"my_other_nested": { +# "M": {"myUUID": {"S": "2f4ad21e098f49b18e22ad209779048b"}, +# "surname": {"S": "Lennon"}, "name": {"S": "John"}, +# "mySet": {"L": [{"N": "1"}, {"N": "3"}, {"N": "4"}, {"N": "5"}, {"N": "6"}]}, +# "floaty": {"N": "29.4"}, "time": {"N": "1492872095.78"}, +# "myList": {"L": [{"N": "1"}, {"N": "3"}, {"N": "4"}, {"N": "5"}, {"N": "6"}, {"S": "This Is Sparta!"}]}, +# "MyOtherNone": {"NULL": true}} +# } +# } +# }, +# "myDecimal": {"N": "19.2"}, "num": {"N": "4"}, +# "MyString": {"S": "a"}, +# "myLong": {"N": "1938475658493"}, +# "MyZero": {"N": "0"} +# } + + +json.loads(dynamodb_json) + +# {'my_dict': {'my_date': datetime.datetime(2017, 4, 22, 14, 41, 35, 780000)}, 'MyBool': False, 'MyNone': None, +# 'MyNestedDict': { +# 'my_other_nested': {'myUUID': '2f4ad21e098f49b18e22ad209779048b', +# 'surname': 'Lennon', 'name': 'John', +# 'mySet': [1, 3, 4, 5, 6], +# 'floaty': 29.4, +# 'time': 1492872095.78, +# 'myList': [1, 3, 4, 5, 6, 'This Is Sparta!'], +# 'MyOtherNone': None +# } +# }, +# 'myDecimal': 19.2, +# 'num': 4, +# 'MyString': 'a', +# 'myLong': 1938475658493L, +# 'MyZero': 0 +# } +``` + + + + +%package -n python3-dynamodb-json +Summary: A DynamoDB json util from and to python objects +Provides: python-dynamodb-json +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-dynamodb-json +# DynamoDB Json +DynamoDB json util to load and dump strings of Dynamodb json format to python object and vise-versa + +# Install +just use pip: +``` +pip install dynamodb-json +``` +# Use + +The dynamodb-json util works the same as json loads and dumps functions: +```python +import time +import uuid +from datetime import datetime +from decimal import Decimal + +from dynamodb_json import json_util as json + +json_ = {"MyString": "a", + "num": 4, + "MyBool": False, + "my_dict": {"my_date": datetime.utcnow()}, + "MyNone": None, + "MyZero": 0, + "myDecimal": Decimal("19.2"), # converts Decimal to float, load it as float + "myLong": long(1938475658493), + "MyNestedDict": { + "my_other_nested": { + "name": "John", + "surname": "Lennon", + "MyOtherNone": None, + "floaty": float(29.4), + "myList": [1, 3, 4, 5, 6, "This Is Sparta!"], + "mySet": {1, 3, 4, 5, 6}, # converts set to list, returns as list + "myUUID": uuid.uuid4(), # converts uuid to string, loads it as string + "time": time.time() # converts it to seconds python float, loads it as float + } + } + } + +dynamodb_json = json.dumps(json_) + +# { +# "my_dict": {"M": {"my_date": {"S": "2017-04-22T14:41:35.780000"}}}, +# "MyBool": {"BOOL": false}, "MyNone": {"NULL": true}, +# "MyNestedDict": { +# "M": {"my_other_nested": { +# "M": {"myUUID": {"S": "2f4ad21e098f49b18e22ad209779048b"}, +# "surname": {"S": "Lennon"}, "name": {"S": "John"}, +# "mySet": {"L": [{"N": "1"}, {"N": "3"}, {"N": "4"}, {"N": "5"}, {"N": "6"}]}, +# "floaty": {"N": "29.4"}, "time": {"N": "1492872095.78"}, +# "myList": {"L": [{"N": "1"}, {"N": "3"}, {"N": "4"}, {"N": "5"}, {"N": "6"}, {"S": "This Is Sparta!"}]}, +# "MyOtherNone": {"NULL": true}} +# } +# } +# }, +# "myDecimal": {"N": "19.2"}, "num": {"N": "4"}, +# "MyString": {"S": "a"}, +# "myLong": {"N": "1938475658493"}, +# "MyZero": {"N": "0"} +# } + + +json.loads(dynamodb_json) + +# {'my_dict': {'my_date': datetime.datetime(2017, 4, 22, 14, 41, 35, 780000)}, 'MyBool': False, 'MyNone': None, +# 'MyNestedDict': { +# 'my_other_nested': {'myUUID': '2f4ad21e098f49b18e22ad209779048b', +# 'surname': 'Lennon', 'name': 'John', +# 'mySet': [1, 3, 4, 5, 6], +# 'floaty': 29.4, +# 'time': 1492872095.78, +# 'myList': [1, 3, 4, 5, 6, 'This Is Sparta!'], +# 'MyOtherNone': None +# } +# }, +# 'myDecimal': 19.2, +# 'num': 4, +# 'MyString': 'a', +# 'myLong': 1938475658493L, +# 'MyZero': 0 +# } +``` + + + + +%package help +Summary: Development documents and examples for dynamodb-json +Provides: python3-dynamodb-json-doc +%description help +# DynamoDB Json +DynamoDB json util to load and dump strings of Dynamodb json format to python object and vise-versa + +# Install +just use pip: +``` +pip install dynamodb-json +``` +# Use + +The dynamodb-json util works the same as json loads and dumps functions: +```python +import time +import uuid +from datetime import datetime +from decimal import Decimal + +from dynamodb_json import json_util as json + +json_ = {"MyString": "a", + "num": 4, + "MyBool": False, + "my_dict": {"my_date": datetime.utcnow()}, + "MyNone": None, + "MyZero": 0, + "myDecimal": Decimal("19.2"), # converts Decimal to float, load it as float + "myLong": long(1938475658493), + "MyNestedDict": { + "my_other_nested": { + "name": "John", + "surname": "Lennon", + "MyOtherNone": None, + "floaty": float(29.4), + "myList": [1, 3, 4, 5, 6, "This Is Sparta!"], + "mySet": {1, 3, 4, 5, 6}, # converts set to list, returns as list + "myUUID": uuid.uuid4(), # converts uuid to string, loads it as string + "time": time.time() # converts it to seconds python float, loads it as float + } + } + } + +dynamodb_json = json.dumps(json_) + +# { +# "my_dict": {"M": {"my_date": {"S": "2017-04-22T14:41:35.780000"}}}, +# "MyBool": {"BOOL": false}, "MyNone": {"NULL": true}, +# "MyNestedDict": { +# "M": {"my_other_nested": { +# "M": {"myUUID": {"S": "2f4ad21e098f49b18e22ad209779048b"}, +# "surname": {"S": "Lennon"}, "name": {"S": "John"}, +# "mySet": {"L": [{"N": "1"}, {"N": "3"}, {"N": "4"}, {"N": "5"}, {"N": "6"}]}, +# "floaty": {"N": "29.4"}, "time": {"N": "1492872095.78"}, +# "myList": {"L": [{"N": "1"}, {"N": "3"}, {"N": "4"}, {"N": "5"}, {"N": "6"}, {"S": "This Is Sparta!"}]}, +# "MyOtherNone": {"NULL": true}} +# } +# } +# }, +# "myDecimal": {"N": "19.2"}, "num": {"N": "4"}, +# "MyString": {"S": "a"}, +# "myLong": {"N": "1938475658493"}, +# "MyZero": {"N": "0"} +# } + + +json.loads(dynamodb_json) + +# {'my_dict': {'my_date': datetime.datetime(2017, 4, 22, 14, 41, 35, 780000)}, 'MyBool': False, 'MyNone': None, +# 'MyNestedDict': { +# 'my_other_nested': {'myUUID': '2f4ad21e098f49b18e22ad209779048b', +# 'surname': 'Lennon', 'name': 'John', +# 'mySet': [1, 3, 4, 5, 6], +# 'floaty': 29.4, +# 'time': 1492872095.78, +# 'myList': [1, 3, 4, 5, 6, 'This Is Sparta!'], +# 'MyOtherNone': None +# } +# }, +# 'myDecimal': 19.2, +# 'num': 4, +# 'MyString': 'a', +# 'myLong': 1938475658493L, +# 'MyZero': 0 +# } +``` + + + + +%prep +%autosetup -n dynamodb-json-1.3 + +%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-dynamodb-json -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot - 1.3-1 +- Package Spec generated -- cgit v1.2.3