PyCFUtils (Cristi Fati's Utils for Python (&& more)) - a collection of goodies ((cool) scripts / utilities)
Project description
PyCFUtils
PyCFUtils (Cristi Fati's Utils for Python (&& more)) - a collection of goodies ((cool) scripts / utilities)
Install
Use PIP:
python -m pip install --upgrade pycfutils
Usage example
import time
import pycfutils.io
import pycfutils.miscellaneous as misc
import pycfutils.network
import pycfutils.system
from pycfutils.exceptions import ModuleException, NetworkException
print("Press a key in less than one second...")
print(pycfutils.io.read_key(timeout=1))
print(misc.timestamp_string(human_readable=True))
print(tuple(misc.progression(ratio=2)))
@misc.timed_execution()
def func(arg0, kw0=1):
time.sleep(0.2)
return 5
func("123")
try:
print(pycfutils.network.connect_to_server("127.0.0.1", 22))
except NetworkException as e:
print(e)
pycfutils.system.cpu_stress(3)
# --- Requires PyGObject (also might take some time to complete) ---
try:
from pycfutils.gstreamer import RegistryAccess
except ModuleException as e:
print(e)
else:
ra = RegistryAccess()
print(ra.element_classes())
# --- Windows only ---
import pycfutils.gui
print(pycfutils.gui.message_box("Title", "Text to display", x=320, y=200))
Also, there are some useful (CLI wrapper) scripts in the tools folder. Check them:
-
Nix:
ls "pycfutils/tools" for script in $(find "pycfutils/tools" -maxdepth 1 -type f); do python "${script}" -h; done
-
Win:
dir /b "pycfutils\tools" for /f %g in ('dir /b /a-d /a-l "pycfutils\tools\*.py"') do (python "pycfutils\tools\%g" -h)
Or run them as modules (e.g. in 2 separate terminals). Example (Shell snippets that also work in Batch):
-
Terminal 1:
python -m pycfutils.tools.connect_to_server -a 127.0.0.1 -p 16180 # Go to the other terminal and run the other command (start the server), then come back and re-run the previous command python -m pycfutils.tools.connect_to_server -a 127.0.0.1 -p 16180
-
Terminal 2:
python -m pycfutils.tools.start_server -a 127.0.0.1 -p 16180
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
pycfutils-2024.6.5.tar.gz
(27.0 kB
view hashes)
Built Distributions
Close
Hashes for pycfutils-2024.6.5-py3-none-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51c3b0f7f6a24d2fb543b1c7b560de43517478136e1c27ad70e996a909e8b37b |
|
MD5 | 7628fbe3f39f7d969f9230813a34db3e |
|
BLAKE2b-256 | e1de93d9eb7d3c702bf7adf77cf0bb01f74da004a4bb741e69e1716f6a6b9fd5 |
Close
Hashes for pycfutils-2024.6.5-py3-none-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a6dcf77c90ed420aec6d8e3627302753c7b62965a36927a0003479cc1be02293 |
|
MD5 | f8a9f4bee1c6be856025353a00956909 |
|
BLAKE2b-256 | 0dc1d1908dca777eb26f90d9c29a10ce8792248d19ae31dba2aecdd4d5847226 |
Close
Hashes for pycfutils-2024.6.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5ea8e2d0e3345cb5e485e72e3b8c7f50cef8ed03d19f99f84bcac4fb9536c3c1 |
|
MD5 | 02376e990ea5bd9798733bc13055eeaf |
|
BLAKE2b-256 | a41ca81ba05d72379034dce83f855906ee5f7bc72f04de1b5bf22bd5d6c1ae56 |