summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-18 05:10:58 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-18 05:10:58 +0000
commit7e335db2e98ce94a8a1514edc91b818e8e9fa90c (patch)
tree14401094521f8d6dfcb679b96039b87b7ae237b9
parent28a63ff77973ba866cdcdc683e2d0119b42aa21e (diff)
automatic import of python-declxml
-rw-r--r--.gitignore1
-rw-r--r--python-declxml.spec630
-rw-r--r--sources1
3 files changed, 632 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..ff77928 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/declxml-1.1.3.tar.gz
diff --git a/python-declxml.spec b/python-declxml.spec
new file mode 100644
index 0000000..1266afa
--- /dev/null
+++ b/python-declxml.spec
@@ -0,0 +1,630 @@
+%global _empty_manifest_terminate_build 0
+Name: python-declxml
+Version: 1.1.3
+Release: 1
+Summary: Declarative XML processing library
+License: MIT
+URL: http://declxml.readthedocs.io/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/6c/2a/51d5fcd89783b06e40a4dba7ec1f4002eb6df21a6e5763610328c1efc10f/declxml-1.1.3.tar.gz
+BuildArch: noarch
+
+
+%description
+# declxml - Declarative XML Processing
+
+[![PyPI version](https://badge.fury.io/py/declxml.svg)](https://badge.fury.io/py/declxml)
+[![Python Versions](https://img.shields.io/pypi/pyversions/declxml.svg)](https://pypi.org/project/declxml/)
+[![Build Status](https://gregscottatkin.visualstudio.com/declxml/_apis/build/status/gatkin.declxml)](https://gregscottatkin.visualstudio.com/declxml/_build/latest?definitionId=1)
+[![codecov](https://codecov.io/gh/gatkin/declxml/branch/master/graph/badge.svg)](https://codecov.io/gh/gatkin/declxml)
+[![Documentation Status](https://readthedocs.org/projects/declxml/badge/?version=latest)](https://declxml.readthedocs.io/en/latest/?badge=latest)
+[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/gatkin/declxml/blob/master/LICENSE)
+
+XML processing made easy. No more writing and maintaining dozens or hundreds of lines of imperative serialization and parsing logic. With declxml, you declaratively define the structure of your XML document and let declxml handle the rest.
+
+## Installation
+
+Install using either pip
+
+```bash
+pip install declxml
+```
+
+or [Pipenv](https://docs.pipenv.org/)
+
+```bash
+pipenv install declxml
+```
+
+## Documentation
+
+For detailed documentation, see the project's [documentation page](http://declxml.readthedocs.io/).
+
+## Usage
+
+Given some XML to process
+
+```xml
+<author>
+ <name>Robert A. Heinlein</name>
+ <birth-year>1907</birth-year>
+ <book>
+ <title>Starship Troopers</title>
+ <published>1959</published>
+ </book>
+ <book>
+ <title>Stranger in a Strange Land</title>
+ <published>1961</published>
+ </book>
+</author>
+```
+
+Create a declxml processor that defines the structure of the document
+
+```python
+>>> import declxml as xml
+
+>>> author_processor = xml.dictionary('author', [
+... xml.string('name'),
+... xml.integer('birth-year'),
+... xml.array(xml.dictionary('book', [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+```
+
+Then use that processor to parse the XML data
+
+```python
+>>> from pprint import pprint
+>>> author_xml = """
+... <author>
+... <name>Robert A. Heinlein</name>
+... <birth-year>1907</birth-year>
+... <book>
+... <title>Starship Troopers</title>
+... <published>1959</published>
+... </book>
+... <book>
+... <title>Stranger in a Strange Land</title>
+... <published>1961</published>
+... </book>
+... </author>
+... """
+>>> pprint(xml.parse_from_string(author_processor, author_xml))
+{'birth-year': 1907,
+ 'books': [{'published': 1959, 'title': 'Starship Troopers'},
+ {'published': 1961, 'title': 'Stranger in a Strange Land'}],
+ 'name': 'Robert A. Heinlein'}
+
+```
+
+The same processor can also be used to serialize data to XML
+
+```python
+>>> author = {
+... 'birth-year': 1920,
+... 'name': 'Issac Asimov',
+... 'books': [
+... {
+... 'title': 'I, Robot',
+... 'published': 1950
+... },
+... {
+... 'title': 'Foundation',
+... 'published': 1951
+... }
+... ]
+... }
+
+
+>>> print(xml.serialize_to_string(author_processor, author, indent=' '))
+<?xml version="1.0" encoding="utf-8"?>
+<author>
+ <name>Issac Asimov</name>
+ <birth-year>1920</birth-year>
+ <book>
+ <title>I, Robot</title>
+ <published>1950</published>
+ </book>
+ <book>
+ <title>Foundation</title>
+ <published>1951</published>
+ </book>
+</author>
+
+```
+
+Want to work with objects instead of dictionaries? You can do that with declxml too
+
+```python
+>>> class Author:
+...
+... def __init__(self):
+... self.name = None
+... self.birth_year = None
+... self.books = []
+...
+... def __repr__(self):
+... return 'Author(name=\'{}\', birth_year={}, books={})'.format(
+... self.name, self.birth_year, self.books)
+
+>>> class Book:
+...
+... def __init__(self):
+... self.title = None
+... self.published = None
+...
+... def __repr__(self):
+... return 'Book(title=\'{}\', published={})'.format(self.title, self.published)
+...
+
+>>> author_processor = xml.user_object('author', Author, [
+... xml.string('name'),
+... xml.integer('birth-year', alias='birth_year'),
+... xml.array(xml.user_object('book', Book, [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+>>> xml.parse_from_string(author_processor, author_xml)
+Author(name='Robert A. Heinlein', birth_year=1907, books=[Book(title='Starship Troopers', published=1959), Book(title='Stranger in a Strange Land', published=1961)])
+
+```
+
+What about namedtuples, you say? Those are extremely useful, and declxml lets you work with them as well
+
+```python
+>>> from collections import namedtuple
+
+
+>>> Author = namedtuple('Author', ['name', 'birth_year', 'books'])
+>>> Book = namedtuple('Book', ['title', 'published'])
+
+
+>>> author_processor = xml.named_tuple('author', Author, [
+... xml.string('name'),
+... xml.integer('birth-year', alias='birth_year'),
+... xml.array(xml.named_tuple('book', Book, [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+>>> xml.parse_from_string(author_processor, author_xml)
+Author(name='Robert A. Heinlein', birth_year=1907, books=[Book(title='Starship Troopers', published=1959), Book(title='Stranger in a Strange Land', published=1961)])
+
+```
+
+%package -n python3-declxml
+Summary: Declarative XML processing library
+Provides: python-declxml
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-declxml
+# declxml - Declarative XML Processing
+
+[![PyPI version](https://badge.fury.io/py/declxml.svg)](https://badge.fury.io/py/declxml)
+[![Python Versions](https://img.shields.io/pypi/pyversions/declxml.svg)](https://pypi.org/project/declxml/)
+[![Build Status](https://gregscottatkin.visualstudio.com/declxml/_apis/build/status/gatkin.declxml)](https://gregscottatkin.visualstudio.com/declxml/_build/latest?definitionId=1)
+[![codecov](https://codecov.io/gh/gatkin/declxml/branch/master/graph/badge.svg)](https://codecov.io/gh/gatkin/declxml)
+[![Documentation Status](https://readthedocs.org/projects/declxml/badge/?version=latest)](https://declxml.readthedocs.io/en/latest/?badge=latest)
+[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/gatkin/declxml/blob/master/LICENSE)
+
+XML processing made easy. No more writing and maintaining dozens or hundreds of lines of imperative serialization and parsing logic. With declxml, you declaratively define the structure of your XML document and let declxml handle the rest.
+
+## Installation
+
+Install using either pip
+
+```bash
+pip install declxml
+```
+
+or [Pipenv](https://docs.pipenv.org/)
+
+```bash
+pipenv install declxml
+```
+
+## Documentation
+
+For detailed documentation, see the project's [documentation page](http://declxml.readthedocs.io/).
+
+## Usage
+
+Given some XML to process
+
+```xml
+<author>
+ <name>Robert A. Heinlein</name>
+ <birth-year>1907</birth-year>
+ <book>
+ <title>Starship Troopers</title>
+ <published>1959</published>
+ </book>
+ <book>
+ <title>Stranger in a Strange Land</title>
+ <published>1961</published>
+ </book>
+</author>
+```
+
+Create a declxml processor that defines the structure of the document
+
+```python
+>>> import declxml as xml
+
+>>> author_processor = xml.dictionary('author', [
+... xml.string('name'),
+... xml.integer('birth-year'),
+... xml.array(xml.dictionary('book', [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+```
+
+Then use that processor to parse the XML data
+
+```python
+>>> from pprint import pprint
+>>> author_xml = """
+... <author>
+... <name>Robert A. Heinlein</name>
+... <birth-year>1907</birth-year>
+... <book>
+... <title>Starship Troopers</title>
+... <published>1959</published>
+... </book>
+... <book>
+... <title>Stranger in a Strange Land</title>
+... <published>1961</published>
+... </book>
+... </author>
+... """
+>>> pprint(xml.parse_from_string(author_processor, author_xml))
+{'birth-year': 1907,
+ 'books': [{'published': 1959, 'title': 'Starship Troopers'},
+ {'published': 1961, 'title': 'Stranger in a Strange Land'}],
+ 'name': 'Robert A. Heinlein'}
+
+```
+
+The same processor can also be used to serialize data to XML
+
+```python
+>>> author = {
+... 'birth-year': 1920,
+... 'name': 'Issac Asimov',
+... 'books': [
+... {
+... 'title': 'I, Robot',
+... 'published': 1950
+... },
+... {
+... 'title': 'Foundation',
+... 'published': 1951
+... }
+... ]
+... }
+
+
+>>> print(xml.serialize_to_string(author_processor, author, indent=' '))
+<?xml version="1.0" encoding="utf-8"?>
+<author>
+ <name>Issac Asimov</name>
+ <birth-year>1920</birth-year>
+ <book>
+ <title>I, Robot</title>
+ <published>1950</published>
+ </book>
+ <book>
+ <title>Foundation</title>
+ <published>1951</published>
+ </book>
+</author>
+
+```
+
+Want to work with objects instead of dictionaries? You can do that with declxml too
+
+```python
+>>> class Author:
+...
+... def __init__(self):
+... self.name = None
+... self.birth_year = None
+... self.books = []
+...
+... def __repr__(self):
+... return 'Author(name=\'{}\', birth_year={}, books={})'.format(
+... self.name, self.birth_year, self.books)
+
+>>> class Book:
+...
+... def __init__(self):
+... self.title = None
+... self.published = None
+...
+... def __repr__(self):
+... return 'Book(title=\'{}\', published={})'.format(self.title, self.published)
+...
+
+>>> author_processor = xml.user_object('author', Author, [
+... xml.string('name'),
+... xml.integer('birth-year', alias='birth_year'),
+... xml.array(xml.user_object('book', Book, [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+>>> xml.parse_from_string(author_processor, author_xml)
+Author(name='Robert A. Heinlein', birth_year=1907, books=[Book(title='Starship Troopers', published=1959), Book(title='Stranger in a Strange Land', published=1961)])
+
+```
+
+What about namedtuples, you say? Those are extremely useful, and declxml lets you work with them as well
+
+```python
+>>> from collections import namedtuple
+
+
+>>> Author = namedtuple('Author', ['name', 'birth_year', 'books'])
+>>> Book = namedtuple('Book', ['title', 'published'])
+
+
+>>> author_processor = xml.named_tuple('author', Author, [
+... xml.string('name'),
+... xml.integer('birth-year', alias='birth_year'),
+... xml.array(xml.named_tuple('book', Book, [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+>>> xml.parse_from_string(author_processor, author_xml)
+Author(name='Robert A. Heinlein', birth_year=1907, books=[Book(title='Starship Troopers', published=1959), Book(title='Stranger in a Strange Land', published=1961)])
+
+```
+
+%package help
+Summary: Development documents and examples for declxml
+Provides: python3-declxml-doc
+%description help
+# declxml - Declarative XML Processing
+
+[![PyPI version](https://badge.fury.io/py/declxml.svg)](https://badge.fury.io/py/declxml)
+[![Python Versions](https://img.shields.io/pypi/pyversions/declxml.svg)](https://pypi.org/project/declxml/)
+[![Build Status](https://gregscottatkin.visualstudio.com/declxml/_apis/build/status/gatkin.declxml)](https://gregscottatkin.visualstudio.com/declxml/_build/latest?definitionId=1)
+[![codecov](https://codecov.io/gh/gatkin/declxml/branch/master/graph/badge.svg)](https://codecov.io/gh/gatkin/declxml)
+[![Documentation Status](https://readthedocs.org/projects/declxml/badge/?version=latest)](https://declxml.readthedocs.io/en/latest/?badge=latest)
+[![License](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/gatkin/declxml/blob/master/LICENSE)
+
+XML processing made easy. No more writing and maintaining dozens or hundreds of lines of imperative serialization and parsing logic. With declxml, you declaratively define the structure of your XML document and let declxml handle the rest.
+
+## Installation
+
+Install using either pip
+
+```bash
+pip install declxml
+```
+
+or [Pipenv](https://docs.pipenv.org/)
+
+```bash
+pipenv install declxml
+```
+
+## Documentation
+
+For detailed documentation, see the project's [documentation page](http://declxml.readthedocs.io/).
+
+## Usage
+
+Given some XML to process
+
+```xml
+<author>
+ <name>Robert A. Heinlein</name>
+ <birth-year>1907</birth-year>
+ <book>
+ <title>Starship Troopers</title>
+ <published>1959</published>
+ </book>
+ <book>
+ <title>Stranger in a Strange Land</title>
+ <published>1961</published>
+ </book>
+</author>
+```
+
+Create a declxml processor that defines the structure of the document
+
+```python
+>>> import declxml as xml
+
+>>> author_processor = xml.dictionary('author', [
+... xml.string('name'),
+... xml.integer('birth-year'),
+... xml.array(xml.dictionary('book', [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+```
+
+Then use that processor to parse the XML data
+
+```python
+>>> from pprint import pprint
+>>> author_xml = """
+... <author>
+... <name>Robert A. Heinlein</name>
+... <birth-year>1907</birth-year>
+... <book>
+... <title>Starship Troopers</title>
+... <published>1959</published>
+... </book>
+... <book>
+... <title>Stranger in a Strange Land</title>
+... <published>1961</published>
+... </book>
+... </author>
+... """
+>>> pprint(xml.parse_from_string(author_processor, author_xml))
+{'birth-year': 1907,
+ 'books': [{'published': 1959, 'title': 'Starship Troopers'},
+ {'published': 1961, 'title': 'Stranger in a Strange Land'}],
+ 'name': 'Robert A. Heinlein'}
+
+```
+
+The same processor can also be used to serialize data to XML
+
+```python
+>>> author = {
+... 'birth-year': 1920,
+... 'name': 'Issac Asimov',
+... 'books': [
+... {
+... 'title': 'I, Robot',
+... 'published': 1950
+... },
+... {
+... 'title': 'Foundation',
+... 'published': 1951
+... }
+... ]
+... }
+
+
+>>> print(xml.serialize_to_string(author_processor, author, indent=' '))
+<?xml version="1.0" encoding="utf-8"?>
+<author>
+ <name>Issac Asimov</name>
+ <birth-year>1920</birth-year>
+ <book>
+ <title>I, Robot</title>
+ <published>1950</published>
+ </book>
+ <book>
+ <title>Foundation</title>
+ <published>1951</published>
+ </book>
+</author>
+
+```
+
+Want to work with objects instead of dictionaries? You can do that with declxml too
+
+```python
+>>> class Author:
+...
+... def __init__(self):
+... self.name = None
+... self.birth_year = None
+... self.books = []
+...
+... def __repr__(self):
+... return 'Author(name=\'{}\', birth_year={}, books={})'.format(
+... self.name, self.birth_year, self.books)
+
+>>> class Book:
+...
+... def __init__(self):
+... self.title = None
+... self.published = None
+...
+... def __repr__(self):
+... return 'Book(title=\'{}\', published={})'.format(self.title, self.published)
+...
+
+>>> author_processor = xml.user_object('author', Author, [
+... xml.string('name'),
+... xml.integer('birth-year', alias='birth_year'),
+... xml.array(xml.user_object('book', Book, [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+>>> xml.parse_from_string(author_processor, author_xml)
+Author(name='Robert A. Heinlein', birth_year=1907, books=[Book(title='Starship Troopers', published=1959), Book(title='Stranger in a Strange Land', published=1961)])
+
+```
+
+What about namedtuples, you say? Those are extremely useful, and declxml lets you work with them as well
+
+```python
+>>> from collections import namedtuple
+
+
+>>> Author = namedtuple('Author', ['name', 'birth_year', 'books'])
+>>> Book = namedtuple('Book', ['title', 'published'])
+
+
+>>> author_processor = xml.named_tuple('author', Author, [
+... xml.string('name'),
+... xml.integer('birth-year', alias='birth_year'),
+... xml.array(xml.named_tuple('book', Book, [
+... xml.string('title'),
+... xml.integer('published')
+... ]), alias='books')
+... ])
+
+>>> xml.parse_from_string(author_processor, author_xml)
+Author(name='Robert A. Heinlein', birth_year=1907, books=[Book(title='Starship Troopers', published=1959), Book(title='Stranger in a Strange Land', published=1961)])
+
+```
+
+%prep
+%autosetup -n declxml-1.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-declxml -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 1.1.3-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..79b7284
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+e43e402f652302451448e9dc68f92d25 declxml-1.1.3.tar.gz