summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-04-11 06:09:05 +0000
committerCoprDistGit <infra@openeuler.org>2023-04-11 06:09:05 +0000
commitce7a0a37fb71acc05318f67bf48430438f0ef4ed (patch)
tree24673019fd1a9722f6fe8e6190a4e3c66b6837f7
parent98efa3fd7c1fa1c6a8b4e03d44a20727fe6cfa10 (diff)
automatic import of python-uritemplate-py
-rw-r--r--.gitignore1
-rw-r--r--python-uritemplate-py.spec151
-rw-r--r--sources1
3 files changed, 153 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..e163cc8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/uritemplate.py-3.0.2.tar.gz
diff --git a/python-uritemplate-py.spec b/python-uritemplate-py.spec
new file mode 100644
index 0000000..7cba6ed
--- /dev/null
+++ b/python-uritemplate-py.spec
@@ -0,0 +1,151 @@
+%global _empty_manifest_terminate_build 0
+Name: python-uritemplate.py
+Version: 3.0.2
+Release: 1
+Summary: URI templates
+License: BSD 3-Clause License or Apache License, Version 2.0
+URL: https://uritemplate.readthedocs.org
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/12/97/e12695c7d7710143767022ce931061b4a6b5b19982b20ecf5d71cdde3da1/uritemplate.py-3.0.2.tar.gz
+BuildArch: noarch
+
+Requires: python3-uritemplate
+
+%description
+Documentation_ -- GitHub_ -- BitBucket_ -- Travis-CI_
+Simple python library to deal with `URI Templates`_. The API looks like
+ from uritemplate import URITemplate, expand
+ # NOTE: URI params must be strings not integers
+ gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}'
+ t = URITemplate(gist_uri)
+ print(t.expand(gist_id='123456'))
+ # => https://api.github.com/users/sigmavirus24/gists/123456
+ # or
+ print(expand(gist_uri, gist_id='123456'))
+ # also
+ t.expand({'gist_id': '123456'})
+ print(expand(gist_uri, {'gist_id': '123456'}))
+Where it might be useful to have a class
+ import requests
+ class GitHubUser(object):
+ url = URITemplate('https://api.github.com/user{/login}')
+ def __init__(self, name):
+ self.api_url = url.expand(login=name)
+ response = requests.get(self.api_url)
+ if response.status_code == 200:
+ self.__dict__.update(response.json())
+When the module containing this class is loaded, ``GitHubUser.url`` is
+evaluated and so the template is created once. It's often hard to notice in
+Python, but object creation can consume a great deal of time and so can the
+``re`` module which uritemplate relies on. Constructing the object once should
+reduce the amount of time your code takes to run.
+
+%package -n python3-uritemplate.py
+Summary: URI templates
+Provides: python-uritemplate.py
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-uritemplate.py
+Documentation_ -- GitHub_ -- BitBucket_ -- Travis-CI_
+Simple python library to deal with `URI Templates`_. The API looks like
+ from uritemplate import URITemplate, expand
+ # NOTE: URI params must be strings not integers
+ gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}'
+ t = URITemplate(gist_uri)
+ print(t.expand(gist_id='123456'))
+ # => https://api.github.com/users/sigmavirus24/gists/123456
+ # or
+ print(expand(gist_uri, gist_id='123456'))
+ # also
+ t.expand({'gist_id': '123456'})
+ print(expand(gist_uri, {'gist_id': '123456'}))
+Where it might be useful to have a class
+ import requests
+ class GitHubUser(object):
+ url = URITemplate('https://api.github.com/user{/login}')
+ def __init__(self, name):
+ self.api_url = url.expand(login=name)
+ response = requests.get(self.api_url)
+ if response.status_code == 200:
+ self.__dict__.update(response.json())
+When the module containing this class is loaded, ``GitHubUser.url`` is
+evaluated and so the template is created once. It's often hard to notice in
+Python, but object creation can consume a great deal of time and so can the
+``re`` module which uritemplate relies on. Constructing the object once should
+reduce the amount of time your code takes to run.
+
+%package help
+Summary: Development documents and examples for uritemplate.py
+Provides: python3-uritemplate.py-doc
+%description help
+Documentation_ -- GitHub_ -- BitBucket_ -- Travis-CI_
+Simple python library to deal with `URI Templates`_. The API looks like
+ from uritemplate import URITemplate, expand
+ # NOTE: URI params must be strings not integers
+ gist_uri = 'https://api.github.com/users/sigmavirus24/gists{/gist_id}'
+ t = URITemplate(gist_uri)
+ print(t.expand(gist_id='123456'))
+ # => https://api.github.com/users/sigmavirus24/gists/123456
+ # or
+ print(expand(gist_uri, gist_id='123456'))
+ # also
+ t.expand({'gist_id': '123456'})
+ print(expand(gist_uri, {'gist_id': '123456'}))
+Where it might be useful to have a class
+ import requests
+ class GitHubUser(object):
+ url = URITemplate('https://api.github.com/user{/login}')
+ def __init__(self, name):
+ self.api_url = url.expand(login=name)
+ response = requests.get(self.api_url)
+ if response.status_code == 200:
+ self.__dict__.update(response.json())
+When the module containing this class is loaded, ``GitHubUser.url`` is
+evaluated and so the template is created once. It's often hard to notice in
+Python, but object creation can consume a great deal of time and so can the
+``re`` module which uritemplate relies on. Constructing the object once should
+reduce the amount of time your code takes to run.
+
+%prep
+%autosetup -n uritemplate.py-3.0.2
+
+%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-uritemplate.py -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 3.0.2-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..db58dd9
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+ee63cccbba43851e18f902f86cba0688 uritemplate.py-3.0.2.tar.gz