diff options
author | CoprDistGit <infra@openeuler.org> | 2023-04-11 22:39:53 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-04-11 22:39:53 +0000 |
commit | 0821abc11600113487ddf441273bdd3b60b82bff (patch) | |
tree | 8af9af7c83a9e1ea4f2a965378f1d21651dbe158 | |
parent | e886f3c2c9fd81de4472272d51857c7c54673687 (diff) |
automatic import of python-int-date
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | python-int-date.spec | 512 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 514 insertions, 0 deletions
@@ -0,0 +1 @@ +/int_date-0.2.0.tar.gz diff --git a/python-int-date.spec b/python-int-date.spec new file mode 100644 index 0000000..5ce4ad1 --- /dev/null +++ b/python-int-date.spec @@ -0,0 +1,512 @@ +%global _empty_manifest_terminate_build 0 +Name: python-int-date +Version: 0.2.0 +Release: 1 +Summary: Utility for int date like 20150312. +License: BSD +URL: https://github.com/jealous/int_date +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/15/9e/146b4ea9d7892b7b21948269f37e8e79724c1da2a059d282c2367a3ea072/int_date-0.2.0.tar.gz +BuildArch: noarch + +Requires: python3-six +Requires: python3-dateutil + +%description +# Integer Date utilities + +[](https://github.com/jealous/int_date/actions/workflows/build-test.yml) +[](https://codecov.io/gh/jealous/int_date) +[](https://pypi.python.org/pypi/int_date) + + +VERSION: 0.2.0 + +This module contains the utilities for operating integer date, such as: 20150301 + +#### Issues + +We use [Github Issues](https://github.com/jealous/int_date) to manage the issues. + +#### Contact author: + +cedric.zhuang@gmail.com + +## LICENSE + +[BSD License](./LICENSE.txt) + +## API Document + +###`int_date` + +Converts the input to an integer that represents a date. + +* Parameter: a `str`, `datetime.datetime`, `datetime.date` or number +* Exception: `ValueError` if the input could not be converted +* Return: an integer represents a date + +Examples: +``` python +>>> int_date(10121015.0) +10121015 + +>>> int_date('2012/10/15') +10121015 + +>>> int_date('2012-10-15') +10121015 + +>>> int_date(datetime.date(2015, 5, 21)) +20150521 +``` + +### `to_date` + +Converts the input to `datetime.date` + +* Parameter: a `str` or number +* Exception: `ValueError` if the input could not be converted +* Return: a `datetime.date` object + +Examples: +``` python +>>> to_date(20151205) +datetime.date(2015, 12, 5) + +>>> to_date('2015-12-05') +datetime.date(2015, 12, 5) +``` + +### `get_interval` + +Retrieve the days between two dates. +* Parameter: 2 inputs that represents valid dates +* Exception: `ValueError` if any of the input is not valid +* Return: the days in between + +Examples: +``` python +>>> get_interval(20120530, '2012-06-02') +3 + +>>> get_interval('2012/6/6', '2012-06-02') +-4 +``` + +### `from_diff` + +Retrieve the int date from a start date and a delta. + +* Parameter: a start date and a delta +* Exception: `ValueError` if start date is not valid +* Return: the result date + +Examples: +``` python +>>> from_diff('2012-7-31', 5) +20120805 + +>>> from_diff('2012/8/3', -10) +20120724 +``` + +### `in_month`, `in_date` & `in_year` + +Check whether the int date matches the specified month, date or year. + +* Parameter: an int date and multiple value to match +* Exception: `ValueError` if the int date is not valid +* Return: true if it matches, false if not + +Examples: +``` python +>>> in_date(20140503, *[3, 5, 7]) +True + +>>> in_month('2014-05-03', *{3, 5, 7}) +True + +>>> in_month(20140131, *[3, 5, 7]) +False + +>>> in_date('2014-01-31', 30) +False +``` + +### `today` + +Retrieve the int date that represents today. + +### `get_workdays` + +Retrieve the work days (Monday~Friday) between two dates + +* Parameter: two int dates mark the start and end, both ends are inclusive +* Exception: `ValueError` if the input date is not valid +* Return: number of workdays + +Example: +``` python +# Note: 2022-01-03 is Monday +>>> get_workdays(20220102, 20220108) +5 + +>>> get_workdays(20220102, 20220107) +5 + +>>> get_workdays(20220102, 20220106) +4 +``` + + + +%package -n python3-int-date +Summary: Utility for int date like 20150312. +Provides: python-int-date +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-int-date +# Integer Date utilities + +[](https://github.com/jealous/int_date/actions/workflows/build-test.yml) +[](https://codecov.io/gh/jealous/int_date) +[](https://pypi.python.org/pypi/int_date) + + +VERSION: 0.2.0 + +This module contains the utilities for operating integer date, such as: 20150301 + +#### Issues + +We use [Github Issues](https://github.com/jealous/int_date) to manage the issues. + +#### Contact author: + +cedric.zhuang@gmail.com + +## LICENSE + +[BSD License](./LICENSE.txt) + +## API Document + +###`int_date` + +Converts the input to an integer that represents a date. + +* Parameter: a `str`, `datetime.datetime`, `datetime.date` or number +* Exception: `ValueError` if the input could not be converted +* Return: an integer represents a date + +Examples: +``` python +>>> int_date(10121015.0) +10121015 + +>>> int_date('2012/10/15') +10121015 + +>>> int_date('2012-10-15') +10121015 + +>>> int_date(datetime.date(2015, 5, 21)) +20150521 +``` + +### `to_date` + +Converts the input to `datetime.date` + +* Parameter: a `str` or number +* Exception: `ValueError` if the input could not be converted +* Return: a `datetime.date` object + +Examples: +``` python +>>> to_date(20151205) +datetime.date(2015, 12, 5) + +>>> to_date('2015-12-05') +datetime.date(2015, 12, 5) +``` + +### `get_interval` + +Retrieve the days between two dates. +* Parameter: 2 inputs that represents valid dates +* Exception: `ValueError` if any of the input is not valid +* Return: the days in between + +Examples: +``` python +>>> get_interval(20120530, '2012-06-02') +3 + +>>> get_interval('2012/6/6', '2012-06-02') +-4 +``` + +### `from_diff` + +Retrieve the int date from a start date and a delta. + +* Parameter: a start date and a delta +* Exception: `ValueError` if start date is not valid +* Return: the result date + +Examples: +``` python +>>> from_diff('2012-7-31', 5) +20120805 + +>>> from_diff('2012/8/3', -10) +20120724 +``` + +### `in_month`, `in_date` & `in_year` + +Check whether the int date matches the specified month, date or year. + +* Parameter: an int date and multiple value to match +* Exception: `ValueError` if the int date is not valid +* Return: true if it matches, false if not + +Examples: +``` python +>>> in_date(20140503, *[3, 5, 7]) +True + +>>> in_month('2014-05-03', *{3, 5, 7}) +True + +>>> in_month(20140131, *[3, 5, 7]) +False + +>>> in_date('2014-01-31', 30) +False +``` + +### `today` + +Retrieve the int date that represents today. + +### `get_workdays` + +Retrieve the work days (Monday~Friday) between two dates + +* Parameter: two int dates mark the start and end, both ends are inclusive +* Exception: `ValueError` if the input date is not valid +* Return: number of workdays + +Example: +``` python +# Note: 2022-01-03 is Monday +>>> get_workdays(20220102, 20220108) +5 + +>>> get_workdays(20220102, 20220107) +5 + +>>> get_workdays(20220102, 20220106) +4 +``` + + + +%package help +Summary: Development documents and examples for int-date +Provides: python3-int-date-doc +%description help +# Integer Date utilities + +[](https://github.com/jealous/int_date/actions/workflows/build-test.yml) +[](https://codecov.io/gh/jealous/int_date) +[](https://pypi.python.org/pypi/int_date) + + +VERSION: 0.2.0 + +This module contains the utilities for operating integer date, such as: 20150301 + +#### Issues + +We use [Github Issues](https://github.com/jealous/int_date) to manage the issues. + +#### Contact author: + +cedric.zhuang@gmail.com + +## LICENSE + +[BSD License](./LICENSE.txt) + +## API Document + +###`int_date` + +Converts the input to an integer that represents a date. + +* Parameter: a `str`, `datetime.datetime`, `datetime.date` or number +* Exception: `ValueError` if the input could not be converted +* Return: an integer represents a date + +Examples: +``` python +>>> int_date(10121015.0) +10121015 + +>>> int_date('2012/10/15') +10121015 + +>>> int_date('2012-10-15') +10121015 + +>>> int_date(datetime.date(2015, 5, 21)) +20150521 +``` + +### `to_date` + +Converts the input to `datetime.date` + +* Parameter: a `str` or number +* Exception: `ValueError` if the input could not be converted +* Return: a `datetime.date` object + +Examples: +``` python +>>> to_date(20151205) +datetime.date(2015, 12, 5) + +>>> to_date('2015-12-05') +datetime.date(2015, 12, 5) +``` + +### `get_interval` + +Retrieve the days between two dates. +* Parameter: 2 inputs that represents valid dates +* Exception: `ValueError` if any of the input is not valid +* Return: the days in between + +Examples: +``` python +>>> get_interval(20120530, '2012-06-02') +3 + +>>> get_interval('2012/6/6', '2012-06-02') +-4 +``` + +### `from_diff` + +Retrieve the int date from a start date and a delta. + +* Parameter: a start date and a delta +* Exception: `ValueError` if start date is not valid +* Return: the result date + +Examples: +``` python +>>> from_diff('2012-7-31', 5) +20120805 + +>>> from_diff('2012/8/3', -10) +20120724 +``` + +### `in_month`, `in_date` & `in_year` + +Check whether the int date matches the specified month, date or year. + +* Parameter: an int date and multiple value to match +* Exception: `ValueError` if the int date is not valid +* Return: true if it matches, false if not + +Examples: +``` python +>>> in_date(20140503, *[3, 5, 7]) +True + +>>> in_month('2014-05-03', *{3, 5, 7}) +True + +>>> in_month(20140131, *[3, 5, 7]) +False + +>>> in_date('2014-01-31', 30) +False +``` + +### `today` + +Retrieve the int date that represents today. + +### `get_workdays` + +Retrieve the work days (Monday~Friday) between two dates + +* Parameter: two int dates mark the start and end, both ends are inclusive +* Exception: `ValueError` if the input date is not valid +* Return: number of workdays + +Example: +``` python +# Note: 2022-01-03 is Monday +>>> get_workdays(20220102, 20220108) +5 + +>>> get_workdays(20220102, 20220107) +5 + +>>> get_workdays(20220102, 20220106) +4 +``` + + + +%prep +%autosetup -n int-date-0.2.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-int-date -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Tue Apr 11 2023 Python_Bot <Python_Bot@openeuler.org> - 0.2.0-1 +- Package Spec generated @@ -0,0 +1 @@ +0c0e787bdc893ed603e1cc9d243afd2b int_date-0.2.0.tar.gz |