A few basic tools I feel are missing in the standard Python distribution.
Project description
My Python Toolkit
This is just a miscellaneous collection of some tools I use regularly that I decided to compile into one package for easy use by mainly me. All examples will assume the package has been imported as kit
.
Install from PyPi: pip install mypytoolkit
.
import mypytoolkit as kit
Dates and Times
kit.time_now()
returns a string of the current time in the format "%H-%M". Midnight is "00-00" and 8:35 a.m. is "08-35". 10 p.m. is "22-00".
kit.today_date()
returns a string of the current date in the format "%Y-%M-%D", where Feb 22, 2022, is "2022-02-22".
Python Tools
kit.tprint()
displays the contents of an object along with its type. I got fed up of constantly writing print(obj, type(obj))
when debugging so I found myself constantly defining a tprint()
function:
def tprint(obj):
print(obj, type(obj))
return [obj, type(obj)]
Super simple but it makes a night and day difference when debugging in lightspeed.
Document Checks
kit.are_docs_same()
will tell you if two documents (of any type) have the exact same contents. It takes two parameters.
kit.are_docs_same(original_dir: str, new_dir: str)
It returns a boolean, True
or False
, depending on whether the contents of the two files are identical. There is no grey area.
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
File details
Details for the file mypytoolkit-0.1.0.tar.gz
.
File metadata
- Download URL: mypytoolkit-0.1.0.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4583fa64b22dc4c55f7e06fa7931c577dc4aa8c7dc83524926133ccfb95f81b7 |
|
MD5 | c59637e31bfce3b92f5fc736b9e37435 |
|
BLAKE2b-256 | 7902b3cd9db958ca525bc569981a9387b3f5e2fa4c97855395db0bb31275b9a4 |
File details
Details for the file mypytoolkit-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: mypytoolkit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a219ba5fb55302c8876875a1555b10e5ffa06f161fe3f2d7bc152f8c69cece8 |
|
MD5 | 2f1a9f963e831075bbbed73b73fc23b1 |
|
BLAKE2b-256 | 72b67c98bfc5af3d4e009ca7a18af8e8401a95a357b88fe4a2e5afda6defa4e0 |