Helper class to time python processes
Project 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:
>>> 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
>>> tu.time_utils.ts_dict()
{
'year': '2019',
'month': '12',
'day': '29',
'hour': '00',
'min': '24',
'sec': '43'
}
sql_ts
>>> tu.time_utils.sql_ts()
'2019-12-29 00:25:00'
s3_ts
>>> tu.time_utils.s3_ts()
'/2019/12/29/'
s3_glue_ts
>>> tu.time_utils.s3_glue_ts()
'/year=2019/month=12/day=29/'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file time_utils-1.0.1.tar.gz.
File metadata
- Download URL: time_utils-1.0.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.41.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62fbd7f680dabfe5aa97af710e62eb7993673dea5448a86a086c40d434823bf8
|
|
| MD5 |
4496762b3a1ce4464d48e1db591ce26e
|
|
| BLAKE2b-256 |
c4a0ee62c952c6a0b7d0b33294ca4688653f65ff1d7f0bcf14eb1df740057aad
|
File details
Details for the file time_utils-1.0.1-py3-none-any.whl.
File metadata
- Download URL: time_utils-1.0.1-py3-none-any.whl
- Upload date:
- Size: 3.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.41.0 CPython/3.7.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
119550e8b53dc87187334b6b01f6c43136caed2f25044c3d40414370b979404b
|
|
| MD5 |
c2af7c6593020932b5675c5f232ce8db
|
|
| BLAKE2b-256 |
5a1fc8f75e96a1f8eff91201afc6ebbf47a2cf1d25ce52e79ab054f5bf4a614d
|