summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-31 07:00:22 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-31 07:00:22 +0000
commitf4d17d1a43231686795de91a6f23336e2e647f2a (patch)
tree62e1a600aa47578f6fea14564e1eac0d4c184557
parente5c8a5238dfaa2280c44c95fd2de81c8f430b124 (diff)
automatic import of python-creek
-rw-r--r--.gitignore1
-rw-r--r--python-creek.spec339
-rw-r--r--sources1
3 files changed, 341 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..260f023 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/creek-0.1.32.tar.gz
diff --git a/python-creek.spec b/python-creek.spec
new file mode 100644
index 0000000..4ff10c4
--- /dev/null
+++ b/python-creek.spec
@@ -0,0 +1,339 @@
+%global _empty_manifest_terminate_build 0
+Name: python-creek
+Version: 0.1.32
+Release: 1
+Summary: Simple streams facade
+License: apache-2.0
+URL: https://github.com/i2mint/creek
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/cf/38/a03177776aedeeff9e50f6cc81c9e4017e993fdd3f76549e9b7168865ac9/creek-0.1.32.tar.gz
+BuildArch: noarch
+
+
+%description
+# creek
+Simple streams facade.
+
+To install: ```pip install creek```
+
+[Documentation here](https://i2mint.github.io/creek/)
+
+The ``Creek`` base class offsers a layer-able wrap of the stream interface.
+
+There are three layering methods -- pre_iter, data_to_obj, and post_filt
+-- whose use is demonstrated in the iteration code below:
+
+```
+for line in self.pre_iter(self.stream): # pre_iter: prepare and/or filter the stream
+ obj = self.data_to_obj(line) # data_to_obj: Transforms the data that stream yields
+ if self.post_filt(obj): # post_filt: Filters the stream further (but based on object now)
+ yield obj
+```
+
+Examples:
+
+
+
+```pydocstring
+>>> from io import StringIO
+>>> src = StringIO(
+... '''a, b, c
+... 1,2, 3
+... 4, 5,6
+... '''
+... )
+>>>
+>>> from creek import Creek
+>>>
+>>> class MyCreek(Creek):
+... def data_to_obj(self, line):
+... return [x.strip() for x in line.strip().split(',')]
+...
+>>> stream = MyCreek(src)
+>>>
+>>> list(stream)
+[['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', '6']]
+>>> stream.seek(0) # oh!... but we consumed the stream already, so let's go back to the beginning
+0
+>>> list(stream)
+[['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', '6']]
+>>> stream.seek(0) # reverse again
+0
+>>> next(stream)
+['a', 'b', 'c']
+>>> next(stream)
+['1', '2', '3']
+```
+
+Let's add a filter! There's two kinds you can use.
+One that is applied to the line before the data is transformed by data_to_obj,
+and the other that is applied after (to the obj).
+
+```pydocstring
+>>> from creek import Creek
+>>> from io import StringIO
+>>>
+>>> src = StringIO(
+... '''a, b, c
+... 1,2, 3
+... 4, 5,6
+... ''')
+>>> class MyFilteredCreek(MyCreek):
+... def post_filt(self, obj):
+... return str.isnumeric(obj[0])
+>>>
+>>> s = MyFilteredCreek(src)
+>>>
+>>> list(s)
+[['1', '2', '3'], ['4', '5', '6']]
+>>> s.seek(0)
+0
+>>> list(s)
+[['1', '2', '3'], ['4', '5', '6']]
+>>> s.seek(0)
+0
+>>> next(s)
+['1', '2', '3']
+```
+
+Recipes:
+- pre_iter: involving itertools.islice to skip header lines
+- pre_iter: involving enumerate to get line indices in stream iterator
+- pre_iter = functools.partial(map, line_pre_proc_func) to preprocess all lines with line_pre_proc_func
+- pre_iter: include filter before obj
+
+%package -n python3-creek
+Summary: Simple streams facade
+Provides: python-creek
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-creek
+# creek
+Simple streams facade.
+
+To install: ```pip install creek```
+
+[Documentation here](https://i2mint.github.io/creek/)
+
+The ``Creek`` base class offsers a layer-able wrap of the stream interface.
+
+There are three layering methods -- pre_iter, data_to_obj, and post_filt
+-- whose use is demonstrated in the iteration code below:
+
+```
+for line in self.pre_iter(self.stream): # pre_iter: prepare and/or filter the stream
+ obj = self.data_to_obj(line) # data_to_obj: Transforms the data that stream yields
+ if self.post_filt(obj): # post_filt: Filters the stream further (but based on object now)
+ yield obj
+```
+
+Examples:
+
+
+
+```pydocstring
+>>> from io import StringIO
+>>> src = StringIO(
+... '''a, b, c
+... 1,2, 3
+... 4, 5,6
+... '''
+... )
+>>>
+>>> from creek import Creek
+>>>
+>>> class MyCreek(Creek):
+... def data_to_obj(self, line):
+... return [x.strip() for x in line.strip().split(',')]
+...
+>>> stream = MyCreek(src)
+>>>
+>>> list(stream)
+[['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', '6']]
+>>> stream.seek(0) # oh!... but we consumed the stream already, so let's go back to the beginning
+0
+>>> list(stream)
+[['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', '6']]
+>>> stream.seek(0) # reverse again
+0
+>>> next(stream)
+['a', 'b', 'c']
+>>> next(stream)
+['1', '2', '3']
+```
+
+Let's add a filter! There's two kinds you can use.
+One that is applied to the line before the data is transformed by data_to_obj,
+and the other that is applied after (to the obj).
+
+```pydocstring
+>>> from creek import Creek
+>>> from io import StringIO
+>>>
+>>> src = StringIO(
+... '''a, b, c
+... 1,2, 3
+... 4, 5,6
+... ''')
+>>> class MyFilteredCreek(MyCreek):
+... def post_filt(self, obj):
+... return str.isnumeric(obj[0])
+>>>
+>>> s = MyFilteredCreek(src)
+>>>
+>>> list(s)
+[['1', '2', '3'], ['4', '5', '6']]
+>>> s.seek(0)
+0
+>>> list(s)
+[['1', '2', '3'], ['4', '5', '6']]
+>>> s.seek(0)
+0
+>>> next(s)
+['1', '2', '3']
+```
+
+Recipes:
+- pre_iter: involving itertools.islice to skip header lines
+- pre_iter: involving enumerate to get line indices in stream iterator
+- pre_iter = functools.partial(map, line_pre_proc_func) to preprocess all lines with line_pre_proc_func
+- pre_iter: include filter before obj
+
+%package help
+Summary: Development documents and examples for creek
+Provides: python3-creek-doc
+%description help
+# creek
+Simple streams facade.
+
+To install: ```pip install creek```
+
+[Documentation here](https://i2mint.github.io/creek/)
+
+The ``Creek`` base class offsers a layer-able wrap of the stream interface.
+
+There are three layering methods -- pre_iter, data_to_obj, and post_filt
+-- whose use is demonstrated in the iteration code below:
+
+```
+for line in self.pre_iter(self.stream): # pre_iter: prepare and/or filter the stream
+ obj = self.data_to_obj(line) # data_to_obj: Transforms the data that stream yields
+ if self.post_filt(obj): # post_filt: Filters the stream further (but based on object now)
+ yield obj
+```
+
+Examples:
+
+
+
+```pydocstring
+>>> from io import StringIO
+>>> src = StringIO(
+... '''a, b, c
+... 1,2, 3
+... 4, 5,6
+... '''
+... )
+>>>
+>>> from creek import Creek
+>>>
+>>> class MyCreek(Creek):
+... def data_to_obj(self, line):
+... return [x.strip() for x in line.strip().split(',')]
+...
+>>> stream = MyCreek(src)
+>>>
+>>> list(stream)
+[['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', '6']]
+>>> stream.seek(0) # oh!... but we consumed the stream already, so let's go back to the beginning
+0
+>>> list(stream)
+[['a', 'b', 'c'], ['1', '2', '3'], ['4', '5', '6']]
+>>> stream.seek(0) # reverse again
+0
+>>> next(stream)
+['a', 'b', 'c']
+>>> next(stream)
+['1', '2', '3']
+```
+
+Let's add a filter! There's two kinds you can use.
+One that is applied to the line before the data is transformed by data_to_obj,
+and the other that is applied after (to the obj).
+
+```pydocstring
+>>> from creek import Creek
+>>> from io import StringIO
+>>>
+>>> src = StringIO(
+... '''a, b, c
+... 1,2, 3
+... 4, 5,6
+... ''')
+>>> class MyFilteredCreek(MyCreek):
+... def post_filt(self, obj):
+... return str.isnumeric(obj[0])
+>>>
+>>> s = MyFilteredCreek(src)
+>>>
+>>> list(s)
+[['1', '2', '3'], ['4', '5', '6']]
+>>> s.seek(0)
+0
+>>> list(s)
+[['1', '2', '3'], ['4', '5', '6']]
+>>> s.seek(0)
+0
+>>> next(s)
+['1', '2', '3']
+```
+
+Recipes:
+- pre_iter: involving itertools.islice to skip header lines
+- pre_iter: involving enumerate to get line indices in stream iterator
+- pre_iter = functools.partial(map, line_pre_proc_func) to preprocess all lines with line_pre_proc_func
+- pre_iter: include filter before obj
+
+%prep
+%autosetup -n creek-0.1.32
+
+%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-creek -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.1.32-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..53a5785
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+fad7486610207bfaaa6062c21e6e1d29 creek-0.1.32.tar.gz