summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-05-15 06:35:39 +0000
committerCoprDistGit <infra@openeuler.org>2023-05-15 06:35:39 +0000
commitdf3e59d5f68d55d361358994781e7e7834021547 (patch)
tree0b9bedc8021c64d8ed679f99bb3fcdcfa08cbd27
parentf0f82210d6ff3fca3a8e37a5bc70dd9e941281ff (diff)
automatic import of python-durations-nlp
-rw-r--r--.gitignore1
-rw-r--r--python-durations-nlp.spec300
-rw-r--r--sources1
3 files changed, 302 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..7af1303 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/durations_nlp-1.0.1.tar.gz
diff --git a/python-durations-nlp.spec b/python-durations-nlp.spec
new file mode 100644
index 0000000..a3ddc4b
--- /dev/null
+++ b/python-durations-nlp.spec
@@ -0,0 +1,300 @@
+%global _empty_manifest_terminate_build 0
+Name: python-durations-nlp
+Version: 1.0.1
+Release: 1
+Summary: A python durations parsing library.
+License: MIT
+URL: https://github.com/timwedde/durations_nlp
+Source0: https://mirrors.nju.edu.cn/pypi/web/packages/a1/82/b07a77f35f4e96216b95eac3b474b4ecb724f89be8a57128497a7f6eaecd/durations_nlp-1.0.1.tar.gz
+BuildArch: noarch
+
+
+%description
+# durations_nlp
+
+[![CircleCI](https://circleci.com/gh/timwedde/durations_nlp.svg?style=svg)](https://circleci.com/gh/timwedde/durations_nlp)
+[![codecov](https://codecov.io/gh/timwedde/durations_nlp/branch/master/graph/badge.svg)](https://codecov.io/gh/timwedde/durations_nlp)
+[![Downloads](https://pepy.tech/badge/durations-nlp)](https://pepy.tech/project/durations-nlp)
+
+A python durations parsing library, providing a straight-forward API to parse duration string representations such as `1d`, `1 day 2 hours` or `2 days 3h 26m 52s` and convert them to numeric values.
+
+## What and Why
+It's easier and more straight forward to read a duration expressed in natural language (at least for a human), as an expression rather than an amount. When writing configuration files for example:
+
+```yaml
+interval: 3 hours
+```
+
+is easier to understand for a human than
+
+```yaml
+interval: 10800 # seconds
+```
+
+## Installation
+
+`durations_nlp` can be installed via pip:
+```bash
+$ pip install durations_nlp
+```
+
+## Usage
+To parse a duration string representation, just instantiate a Duration object and let it work for you. A Duration representation is composed of as many ``<value><scale>`` pairs as you need to express it:
+* A value is an integer amount.
+* A scale is a duration unit in it's short or long form (both singular and plural).
+* Duration pairs can be separated with sep characters and expressions such as `,` or `and`
+
+### Example Input
+
+* `1d`
+* `2 days`
+* `2 days and 4 hours`
+* `4M, 22d and 6hours`
+
+### Scales Reference
+
+* Century: `c`, `century`, `centuries`
+* Decade: `D`, `decade`, `decades`
+* Year: `y`, `year`, `Year`
+* Month: `M`, `month`, `months`
+* Week: `w`, `week`, `weeks`
+* Day: `d`, `day`, `days`
+* Hour: `h`, `hour`, `hours`
+* Minute:`m`, `minute`, `minutes`
+* Second: `s`, `second`, `seconds`
+* Millisecond: `ms`, `millisecond`, `milliseconds`
+
+### Usage Example
+
+```python
+from durations_nlp import Duration
+
+one_hour = "1hour"
+
+one_hour_duration = Duration(one_hour)
+one_hour_duration.to_seconds()
+# >>> 3600.0
+one_hour_duration.to_minutes()
+# >>> 60.0
+
+# You can even compose durations in their short
+# and long variations
+two_days_three_hours = "2 days, 3h"
+two_days_three_hours_duration = Duration(two_days_three_hours)
+two_days_three_hours_duration.to_seconds()
+# >>> 183600.0
+two_days_three_hours_duration.to_hours()
+# >>> 51.0
+```
+
+
+%package -n python3-durations-nlp
+Summary: A python durations parsing library.
+Provides: python-durations-nlp
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-durations-nlp
+# durations_nlp
+
+[![CircleCI](https://circleci.com/gh/timwedde/durations_nlp.svg?style=svg)](https://circleci.com/gh/timwedde/durations_nlp)
+[![codecov](https://codecov.io/gh/timwedde/durations_nlp/branch/master/graph/badge.svg)](https://codecov.io/gh/timwedde/durations_nlp)
+[![Downloads](https://pepy.tech/badge/durations-nlp)](https://pepy.tech/project/durations-nlp)
+
+A python durations parsing library, providing a straight-forward API to parse duration string representations such as `1d`, `1 day 2 hours` or `2 days 3h 26m 52s` and convert them to numeric values.
+
+## What and Why
+It's easier and more straight forward to read a duration expressed in natural language (at least for a human), as an expression rather than an amount. When writing configuration files for example:
+
+```yaml
+interval: 3 hours
+```
+
+is easier to understand for a human than
+
+```yaml
+interval: 10800 # seconds
+```
+
+## Installation
+
+`durations_nlp` can be installed via pip:
+```bash
+$ pip install durations_nlp
+```
+
+## Usage
+To parse a duration string representation, just instantiate a Duration object and let it work for you. A Duration representation is composed of as many ``<value><scale>`` pairs as you need to express it:
+* A value is an integer amount.
+* A scale is a duration unit in it's short or long form (both singular and plural).
+* Duration pairs can be separated with sep characters and expressions such as `,` or `and`
+
+### Example Input
+
+* `1d`
+* `2 days`
+* `2 days and 4 hours`
+* `4M, 22d and 6hours`
+
+### Scales Reference
+
+* Century: `c`, `century`, `centuries`
+* Decade: `D`, `decade`, `decades`
+* Year: `y`, `year`, `Year`
+* Month: `M`, `month`, `months`
+* Week: `w`, `week`, `weeks`
+* Day: `d`, `day`, `days`
+* Hour: `h`, `hour`, `hours`
+* Minute:`m`, `minute`, `minutes`
+* Second: `s`, `second`, `seconds`
+* Millisecond: `ms`, `millisecond`, `milliseconds`
+
+### Usage Example
+
+```python
+from durations_nlp import Duration
+
+one_hour = "1hour"
+
+one_hour_duration = Duration(one_hour)
+one_hour_duration.to_seconds()
+# >>> 3600.0
+one_hour_duration.to_minutes()
+# >>> 60.0
+
+# You can even compose durations in their short
+# and long variations
+two_days_three_hours = "2 days, 3h"
+two_days_three_hours_duration = Duration(two_days_three_hours)
+two_days_three_hours_duration.to_seconds()
+# >>> 183600.0
+two_days_three_hours_duration.to_hours()
+# >>> 51.0
+```
+
+
+%package help
+Summary: Development documents and examples for durations-nlp
+Provides: python3-durations-nlp-doc
+%description help
+# durations_nlp
+
+[![CircleCI](https://circleci.com/gh/timwedde/durations_nlp.svg?style=svg)](https://circleci.com/gh/timwedde/durations_nlp)
+[![codecov](https://codecov.io/gh/timwedde/durations_nlp/branch/master/graph/badge.svg)](https://codecov.io/gh/timwedde/durations_nlp)
+[![Downloads](https://pepy.tech/badge/durations-nlp)](https://pepy.tech/project/durations-nlp)
+
+A python durations parsing library, providing a straight-forward API to parse duration string representations such as `1d`, `1 day 2 hours` or `2 days 3h 26m 52s` and convert them to numeric values.
+
+## What and Why
+It's easier and more straight forward to read a duration expressed in natural language (at least for a human), as an expression rather than an amount. When writing configuration files for example:
+
+```yaml
+interval: 3 hours
+```
+
+is easier to understand for a human than
+
+```yaml
+interval: 10800 # seconds
+```
+
+## Installation
+
+`durations_nlp` can be installed via pip:
+```bash
+$ pip install durations_nlp
+```
+
+## Usage
+To parse a duration string representation, just instantiate a Duration object and let it work for you. A Duration representation is composed of as many ``<value><scale>`` pairs as you need to express it:
+* A value is an integer amount.
+* A scale is a duration unit in it's short or long form (both singular and plural).
+* Duration pairs can be separated with sep characters and expressions such as `,` or `and`
+
+### Example Input
+
+* `1d`
+* `2 days`
+* `2 days and 4 hours`
+* `4M, 22d and 6hours`
+
+### Scales Reference
+
+* Century: `c`, `century`, `centuries`
+* Decade: `D`, `decade`, `decades`
+* Year: `y`, `year`, `Year`
+* Month: `M`, `month`, `months`
+* Week: `w`, `week`, `weeks`
+* Day: `d`, `day`, `days`
+* Hour: `h`, `hour`, `hours`
+* Minute:`m`, `minute`, `minutes`
+* Second: `s`, `second`, `seconds`
+* Millisecond: `ms`, `millisecond`, `milliseconds`
+
+### Usage Example
+
+```python
+from durations_nlp import Duration
+
+one_hour = "1hour"
+
+one_hour_duration = Duration(one_hour)
+one_hour_duration.to_seconds()
+# >>> 3600.0
+one_hour_duration.to_minutes()
+# >>> 60.0
+
+# You can even compose durations in their short
+# and long variations
+two_days_three_hours = "2 days, 3h"
+two_days_three_hours_duration = Duration(two_days_three_hours)
+two_days_three_hours_duration.to_seconds()
+# >>> 183600.0
+two_days_three_hours_duration.to_hours()
+# >>> 51.0
+```
+
+
+%prep
+%autosetup -n durations-nlp-1.0.1
+
+%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-durations-nlp -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Mon May 15 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.1-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..62ed75a
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+813457420833eea0bb5d6280defb6161 durations_nlp-1.0.1.tar.gz