diff options
author | CoprDistGit <infra@openeuler.org> | 2023-06-20 09:24:00 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-06-20 09:24:00 +0000 |
commit | f9bc6062d58e4ce3fd410cac23fd8e3d2ad7698e (patch) | |
tree | e557492e96899079b465b1d6744d2c1005eb36bb | |
parent | 64e012b007a6585a619df017f0701ab190eabcd7 (diff) |
automatic import of python-timeframeopeneuler20.03
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-timeframe.spec | 840 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 842 insertions, 0 deletions
@@ -0,0 +1 @@ +/timeframe-1.0.0.tar.gz diff --git a/python-timeframe.spec b/python-timeframe.spec new file mode 100644 index 0000000..2fde86d --- /dev/null +++ b/python-timeframe.spec @@ -0,0 +1,840 @@ +%global _empty_manifest_terminate_build 0 +Name: python-timeframe +Version: 1.0.0 +Release: 1 +Summary: Calculation of time frames using the built-in datetime module +License: MIT License +URL: https://github.com/meysam81/timeframe +Source0: https://mirrors.aliyun.com/pypi/web/packages/27/c5/6616154871c7b09a0d7163ec54e82e116f6d09c72ae5d85f9329dfcd042e/timeframe-1.0.0.tar.gz +BuildArch: noarch + + +%description +# TimeFrame + +[](./.pre-commit-config.yaml) +[](./tox.ini) +[](https://codecov.io/gh/meysam81/timeframe) +[](./LICENSE) +[](https://github.com/meysam81/timeframe/stargazers) +[](https://pypi.org/project/timeframe/) +[](https://github.com/meysam81/timeframe/issues) +[](https://github.com/meysam81/timeframe/pulls) +[](https://codeclimate.com/github/meysam81/timeframe) +[](https://codeclimate.com/github/meysam81/timeframe/issues) +[](https://codeclimate.com/github/meysam81/timeframe/trends/technical_debt) +[](https://github.com/meysam81/timeframe/graphs/contributors) +[](https://pypi.org/project/timeframe/) +[](https://pypi.org/project/timeframe/) +[](https://pypi.org/project/timeframe/) +[](https://github.com/meysam81/timeframe/) +[](https://github.com/meysam81/timeframe/) + +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> + +- [TimeFrame](#timeframe) + - [Introduction](#introduction) + - [Install](#install) + - [Examples](#examples) + - [Inclusion](#inclusion) + - [New API](#new-api) + - [Deprecated](#deprecated) + - [Duration](#duration) + - [Comparison](#comparison) + - [Overlap](#overlap) + - [Summation (union)](#summation-union) + - [Minus](#minus) + - [Acknowledgment](#acknowledgment) + - [Contribution](#contribution) + - [Stargazers over time](#stargazers-over-time) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + + +## Introduction + +This package makes the following calculations on `datetime`: + +* Adding two time frames, resulting in one bigger time frame or two disjoint one. +* Multiplying two time frames, resuling in either an overlapped time frame or +an empty one, depending on the two time frames. +* Substracting two time frames, resuling in one or several time frames. + +## Install + +Installing the package is as simple as running the following command inside +your terminal: + +```bash +pip install timeframe +``` + +## Examples + +**NOTE**: You can always take a look at the test cases in the [tests](./test) +directory to get a sense of how to use the package, but consider the below +examples first, because it's fairly easy to use. + +You need to import `datetime` as well as `TimeFrame`: + +```python +from datetime import datetime +from timeframe import TimeFrame +``` + +### Inclusion + +#### New API + +```python +>>> tf1 = TimeFrame(datetime(2021, 1, 1), datetime(2021, 1, 2)) +>>> tf2 = TimeFrame(datetime(2021, 1, 1, 12), datetime(2021, 1, 1, 13)) +>>> tf2 in tf1 +True +``` + +#### Deprecated + +This implies whether or not one time frame includes another; it can also be +used to check if a `datetime` is inside one `TimeFrame`. + +When you want to check if a `datetime` is inside a `TimeFrame`: + +```python +tf1 = TimeFrame(datetime(2021, 1, 26, 19), datetime(2021, 1, 26, 20)) +tf1.includes(datetime(2021, 1, 26, 19, 30)) +# output: True +``` + +When You want to check if an instance of `TimeFrame` is inside another one: + +```python +tf2 = TimeFrame(datetime(2021, 1, 26, 19, 30), datetime(2021, 1, 26, 19, 40)) +tf1.includes(tf2) +# output: True +``` + +```python +tf3 = TimeFrame(datetime(2021, 1, 26, 19, 45), datetime(2021, 1, 26, 21, 30)) +tf1.includes(tf3) +# output: False +``` + +### Duration + +`TimeFrame` has a property named `duration` which can be used to retrieve the +total amount of seconds that `TimeFrame` has: + +```python +tf1.duration +# output: 3600.0 +``` + +```python +tf2.duration +# output: 600.0 +``` + +```python +tf3.duration +# output: 6300.0 +``` + +### Comparison + +You can always compare two `TimeFrame` to see if one is greater than the other or not. +This comparison is based on the `end` of one `TimeFrame` and the `start` of the other. + +```python +tf1 > tf2 +# output: False +``` + +```python +tf3 > tf2 +# output: True +``` + +You can also compare equality using either greater-equal sign, or a simple equal. + +```python +tf1 == tf2 +# output: False +``` + +```python +tf3 >= tf2 +# output: True +``` + +### Overlap + +When you want to know how much two time frames have in common, use multiply sign: + +```python +tf1 * tf2 +# output: 2021-01-26T19:30:00#2021-01-26T19:40:00 +``` + +```python +tf2 * tf3 +# output: Empty TimeFrame +``` + +You can also check their duration as well: + +```python +(tf1 * tf2).duration +# output: 600.0 +``` + +```python +(tf2 * tf3).duration +# output: 0.0 +``` + +### Summation (union) + +The summation sign is used to get the union of two time frames: + +```python +tf1 + tf2 +# output: 2021-01-26T19:00:00#2021-01-26T20:00:00 +``` + +```python +(tf1 + tf2).duration +# output: 3600.0 +``` + +```python +tf1 + tf3 +# output: 2021-01-26T19:00:00#2021-01-26T21:30:00 +``` + +```python +(tf1 + tf3).duration +# output: 9000.0 +``` + +### Minus + +You can also substract one time frame from the other, which will ultimately +result in either two disjoint time frames, or one unified time frame, depending +on the time frames. + +```python +tf1 - tf2 +# output: +# 2021-01-26T19:00:00#2021-01-26T19:29:59.999999 +# 2021-01-26T19:40:00.000001#2021-01-26T20:00:00 +``` + +```python +(tf1 - tf2).duration +# output: 2999.999998 +``` + +Substracting two disjoint time frames will return the first time frame as a result. + +```python +tf2 - tf3 +# output: 2021-01-26T19:30:00#2021-01-26T19:40:00 +``` + +```python +(tf2 - tf3).duration +# output: 600.0 +``` + +```python +(tf2 - tf3) == tf2 +# output: True +``` + +## Acknowledgment + +Thank you for showing interest in this package. Feel free to contact me if you +feel like it. 🥂 + +## Contribution + +Any contribution of any size is greatly appreciated. Feel free to open a PR or +issue in the github page at any time. 🤗 + +## Stargazers over time + +[](https://star-history.com/#meysam81/timeframe&Date) + + +%package -n python3-timeframe +Summary: Calculation of time frames using the built-in datetime module +Provides: python-timeframe +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-timeframe +# TimeFrame + +[](./.pre-commit-config.yaml) +[](./tox.ini) +[](https://codecov.io/gh/meysam81/timeframe) +[](./LICENSE) +[](https://github.com/meysam81/timeframe/stargazers) +[](https://pypi.org/project/timeframe/) +[](https://github.com/meysam81/timeframe/issues) +[](https://github.com/meysam81/timeframe/pulls) +[](https://codeclimate.com/github/meysam81/timeframe) +[](https://codeclimate.com/github/meysam81/timeframe/issues) +[](https://codeclimate.com/github/meysam81/timeframe/trends/technical_debt) +[](https://github.com/meysam81/timeframe/graphs/contributors) +[](https://pypi.org/project/timeframe/) +[](https://pypi.org/project/timeframe/) +[](https://pypi.org/project/timeframe/) +[](https://github.com/meysam81/timeframe/) +[](https://github.com/meysam81/timeframe/) + +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> + +- [TimeFrame](#timeframe) + - [Introduction](#introduction) + - [Install](#install) + - [Examples](#examples) + - [Inclusion](#inclusion) + - [New API](#new-api) + - [Deprecated](#deprecated) + - [Duration](#duration) + - [Comparison](#comparison) + - [Overlap](#overlap) + - [Summation (union)](#summation-union) + - [Minus](#minus) + - [Acknowledgment](#acknowledgment) + - [Contribution](#contribution) + - [Stargazers over time](#stargazers-over-time) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + + +## Introduction + +This package makes the following calculations on `datetime`: + +* Adding two time frames, resulting in one bigger time frame or two disjoint one. +* Multiplying two time frames, resuling in either an overlapped time frame or +an empty one, depending on the two time frames. +* Substracting two time frames, resuling in one or several time frames. + +## Install + +Installing the package is as simple as running the following command inside +your terminal: + +```bash +pip install timeframe +``` + +## Examples + +**NOTE**: You can always take a look at the test cases in the [tests](./test) +directory to get a sense of how to use the package, but consider the below +examples first, because it's fairly easy to use. + +You need to import `datetime` as well as `TimeFrame`: + +```python +from datetime import datetime +from timeframe import TimeFrame +``` + +### Inclusion + +#### New API + +```python +>>> tf1 = TimeFrame(datetime(2021, 1, 1), datetime(2021, 1, 2)) +>>> tf2 = TimeFrame(datetime(2021, 1, 1, 12), datetime(2021, 1, 1, 13)) +>>> tf2 in tf1 +True +``` + +#### Deprecated + +This implies whether or not one time frame includes another; it can also be +used to check if a `datetime` is inside one `TimeFrame`. + +When you want to check if a `datetime` is inside a `TimeFrame`: + +```python +tf1 = TimeFrame(datetime(2021, 1, 26, 19), datetime(2021, 1, 26, 20)) +tf1.includes(datetime(2021, 1, 26, 19, 30)) +# output: True +``` + +When You want to check if an instance of `TimeFrame` is inside another one: + +```python +tf2 = TimeFrame(datetime(2021, 1, 26, 19, 30), datetime(2021, 1, 26, 19, 40)) +tf1.includes(tf2) +# output: True +``` + +```python +tf3 = TimeFrame(datetime(2021, 1, 26, 19, 45), datetime(2021, 1, 26, 21, 30)) +tf1.includes(tf3) +# output: False +``` + +### Duration + +`TimeFrame` has a property named `duration` which can be used to retrieve the +total amount of seconds that `TimeFrame` has: + +```python +tf1.duration +# output: 3600.0 +``` + +```python +tf2.duration +# output: 600.0 +``` + +```python +tf3.duration +# output: 6300.0 +``` + +### Comparison + +You can always compare two `TimeFrame` to see if one is greater than the other or not. +This comparison is based on the `end` of one `TimeFrame` and the `start` of the other. + +```python +tf1 > tf2 +# output: False +``` + +```python +tf3 > tf2 +# output: True +``` + +You can also compare equality using either greater-equal sign, or a simple equal. + +```python +tf1 == tf2 +# output: False +``` + +```python +tf3 >= tf2 +# output: True +``` + +### Overlap + +When you want to know how much two time frames have in common, use multiply sign: + +```python +tf1 * tf2 +# output: 2021-01-26T19:30:00#2021-01-26T19:40:00 +``` + +```python +tf2 * tf3 +# output: Empty TimeFrame +``` + +You can also check their duration as well: + +```python +(tf1 * tf2).duration +# output: 600.0 +``` + +```python +(tf2 * tf3).duration +# output: 0.0 +``` + +### Summation (union) + +The summation sign is used to get the union of two time frames: + +```python +tf1 + tf2 +# output: 2021-01-26T19:00:00#2021-01-26T20:00:00 +``` + +```python +(tf1 + tf2).duration +# output: 3600.0 +``` + +```python +tf1 + tf3 +# output: 2021-01-26T19:00:00#2021-01-26T21:30:00 +``` + +```python +(tf1 + tf3).duration +# output: 9000.0 +``` + +### Minus + +You can also substract one time frame from the other, which will ultimately +result in either two disjoint time frames, or one unified time frame, depending +on the time frames. + +```python +tf1 - tf2 +# output: +# 2021-01-26T19:00:00#2021-01-26T19:29:59.999999 +# 2021-01-26T19:40:00.000001#2021-01-26T20:00:00 +``` + +```python +(tf1 - tf2).duration +# output: 2999.999998 +``` + +Substracting two disjoint time frames will return the first time frame as a result. + +```python +tf2 - tf3 +# output: 2021-01-26T19:30:00#2021-01-26T19:40:00 +``` + +```python +(tf2 - tf3).duration +# output: 600.0 +``` + +```python +(tf2 - tf3) == tf2 +# output: True +``` + +## Acknowledgment + +Thank you for showing interest in this package. Feel free to contact me if you +feel like it. 🥂 + +## Contribution + +Any contribution of any size is greatly appreciated. Feel free to open a PR or +issue in the github page at any time. 🤗 + +## Stargazers over time + +[](https://star-history.com/#meysam81/timeframe&Date) + + +%package help +Summary: Development documents and examples for timeframe +Provides: python3-timeframe-doc +%description help +# TimeFrame + +[](./.pre-commit-config.yaml) +[](./tox.ini) +[](https://codecov.io/gh/meysam81/timeframe) +[](./LICENSE) +[](https://github.com/meysam81/timeframe/stargazers) +[](https://pypi.org/project/timeframe/) +[](https://github.com/meysam81/timeframe/issues) +[](https://github.com/meysam81/timeframe/pulls) +[](https://codeclimate.com/github/meysam81/timeframe) +[](https://codeclimate.com/github/meysam81/timeframe/issues) +[](https://codeclimate.com/github/meysam81/timeframe/trends/technical_debt) +[](https://github.com/meysam81/timeframe/graphs/contributors) +[](https://pypi.org/project/timeframe/) +[](https://pypi.org/project/timeframe/) +[](https://pypi.org/project/timeframe/) +[](https://github.com/meysam81/timeframe/) +[](https://github.com/meysam81/timeframe/) + +<!-- START doctoc generated TOC please keep comment here to allow auto update --> +<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE --> + +- [TimeFrame](#timeframe) + - [Introduction](#introduction) + - [Install](#install) + - [Examples](#examples) + - [Inclusion](#inclusion) + - [New API](#new-api) + - [Deprecated](#deprecated) + - [Duration](#duration) + - [Comparison](#comparison) + - [Overlap](#overlap) + - [Summation (union)](#summation-union) + - [Minus](#minus) + - [Acknowledgment](#acknowledgment) + - [Contribution](#contribution) + - [Stargazers over time](#stargazers-over-time) + +<!-- END doctoc generated TOC please keep comment here to allow auto update --> + + +## Introduction + +This package makes the following calculations on `datetime`: + +* Adding two time frames, resulting in one bigger time frame or two disjoint one. +* Multiplying two time frames, resuling in either an overlapped time frame or +an empty one, depending on the two time frames. +* Substracting two time frames, resuling in one or several time frames. + +## Install + +Installing the package is as simple as running the following command inside +your terminal: + +```bash +pip install timeframe +``` + +## Examples + +**NOTE**: You can always take a look at the test cases in the [tests](./test) +directory to get a sense of how to use the package, but consider the below +examples first, because it's fairly easy to use. + +You need to import `datetime` as well as `TimeFrame`: + +```python +from datetime import datetime +from timeframe import TimeFrame +``` + +### Inclusion + +#### New API + +```python +>>> tf1 = TimeFrame(datetime(2021, 1, 1), datetime(2021, 1, 2)) +>>> tf2 = TimeFrame(datetime(2021, 1, 1, 12), datetime(2021, 1, 1, 13)) +>>> tf2 in tf1 +True +``` + +#### Deprecated + +This implies whether or not one time frame includes another; it can also be +used to check if a `datetime` is inside one `TimeFrame`. + +When you want to check if a `datetime` is inside a `TimeFrame`: + +```python +tf1 = TimeFrame(datetime(2021, 1, 26, 19), datetime(2021, 1, 26, 20)) +tf1.includes(datetime(2021, 1, 26, 19, 30)) +# output: True +``` + +When You want to check if an instance of `TimeFrame` is inside another one: + +```python +tf2 = TimeFrame(datetime(2021, 1, 26, 19, 30), datetime(2021, 1, 26, 19, 40)) +tf1.includes(tf2) +# output: True +``` + +```python +tf3 = TimeFrame(datetime(2021, 1, 26, 19, 45), datetime(2021, 1, 26, 21, 30)) +tf1.includes(tf3) +# output: False +``` + +### Duration + +`TimeFrame` has a property named `duration` which can be used to retrieve the +total amount of seconds that `TimeFrame` has: + +```python +tf1.duration +# output: 3600.0 +``` + +```python +tf2.duration +# output: 600.0 +``` + +```python +tf3.duration +# output: 6300.0 +``` + +### Comparison + +You can always compare two `TimeFrame` to see if one is greater than the other or not. +This comparison is based on the `end` of one `TimeFrame` and the `start` of the other. + +```python +tf1 > tf2 +# output: False +``` + +```python +tf3 > tf2 +# output: True +``` + +You can also compare equality using either greater-equal sign, or a simple equal. + +```python +tf1 == tf2 +# output: False +``` + +```python +tf3 >= tf2 +# output: True +``` + +### Overlap + +When you want to know how much two time frames have in common, use multiply sign: + +```python +tf1 * tf2 +# output: 2021-01-26T19:30:00#2021-01-26T19:40:00 +``` + +```python +tf2 * tf3 +# output: Empty TimeFrame +``` + +You can also check their duration as well: + +```python +(tf1 * tf2).duration +# output: 600.0 +``` + +```python +(tf2 * tf3).duration +# output: 0.0 +``` + +### Summation (union) + +The summation sign is used to get the union of two time frames: + +```python +tf1 + tf2 +# output: 2021-01-26T19:00:00#2021-01-26T20:00:00 +``` + +```python +(tf1 + tf2).duration +# output: 3600.0 +``` + +```python +tf1 + tf3 +# output: 2021-01-26T19:00:00#2021-01-26T21:30:00 +``` + +```python +(tf1 + tf3).duration +# output: 9000.0 +``` + +### Minus + +You can also substract one time frame from the other, which will ultimately +result in either two disjoint time frames, or one unified time frame, depending +on the time frames. + +```python +tf1 - tf2 +# output: +# 2021-01-26T19:00:00#2021-01-26T19:29:59.999999 +# 2021-01-26T19:40:00.000001#2021-01-26T20:00:00 +``` + +```python +(tf1 - tf2).duration +# output: 2999.999998 +``` + +Substracting two disjoint time frames will return the first time frame as a result. + +```python +tf2 - tf3 +# output: 2021-01-26T19:30:00#2021-01-26T19:40:00 +``` + +```python +(tf2 - tf3).duration +# output: 600.0 +``` + +```python +(tf2 - tf3) == tf2 +# output: True +``` + +## Acknowledgment + +Thank you for showing interest in this package. Feel free to contact me if you +feel like it. 🥂 + +## Contribution + +Any contribution of any size is greatly appreciated. Feel free to open a PR or +issue in the github page at any time. 🤗 + +## Stargazers over time + +[](https://star-history.com/#meysam81/timeframe&Date) + + +%prep +%autosetup -n timeframe-1.0.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-timeframe -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.0-1 +- Package Spec generated @@ -0,0 +1 @@ +0cbb6f095e7edb6e7f0fa79a10ad6a8f timeframe-1.0.0.tar.gz |