Python package for common use tools
Project description
gpctools
A package for common use tools by the Dev team at GP Joule Connect.
Tools:
. Decorators:
- exectime: decorator that prints the execution time of a function
. Generic Methods:
- list_get: A simple method similar to dict.get(), but for lists - It either returns the element of the list at index, if index exists, or None.
Installation:
pip install gpctools
Usage:
- exectime:
from gpctools.decorators import exectime
@exectime
def function_x():
"""function code"""
# prints to console: exectime: function_x() took [number of seconds, with 3 decimals]s to run.
- list_get:
from gpctools.generic import list_get
example_list = [0, 1, 2, 3]
element1 = list_get(example_list, 1)
print(element1)
# prints to console: 1
element4 = list_get(example_list, 4)
print(element4)
# prints to console: None
element5 = list_get(example_list, 5, default="Element not found")
print(element5)
# prints to console: Element not found
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
gpctools-0.1.8.tar.gz
(2.4 kB
view details)
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 gpctools-0.1.8.tar.gz.
File metadata
- Download URL: gpctools-0.1.8.tar.gz
- Upload date:
- Size: 2.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e3fd797dab1b5b6461898719a1052b60e0fd92cec154aa62d6f5a736ebd1da50
|
|
| MD5 |
ffb37046691ffcf18c81a2046a19ec45
|
|
| BLAKE2b-256 |
b367082d546a0fb1b36deffef7153a2d7db089376f28dbd2bfbf40a62a05afad
|
File details
Details for the file gpctools-0.1.8-py3-none-any.whl.
File metadata
- Download URL: gpctools-0.1.8-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14fd4c4e8055b5f59036cf16ee57c518bff5062ea3469952714a4780c76d4d44
|
|
| MD5 |
1a6ac4411c1ed0a5b0d3815bb3eaf72d
|
|
| BLAKE2b-256 |
8562ab25e4c6a9d29015f3ebf91d085a94d8e8a7fa7cbd70629d41682b390d8e
|