From f462ae649c65cb8678175d4bada02704dab8b345 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 10 Apr 2023 13:01:33 +0000 Subject: automatic import of python-pyhumps --- .gitignore | 1 + python-pyhumps.spec | 399 ++++++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 401 insertions(+) create mode 100644 python-pyhumps.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..644bf15 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/pyhumps-3.8.0.tar.gz diff --git a/python-pyhumps.spec b/python-pyhumps.spec new file mode 100644 index 0000000..cef7a6f --- /dev/null +++ b/python-pyhumps.spec @@ -0,0 +1,399 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pyhumps +Version: 3.8.0 +Release: 1 +Summary: 🐫 Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by Humps for Node +License: The Unlicense (Unlicense) +URL: https://github.com/nficano/humps +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c4/83/fa6f8fb7accb21f39e8f2b6a18f76f6d90626bdb0a5e5448e5cc9b8ab014/pyhumps-3.8.0.tar.gz +BuildArch: noarch + + +%description + +

+ Humps logo +

+ +
+ + + + + + + + + + + + + + + +
+

+ +Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by [Humps](https://github.com/domchristie/humps) for Node. + +## Jan 11, 2021: An open call for contributors: + +Please email me at nficano@gmail.com. + +## Installation + +To install humps, simply use pipenv (or pip, of course): + +```bash +$ pipenv install pyhumps +``` + +## Usage + +### Converting strings + +```python +import humps + +humps.camelize("jack_in_the_box") # jackInTheBox +humps.decamelize("rubyTuesdays") # ruby_tuesdays +humps.pascalize("red_robin") # RedRobin +humps.kebabize("white_castle") # white-castle +``` + +### Converting dictionary keys + +```python +import humps + +array = [{"attrOne": "foo"}, {"attrOne": "bar"}] +humps.decamelize(array) # [{"attr_one": "foo"}, {"attr_one": "bar"}] + +array = [{"attr_one": "foo"}, {"attr_one": "bar"}] +humps.camelize(array) # [{"attrOne": "foo"}, {"attrOne": "bar"}] + +array = [{'attr_one': 'foo'}, {'attr_one': 'bar'}] +humps.kebabize(array) # [{'attr-one': 'foo'}, {'attr-one': 'bar'}] + +array = [{"attr_one": "foo"}, {"attr_one": "bar"}] +humps.pascalize(array) # [{"AttrOne": "foo"}, {"AttrOne": "bar"}] +``` + +### Checking character casing + +```python +import humps + +humps.is_camelcase("illWearYourGranddadsClothes") # True +humps.is_pascalcase("ILookIncredible") # True +humps.is_snakecase("im_in_this_big_ass_coat") # True +humps.is_kebabcase('from-that-thrift-shop') # True +humps.is_camelcase("down_the_road") # False + +humps.is_snakecase("imGonnaPopSomeTags") # False +humps.is_kebabcase('only_got_twenty_dollars_in_my_pocket') # False + + +# what about abbrevations, acronyms, and initialisms? No problem! +humps.decamelize("APIResponse") # api_response +``` + +
+ +## Cookbook + +#### Pythonic Boto3 API Wrapper + +```python +# aws.py +import humps +import boto3 + +def api(service, decamelize=True, *args, **kwargs): + service, func = service.split(":") + client = boto3.client(service) + kwargs = humps.pascalize(kwargs) + response = getattr(client, func)(*args, **kwargs) + return (depascalize(response) if decamelize else response) + +# usage +api("s3:download_file", bucket="bucket", key="hello.png", filename="hello.png") +``` + + +%package -n python3-pyhumps +Summary: 🐫 Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by Humps for Node +Provides: python-pyhumps +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pyhumps + +

+ Humps logo +

+ +
+ + + + + + + + + + + + + + + +
+

+ +Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by [Humps](https://github.com/domchristie/humps) for Node. + +## Jan 11, 2021: An open call for contributors: + +Please email me at nficano@gmail.com. + +## Installation + +To install humps, simply use pipenv (or pip, of course): + +```bash +$ pipenv install pyhumps +``` + +## Usage + +### Converting strings + +```python +import humps + +humps.camelize("jack_in_the_box") # jackInTheBox +humps.decamelize("rubyTuesdays") # ruby_tuesdays +humps.pascalize("red_robin") # RedRobin +humps.kebabize("white_castle") # white-castle +``` + +### Converting dictionary keys + +```python +import humps + +array = [{"attrOne": "foo"}, {"attrOne": "bar"}] +humps.decamelize(array) # [{"attr_one": "foo"}, {"attr_one": "bar"}] + +array = [{"attr_one": "foo"}, {"attr_one": "bar"}] +humps.camelize(array) # [{"attrOne": "foo"}, {"attrOne": "bar"}] + +array = [{'attr_one': 'foo'}, {'attr_one': 'bar'}] +humps.kebabize(array) # [{'attr-one': 'foo'}, {'attr-one': 'bar'}] + +array = [{"attr_one": "foo"}, {"attr_one": "bar"}] +humps.pascalize(array) # [{"AttrOne": "foo"}, {"AttrOne": "bar"}] +``` + +### Checking character casing + +```python +import humps + +humps.is_camelcase("illWearYourGranddadsClothes") # True +humps.is_pascalcase("ILookIncredible") # True +humps.is_snakecase("im_in_this_big_ass_coat") # True +humps.is_kebabcase('from-that-thrift-shop') # True +humps.is_camelcase("down_the_road") # False + +humps.is_snakecase("imGonnaPopSomeTags") # False +humps.is_kebabcase('only_got_twenty_dollars_in_my_pocket') # False + + +# what about abbrevations, acronyms, and initialisms? No problem! +humps.decamelize("APIResponse") # api_response +``` + +
+ +## Cookbook + +#### Pythonic Boto3 API Wrapper + +```python +# aws.py +import humps +import boto3 + +def api(service, decamelize=True, *args, **kwargs): + service, func = service.split(":") + client = boto3.client(service) + kwargs = humps.pascalize(kwargs) + response = getattr(client, func)(*args, **kwargs) + return (depascalize(response) if decamelize else response) + +# usage +api("s3:download_file", bucket="bucket", key="hello.png", filename="hello.png") +``` + + +%package help +Summary: Development documents and examples for pyhumps +Provides: python3-pyhumps-doc +%description help + +

+ Humps logo +

+ +
+ + + + + + + + + + + + + + + +
+

+ +Convert strings (and dictionary keys) between snake case, camel case and pascal case in Python. Inspired by [Humps](https://github.com/domchristie/humps) for Node. + +## Jan 11, 2021: An open call for contributors: + +Please email me at nficano@gmail.com. + +## Installation + +To install humps, simply use pipenv (or pip, of course): + +```bash +$ pipenv install pyhumps +``` + +## Usage + +### Converting strings + +```python +import humps + +humps.camelize("jack_in_the_box") # jackInTheBox +humps.decamelize("rubyTuesdays") # ruby_tuesdays +humps.pascalize("red_robin") # RedRobin +humps.kebabize("white_castle") # white-castle +``` + +### Converting dictionary keys + +```python +import humps + +array = [{"attrOne": "foo"}, {"attrOne": "bar"}] +humps.decamelize(array) # [{"attr_one": "foo"}, {"attr_one": "bar"}] + +array = [{"attr_one": "foo"}, {"attr_one": "bar"}] +humps.camelize(array) # [{"attrOne": "foo"}, {"attrOne": "bar"}] + +array = [{'attr_one': 'foo'}, {'attr_one': 'bar'}] +humps.kebabize(array) # [{'attr-one': 'foo'}, {'attr-one': 'bar'}] + +array = [{"attr_one": "foo"}, {"attr_one": "bar"}] +humps.pascalize(array) # [{"AttrOne": "foo"}, {"AttrOne": "bar"}] +``` + +### Checking character casing + +```python +import humps + +humps.is_camelcase("illWearYourGranddadsClothes") # True +humps.is_pascalcase("ILookIncredible") # True +humps.is_snakecase("im_in_this_big_ass_coat") # True +humps.is_kebabcase('from-that-thrift-shop') # True +humps.is_camelcase("down_the_road") # False + +humps.is_snakecase("imGonnaPopSomeTags") # False +humps.is_kebabcase('only_got_twenty_dollars_in_my_pocket') # False + + +# what about abbrevations, acronyms, and initialisms? No problem! +humps.decamelize("APIResponse") # api_response +``` + +
+ +## Cookbook + +#### Pythonic Boto3 API Wrapper + +```python +# aws.py +import humps +import boto3 + +def api(service, decamelize=True, *args, **kwargs): + service, func = service.split(":") + client = boto3.client(service) + kwargs = humps.pascalize(kwargs) + response = getattr(client, func)(*args, **kwargs) + return (depascalize(response) if decamelize else response) + +# usage +api("s3:download_file", bucket="bucket", key="hello.png", filename="hello.png") +``` + + +%prep +%autosetup -n pyhumps-3.8.0 + +%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-pyhumps -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Mon Apr 10 2023 Python_Bot - 3.8.0-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..b31b854 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +c9cf66913dbcc98513af00035fcbc8e9 pyhumps-3.8.0.tar.gz -- cgit v1.2.3