summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-29 13:42:29 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-29 13:42:29 +0000
commit3e37660397b621f0cb829fd851112978d88d1c4f (patch)
treee568b8085d45e86261a968ef196eb167bbfb6a92
parent249dcde54e789dc918c328ee870fa9adeff73077 (diff)
automatic import of python-option
-rw-r--r--.gitignore1
-rw-r--r--python-option.spec208
-rw-r--r--sources1
3 files changed, 210 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..b833478 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/option-2.1.0.tar.gz
diff --git a/python-option.spec b/python-option.spec
new file mode 100644
index 0000000..48a6001
--- /dev/null
+++ b/python-option.spec
@@ -0,0 +1,208 @@
+%global _empty_manifest_terminate_build 0
+Name: python-option
+Version: 2.1.0
+Release: 1
+Summary: Rust like Option and Result types in Python
+License: MIT
+URL: https://mat1g3r.github.io/option/
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/15/7a/3622379bd82f70a0b88779566c4847f167ae54103187922b69ad63d3c3b2/option-2.1.0.tar.gz
+BuildArch: noarch
+
+Requires: python3-typing-extensions
+
+%description
+# Option
+[![CircleCI](https://circleci.com/gh/MaT1g3R/option/tree/master.svg?style=svg)](https://circleci.com/gh/MaT1g3R/option/tree/master)
+
+Rust-like [Option](https://doc.rust-lang.org/std/option/enum.Option.html) and [Result](https://doc.rust-lang.org/std/result/enum.Result.html) types in Python, slotted and fully typed.
+
+An `Option` type represents an optional value, every `Option` is either `Some` and contains Some value, or `NONE`
+
+A `Result` type represents a value that might be an error. Every `Result` is either `Ok` and contains a success value, or `Err` and contains an error value.
+
+Using an `Option` type forces you to deal with `None` values in your code and increase type safety.
+
+Using a `Result` type simplifies error handling and reduces `try` `except` blocks.
+
+## Quick Start
+```Python
+from option import Result, Option, Ok, Err
+from requests import get
+
+
+def call_api(url, params) -> Result[dict, int]:
+ result = get(url, params)
+ code = result.status_code
+ if code == 200:
+ return Ok(result.json())
+ return Err(code)
+
+
+def calculate(url, params) -> Option[int]:
+ return call_api(url, params).ok().map(len)
+
+
+dict_len = calculate('https://example.com', {})
+```
+
+## Install
+Option can be installed from PyPi:
+```bash
+pip install option
+```
+
+## Documentation
+The documentation lives at https://mat1g3r.github.io/option/
+
+## License
+MIT
+
+
+%package -n python3-option
+Summary: Rust like Option and Result types in Python
+Provides: python-option
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-option
+# Option
+[![CircleCI](https://circleci.com/gh/MaT1g3R/option/tree/master.svg?style=svg)](https://circleci.com/gh/MaT1g3R/option/tree/master)
+
+Rust-like [Option](https://doc.rust-lang.org/std/option/enum.Option.html) and [Result](https://doc.rust-lang.org/std/result/enum.Result.html) types in Python, slotted and fully typed.
+
+An `Option` type represents an optional value, every `Option` is either `Some` and contains Some value, or `NONE`
+
+A `Result` type represents a value that might be an error. Every `Result` is either `Ok` and contains a success value, or `Err` and contains an error value.
+
+Using an `Option` type forces you to deal with `None` values in your code and increase type safety.
+
+Using a `Result` type simplifies error handling and reduces `try` `except` blocks.
+
+## Quick Start
+```Python
+from option import Result, Option, Ok, Err
+from requests import get
+
+
+def call_api(url, params) -> Result[dict, int]:
+ result = get(url, params)
+ code = result.status_code
+ if code == 200:
+ return Ok(result.json())
+ return Err(code)
+
+
+def calculate(url, params) -> Option[int]:
+ return call_api(url, params).ok().map(len)
+
+
+dict_len = calculate('https://example.com', {})
+```
+
+## Install
+Option can be installed from PyPi:
+```bash
+pip install option
+```
+
+## Documentation
+The documentation lives at https://mat1g3r.github.io/option/
+
+## License
+MIT
+
+
+%package help
+Summary: Development documents and examples for option
+Provides: python3-option-doc
+%description help
+# Option
+[![CircleCI](https://circleci.com/gh/MaT1g3R/option/tree/master.svg?style=svg)](https://circleci.com/gh/MaT1g3R/option/tree/master)
+
+Rust-like [Option](https://doc.rust-lang.org/std/option/enum.Option.html) and [Result](https://doc.rust-lang.org/std/result/enum.Result.html) types in Python, slotted and fully typed.
+
+An `Option` type represents an optional value, every `Option` is either `Some` and contains Some value, or `NONE`
+
+A `Result` type represents a value that might be an error. Every `Result` is either `Ok` and contains a success value, or `Err` and contains an error value.
+
+Using an `Option` type forces you to deal with `None` values in your code and increase type safety.
+
+Using a `Result` type simplifies error handling and reduces `try` `except` blocks.
+
+## Quick Start
+```Python
+from option import Result, Option, Ok, Err
+from requests import get
+
+
+def call_api(url, params) -> Result[dict, int]:
+ result = get(url, params)
+ code = result.status_code
+ if code == 200:
+ return Ok(result.json())
+ return Err(code)
+
+
+def calculate(url, params) -> Option[int]:
+ return call_api(url, params).ok().map(len)
+
+
+dict_len = calculate('https://example.com', {})
+```
+
+## Install
+Option can be installed from PyPi:
+```bash
+pip install option
+```
+
+## Documentation
+The documentation lives at https://mat1g3r.github.io/option/
+
+## License
+MIT
+
+
+%prep
+%autosetup -n option-2.1.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-option -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 29 2023 Python_Bot <Python_Bot@openeuler.org> - 2.1.0-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..cbc7acc
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+32ac8e5eb0e1cf4eacc186e6a916d6a2 option-2.1.0.tar.gz