diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-10 04:25:34 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-10 04:25:34 +0000 |
| commit | e212cf58f8cade013e67aff5cf040268f1707b92 (patch) | |
| tree | 8978303151f074b7508b24a2f3fa27201ac67120 | |
| parent | 87caa555eff0c4e294e19294ba453d0a3be398e4 (diff) | |
automatic import of python-time-utilsopeneuler20.03
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | python-time-utils.spec | 267 | ||||
| -rw-r--r-- | sources | 1 |
3 files changed, 269 insertions, 0 deletions
@@ -0,0 +1 @@ +/time_utils-1.0.1.tar.gz diff --git a/python-time-utils.spec b/python-time-utils.spec new file mode 100644 index 0000000..64728d5 --- /dev/null +++ b/python-time-utils.spec @@ -0,0 +1,267 @@ +%global _empty_manifest_terminate_build 0 +Name: python-time-utils +Version: 1.0.1 +Release: 1 +Summary: Helper class to time python processes +License: MIT License +URL: https://github.com/hannaj06/time_utils +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c4/a0/ee62c952c6a0b7d0b33294ca4688653f65ff1d7f0bcf14eb1df740057aad/time_utils-1.0.1.tar.gz +BuildArch: noarch + + +%description +# time_utils + +Basic python package to time processes similar to a stopwatch. This package also includes various pre-formated timestamps for sql, s3 key prefixes, and s3 glues prefixes. + +### stopWatch + +A class intended to minimic the functionality of a stop watch. The lap function will return a human readable string of how much total time was elapsed as well as the lap time. + +basic usage: +```python +>>> from time_utils import time_utils as tu +>>> sw = tu.stopWatch() +>>> sw.lap() +Total Time: +4 second(s) + +Lap 1: +4 second(s) + +datetime.timedelta(seconds=4, microseconds=218298) +>>> sw.lap() +Total Time: +15 second(s) + +Lap 2: +11 second(s) + +datetime.timedelta(seconds=11, microseconds=440822) +``` + +### preformatted datetime outputs +All functions default to utcnow(), however a datetime object can be passed in to any function. + +#### ts_dict +```python +>>> tu.time_utils.ts_dict() +{ +'year': '2019', +'month': '12', +'day': '29', +'hour': '00', +'min': '24', +'sec': '43' +} +``` + +#### sql_ts +```python +>>> tu.time_utils.sql_ts() +'2019-12-29 00:25:00' +``` + +#### s3_ts +```python +>>> tu.time_utils.s3_ts() +'/2019/12/29/' +``` + +#### s3_glue_ts +```python +>>> tu.time_utils.s3_glue_ts() +'/year=2019/month=12/day=29/' +``` + + + + +%package -n python3-time-utils +Summary: Helper class to time python processes +Provides: python-time-utils +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-time-utils +# time_utils + +Basic python package to time processes similar to a stopwatch. This package also includes various pre-formated timestamps for sql, s3 key prefixes, and s3 glues prefixes. + +### stopWatch + +A class intended to minimic the functionality of a stop watch. The lap function will return a human readable string of how much total time was elapsed as well as the lap time. + +basic usage: +```python +>>> from time_utils import time_utils as tu +>>> sw = tu.stopWatch() +>>> sw.lap() +Total Time: +4 second(s) + +Lap 1: +4 second(s) + +datetime.timedelta(seconds=4, microseconds=218298) +>>> sw.lap() +Total Time: +15 second(s) + +Lap 2: +11 second(s) + +datetime.timedelta(seconds=11, microseconds=440822) +``` + +### preformatted datetime outputs +All functions default to utcnow(), however a datetime object can be passed in to any function. + +#### ts_dict +```python +>>> tu.time_utils.ts_dict() +{ +'year': '2019', +'month': '12', +'day': '29', +'hour': '00', +'min': '24', +'sec': '43' +} +``` + +#### sql_ts +```python +>>> tu.time_utils.sql_ts() +'2019-12-29 00:25:00' +``` + +#### s3_ts +```python +>>> tu.time_utils.s3_ts() +'/2019/12/29/' +``` + +#### s3_glue_ts +```python +>>> tu.time_utils.s3_glue_ts() +'/year=2019/month=12/day=29/' +``` + + + + +%package help +Summary: Development documents and examples for time-utils +Provides: python3-time-utils-doc +%description help +# time_utils + +Basic python package to time processes similar to a stopwatch. This package also includes various pre-formated timestamps for sql, s3 key prefixes, and s3 glues prefixes. + +### stopWatch + +A class intended to minimic the functionality of a stop watch. The lap function will return a human readable string of how much total time was elapsed as well as the lap time. + +basic usage: +```python +>>> from time_utils import time_utils as tu +>>> sw = tu.stopWatch() +>>> sw.lap() +Total Time: +4 second(s) + +Lap 1: +4 second(s) + +datetime.timedelta(seconds=4, microseconds=218298) +>>> sw.lap() +Total Time: +15 second(s) + +Lap 2: +11 second(s) + +datetime.timedelta(seconds=11, microseconds=440822) +``` + +### preformatted datetime outputs +All functions default to utcnow(), however a datetime object can be passed in to any function. + +#### ts_dict +```python +>>> tu.time_utils.ts_dict() +{ +'year': '2019', +'month': '12', +'day': '29', +'hour': '00', +'min': '24', +'sec': '43' +} +``` + +#### sql_ts +```python +>>> tu.time_utils.sql_ts() +'2019-12-29 00:25:00' +``` + +#### s3_ts +```python +>>> tu.time_utils.s3_ts() +'/2019/12/29/' +``` + +#### s3_glue_ts +```python +>>> tu.time_utils.s3_glue_ts() +'/year=2019/month=12/day=29/' +``` + + + + +%prep +%autosetup -n time-utils-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-time-utils -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Wed May 10 2023 Python_Bot <Python_Bot@openeuler.org> - 1.0.1-1 +- Package Spec generated @@ -0,0 +1 @@ +4496762b3a1ce4464d48e1db591ce26e time_utils-1.0.1.tar.gz |
