Just a collection of useful tools to make coding a bit easier.
Project description
PyTools
Just a collection of useful tools.
Features
nil
&null
::
Shorthand values for for the None
boolean value.
buildFunc(name='unnamed', param=[], func=['pass'], \*\*kwargs)
&buildClass
::
Functions that will build dynamically named and defined functions and classes respectively.
buildFunc(
name='a_function',
param=[
'value_1',
'value_2'
],
func=[
'a_variable = value_1 + value_2',
'print(a_variable)'
],
)
doLoggedAction(action='pass', log='Logged!', iterateMethod='set', logToScreen=True, logFile=None)
::
Executes a block of code and logging it either on the screen or in a file.
Set logToScreen
to False to only print to a file, and pass a path to a file as logFile
to log the code to the file.
doLoggedAction(
action='print(\'Hello World!\')',
log='Printed!'
)
doLoggedAction('print(\'Hello World!\')', 'Printed!')
- clear() ::
Clears the screen regardless of what system is used.
clear()
systemCheck(acceptedMachinesList=['Windows', 'Darwin', 'Linux'])
::
Makes sure the machine the program is run on can properly run the program.
systemCheck(['Windows', 'Linux'])
replaceLine(file, line, newText)
::
Takes in a path to a file, the number of the line you want to change in the file, and the string you want to change it to.
replaceLine('../text_files/a_file.txt', 3, 'This is a .txt file!')
lineBreakdown
::
A class with multiple related functions in it.
lineBreakdown().{METHOD}({PARAMETERS})
length(origText, maxLength)
-
Takes a long string and breaks it down into a list of strings that conform to specified length requirements.
lineBreakdown('Yesterday, I had work from 9:00 AM to 5:00 PM, and then I had to visit the grocery store.', 10) =>
['Yesterday,', 'I had work', 'from 9:00', 'AM to 5:00', 'PM, and', 'then I had', 'to visit', 'the', 'grocery', 'store']
lineBreakdown('Cardiovascular', 10) =>
['Cardiovas-', 'cular']
raw(line)
-
Removes the '\n' at the end of a string if it exists, this is meant for quickly iterating through a file.
lineBreakdown().raw('Hello World!\n') =>
'Hello World!'
lineBreakdown().raw('Hello World!') =>
'Hello World!'
list(line)
-
Breaks down a line into a list of string that were previously joined by a '\n'.
lineBreakdown().list('To-do List:\n- Water the plants.\n- Exercise.\n- Go to the grocery store for bread and milk.') =>
['To-do List:', '- Water the plants.', '- Exercise.', '- Go to the grocery store for bread and milk.']
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 pytools-ca-1.0.0.tar.gz
.
File metadata
- Download URL: pytools-ca-1.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3a73928aba3b1fa2f9e2a2b00413fe0b34832a3406e141694daa772d354ff1b7 |
|
MD5 | 4aec71658f9b3249610f515fafe91898 |
|
BLAKE2b-256 | 35be2cb7137c3d8303533daa7196a96faea29d419f7851a98e9542e4bbfea96b |
File details
Details for the file pytools_ca-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: pytools_ca-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72058df58830c63cba0fc183ae316cf72e0ea39adb02f7212cdcd9c2cf4f62b9 |
|
MD5 | 4e88c891ad5fdef405e98264be1fdb46 |
|
BLAKE2b-256 | 5615c221583b02c34752b4db42a57ed6a6f7abb635af589ef94dcaf9d16ebdde |