diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-filterdict.spec | 129 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 131 insertions, 0 deletions
@@ -0,0 +1 @@ +/FilterDict-0.2.1576267427.tar.gz diff --git a/python-filterdict.spec b/python-filterdict.spec new file mode 100644 index 0000000..7c16d58 --- /dev/null +++ b/python-filterdict.spec @@ -0,0 +1,129 @@ +%global _empty_manifest_terminate_build 0 +Name: python-FilterDict +Version: 0.2.1576267427 +Release: 1 +Summary: Store data in JSON format +License: MIT License +URL: https://github.com/JulianKimmig/filter_dict +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c1/37/589cce2468c60d71519aeaf5174bfd5d55d26c0be9355a1429423381589d/FilterDict-0.2.1576267427.tar.gz +BuildArch: noarch + + +%description +A simple function to generate a simple filtered dict where a dict is created based on a dictionary and a function. +The returned dict contains all the kwargs if the passed function which are present in the inut dict. +This is espacially useful if you have a dict with more keys than needed to call a function or you call a function by reference and want to pass an dict as kwargs + +Example: +``` +d = dict(a=0,b=1,s1="foo",s2="bar") +def merge_strings(s1="",s2=""): + return s1+s2 + +print(merge_strings(**d)) +#throws TypeError: merge_strings() got an unexpected keyword argument 'a' + +print(merge_strings(**filter_dict(d,merge_strings))) +# returns foobar as expected + +``` + + + + +%package -n python3-FilterDict +Summary: Store data in JSON format +Provides: python-FilterDict +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-FilterDict +A simple function to generate a simple filtered dict where a dict is created based on a dictionary and a function. +The returned dict contains all the kwargs if the passed function which are present in the inut dict. +This is espacially useful if you have a dict with more keys than needed to call a function or you call a function by reference and want to pass an dict as kwargs + +Example: +``` +d = dict(a=0,b=1,s1="foo",s2="bar") +def merge_strings(s1="",s2=""): + return s1+s2 + +print(merge_strings(**d)) +#throws TypeError: merge_strings() got an unexpected keyword argument 'a' + +print(merge_strings(**filter_dict(d,merge_strings))) +# returns foobar as expected + +``` + + + + +%package help +Summary: Development documents and examples for FilterDict +Provides: python3-FilterDict-doc +%description help +A simple function to generate a simple filtered dict where a dict is created based on a dictionary and a function. +The returned dict contains all the kwargs if the passed function which are present in the inut dict. +This is espacially useful if you have a dict with more keys than needed to call a function or you call a function by reference and want to pass an dict as kwargs + +Example: +``` +d = dict(a=0,b=1,s1="foo",s2="bar") +def merge_strings(s1="",s2=""): + return s1+s2 + +print(merge_strings(**d)) +#throws TypeError: merge_strings() got an unexpected keyword argument 'a' + +print(merge_strings(**filter_dict(d,merge_strings))) +# returns foobar as expected + +``` + + + + +%prep +%autosetup -n FilterDict-0.2.1576267427 + +%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-FilterDict -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 31 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.1576267427-1 +- Package Spec generated @@ -0,0 +1 @@ +04727744dd6cda86b4ecc5babd009bca FilterDict-0.2.1576267427.tar.gz |
