JynPopMod Python Module
Project description
pip install JynPopMod
Utility Functions:
-
wait(key="s", num=1): Pauses execution for a specified amount of time. The unit is controlled by thekeyparameter, which can be 's' for seconds, 'm' for minutes, or 'h' for hours. -
ifnull(_v, _d): Returns_dif_visNoneor an empty string. Otherwise, it returns_v. -
switch_case(_v, _c, d=None): Looks up a value_vin dictionary_cand returns the corresponding value. If_visn't in_c, it returnsd. If the value is callable (e.g., a function), it is executed. -
timer_function(func, seconds): Executes the functionfuncafter waiting for a specified number of seconds. -
iftrue(var, function): IfvarisTrue, it calls the functionfunction. -
iffalse(var, function): IfvarisFalse, it calls the functionfunction. -
replace(string, replacement, replacement_with): Replaces occurrences ofreplacementin the string withreplacement_with. -
until(function, whattodo): Repeatedly executeswhattodo()untilfunction()evaluates toTrue. -
repeat(function, times): Executes the functionfunctiona specified number of times. -
oncondit(condition, function_true, function_false): Executesfunction_trueifconditionisTrue, else it executesfunction_false. -
repeat_forever(function): Continuously executesfunctionindefinitely. -
safe_run(func, *args, **kwargs): Safely runs a functionfunc, catching and printing any exceptions that may occur. -
start_timer(seconds, callback): Callscallbackafter waiting forsecondsseconds. -
generate_random_string(length=15): Generates a random string of alphanumeric characters and symbols of the specifiedlength. -
get_ip_address(): Returns the local IP address of the machine. -
send_email(subject, body, to_email, mailname, mailpass): Sends an email using Gmail's SMTP server. Requires a Gmail account's username and password. -
generate_unique_id(): Generates and returns a unique ID usinguuid. -
start_background_task(backtask): Starts a functionbacktaskin a separate thread, allowing it to run in the background. -
nocrash(func): A decorator that wraps a functionfuncto ensure it doesn't crash. If an error occurs, it is caught and logged. -
parallel(*functions): Executes multiple functions in parallel by running them in separate threads. -
gs(func): Returns the source code of the functionfuncas a string.
String and Binary Functions:
-
Jctb(input_string): Converts a string into its binary representation, where each character is represented by a 10-bit binary value. -
Jbtc(binary_input): Converts a binary string (produced byJctb) back to its original string. -
encode_base64(data): Encodes a stringdatainto its Base64 representation. -
decode_base64(encoded_data): Decodes a Base64 encoded string back to its original string. -
reverse_string(string): Reverses the input string.
Math and List Functions:
-
calculate_factorial(number): Recursively calculates the factorial of a number. -
generate_random_string(length=15): (Defined twice, see above.) -
swap_values(a, b): Swaps the values ofaandband returns the swapped values. -
replace(string, old, new): (Defined twice, see above.) -
find_maximum(numbers): Finds and returns the maximum value in a list of numbers. -
find_minimum(numbers): Finds and returns the minimum value in a list of numbers. -
sum_list(lst): Returns the sum of elements in the listlst. -
reverse_list(lst): Returns the reverse of the listlst. -
is_prime(n): ReturnsTrueifnis a prime number, otherwise returnsFalse. -
split_into_chunks(text, chunk_size): Splits a stringtextinto chunks of sizechunk_size. -
unique_elements(lst): Returns a list of unique elements from the input listlst. -
calculate_average(numbers): Returns the average of a list of numbers. -
calculate_median(numbers): Returns the median of a list of numbers. -
count_words(text): Counts and returns the number of words in the input stringtext. -
count_sentences(text): Counts and returns the number of sentences in the input stringtext. -
add_commas(input_string): Adds commas between characters in the input string. -
remove_spaces(text): Removes all spaces from the input stringtext. -
calculate_square_root(number): Approximates the square root ofnumberusing the Newton-Raphson method.
File Handling and System Functions:
-
find_files_by_extension(directory, extension): Returns a list of files in the directory that have the specified file extension. -
get_curr_dir(): Returns the current working directory. -
check_if_file_exists(file_path): Checks if a file exists atfile_path. -
monitor_new_files(directory, callback): Continuously monitors the directory for new files and callscallbackwhenever new files are added. -
get_system_uptime(): Returns the system's uptime in seconds. -
get_cpu_templinux(): Retrieves the CPU temperature on a Linux system. -
monitor_file_changes(file_path, callback): Monitors the file for changes and callscallbackwhen the file is modified. -
write_to_file(filename, content): Writes thecontentto the specifiedfilename. -
read_from_file(filename): Reads and returns the content of the file specified byfilename. -
parse_json(json_string): Parses a JSON string and returns the corresponding Python object. -
create_file_if_not_exists(filename): Creates a file if it doesn't already exist. -
create_directory(directory): Creates the specified directory if it doesn't exist. -
get_cpu_usage(): Returns the current CPU usage percentage usingpsutil. -
get_memory_usage(): Returns the current memory usage percentage usingpsutil. -
create_zip_file(source_dir, output_zip): Creates a ZIP archive of the specifiedsource_dir. -
extract_zip_file(zip_file, extract_dir): Extracts a ZIP archive to the specifiedextract_dir. -
move_file(source, destination): Moves a file fromsourcetodestination. -
copy_file(source, destination): Copies a file fromsourcetodestination. -
show_file_properties(file_path): Displays properties of a file (size and last modified time).
HTTP Server Functions:
-
start_http_server(ip="0.0.0.0", port=8000): Starts a simple HTTP server on the givenipandport. -
stop_http_server(): Stops the running HTTP server. -
get_server_status(url="http://localhost:8000"): Checks if the server at the given URL is up and running. -
set_server_timeout(timeout=10): Sets the timeout for server connections. -
upload_file_to_server(file_path, url="http://localhost:8000/upload"): Uploads a file to a server at the specified URL. -
download_file_from_server(file_url, save_path): Downloads a file from the server and saves it tosave_path. -
CustomRequestHandler: A custom request handler for the HTTP server that responds to specific paths ("/" and "/status"). -
start_custom_http_server(ip="0.0.0.0", port=8000): Starts a custom HTTP server using theCustomRequestHandler. -
set_server_access_logs(log_file="server_access.log"): Configures logging to store server access logs. -
get_server_logs(log_file="server_access.log"): Retrieves and prints the server access logs. -
restart_http_server(): Restarts the HTTP server. -
check_internet_connection(): Checks if the system has internet connectivity by pinginggoogle.com. -
create_web_server(directory, port=8000): Serves the contents of a directory over HTTP on the specified port. -
create_custom_web_server(html, port=8000): Serves custom HTML content over HTTP on the specified port. -
JynParser(rep): Executes a Python script passed asrepin a new context (usingexec()). -
contains(input_list, substring): Checks if the givensubstringexists within any element ofinput_list. -
Jusbcam(Device_Name): Scans connected USB devices and checks ifDevice_Nameis present in the list of detected devices.
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 jynpopmod-2.7.tar.gz.
File metadata
- Download URL: jynpopmod-2.7.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e7d800bfa1bba25dc5d1b39a15fc4bcaf00b2a798cbfc35b35da925f466a0cc
|
|
| MD5 |
c421ddf4351af2e7c5b71c2c383e849c
|
|
| BLAKE2b-256 |
fa2a13ab98c8c835aaa2694710892188e59b080c8d9376fc4e6b18b7cbbc0b80
|
File details
Details for the file JynPopMod-2.7-py3-none-any.whl.
File metadata
- Download URL: JynPopMod-2.7-py3-none-any.whl
- Upload date:
- Size: 12.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e5321794bdac25a18090a2b4531cc994a342553c1db76916f94c9fe60664168
|
|
| MD5 |
a15e9f2acb9575c2692a67505ef86d99
|
|
| BLAKE2b-256 |
9d4401d8b4ddb7b6fc3700fe4c0ad97dfd94e2dcb990168e5c555367616d751a
|