RHEL 9.0.0 Alpha bootstrap

The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/python-toml#61574d362caa393311f4de16cc9f834521394e71
This commit is contained in:
Troy Dawson 2020-11-16 13:48:19 -08:00
parent 676be5dd19
commit 8ddf9f21e7
3 changed files with 6 additions and 68 deletions

View File

@ -7,7 +7,7 @@ toml file.
Name: python-%{pypi_name}
Version: 0.10.1
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Python Library for Tom's Obvious, Minimal Language
License: MIT
@ -38,6 +38,8 @@ Summary: %{summary}
%prep
%autosetup -p1 -n %{pypi_name}-%{version}
# https://github.com/uiri/toml/pull/339
sed -i '/pytest-cov/d' tox.ini
%generate_buildrequires
@ -69,6 +71,9 @@ toml-test $(pwd)/tests/decoding_test3.sh
%changelog
* Fri Nov 13 2020 Miro Hrončok <mhroncok@redhat.com> - 0.10.1-4
- Don't BR pytest-cov
* Thu Sep 03 2020 Miro Hrončok <mhroncok@redhat.com> - 0.10.1-3
- Use pyproject-rpm-macros

View File

@ -1,56 +0,0 @@
#!/usr/bin/env python2
import datetime
import json
import sys
import toml
try:
_range = xrange
iteritems = dict.iteritems
except NameError:
unicode = str
_range = range
basestring = str
unichr = chr
iteritems = dict.items
long = int
def tag(value):
if isinstance(value, dict):
d = { }
for k, v in iteritems(value):
d[k] = tag(v)
return d
elif isinstance(value, list):
a = []
for v in value:
a.append(tag(v))
try:
a[0]["value"]
except KeyError:
return a
except IndexError:
pass
return {'type': 'array', 'value': a}
elif isinstance(value, basestring):
return {'type': 'string', 'value': value}
elif isinstance(value, bool):
return {'type': 'bool', 'value': str(value).lower()}
elif isinstance(value, int):
return {'type': 'integer', 'value': str(value)}
elif isinstance(value, long):
return {'type': 'integer', 'value': str(value)}
elif isinstance(value, float):
return {'type': 'float', 'value': repr(value)}
elif isinstance(value, datetime.datetime):
sdate = value.strftime('%Y-%m-%dT%H:%M:%SZ')
return {'type': 'datetime', 'value': sdate}
assert False, 'Unknown type: %s' % type(value)
if __name__ == '__main__':
tdata = toml.loads(sys.stdin.read())
tagged = tag(tdata)
print(json.dumps(tagged))

View File

@ -1,11 +0,0 @@
#!/usr/bin/env python3
import toml_test
import toml
import sys
import json
if __name__ == '__main__':
tdata = toml.loads(sys.stdin.read())
tagged = toml_test.tag(tdata)
print(json.dumps(tagged))