Skip to main content

SyloraQ Python Module One Step Ahead

Project description

pip install SyloraQ

Run this so u can use the library.

pip install SyloraQ

Note on imports and the 🛡️ symbol:

If a function or class has the (🛡️) symbol:

Import it with from SyloraQ.security import function_or_class
Otherwise:
Import with from SyloraQ import *

The nested symbols like 🛡️i or 🛡️i+ indicate layers of insideness (inside functions/classes of 🛡️ items), extending as needed.

Note on imports and the 🌐 symbol:

If a function or class has the (🌐) symbol:

Import it with from SyloraQ.web import function_or_class

The nested symbols like 🌐i or 🌐i+ indicate layers of insideness (inside functions/classes of 🛡️ items), extending as needed.

wait(key="s", num=1)

Pauses execution for a specified amount of time. The unit is controlled by the key parameter, which can be 's' for seconds, 'm' for minutes, or 'h' for hours.

ifnull(value, default)

Checks if the given value is missing or empty. Returns default if so, otherwise returns the original value.

switch_case(key, cases, default=None)

Looks up the key in the cases dictionary. If found, returns the corresponding value. If the value is callable (like a function), executes it. Returns default if key not found.

timer_function(func, seconds)

Executes the function func after waiting for seconds.

iftrue(var, function)

Calls function only if var is True.

iffalse(var, function)

Calls function only if var is False.

replace(string, replacement, replacement_with)

Replaces occurrences of replacement in string with replacement_with.

until(function, whattodo)

Repeatedly executes whattodo() until function() returns True.

repeat(function, times)

Executes function a specified number of times.

oncondit(condition, function_true, function_false)

Executes function_true if condition is True, otherwise executes function_false.

repeat_forever(function)

Continuously executes function indefinitely.

safe_run(func, *args, **kwargs)

Runs func safely by catching and printing exceptions if they occur.

start_timer(seconds, callback)

Calls callback after waiting for seconds.

generate_random_string(length=15)

Generates a random string of alphanumeric characters and symbols of specified length.

get_ip_address()

Returns the local IP address of the machine.

send_email(subject, body, to_email, mailname, mailpass)

Sends an email via Gmail SMTP. Requires Gmail username (mailname) and password (mailpass).

generate_unique_id()

Generates and returns a unique ID using the uuid module.

start_background_task(backtask)

Runs the function backtask in a separate thread to run it in the background.

nocrash(func)

Decorator that wraps func to catch and log errors, preventing crashes.

parallel(*functions)

Runs multiple functions concurrently in separate threads.

gs(func)

Returns the source code of the function func as a string.

Jctb(input_string)

Converts a string into a binary representation, where each character is encoded as a 10-bit binary number.

Jbtc(binary_input)

Converts a binary string (produced by Jctb) back to the original string.

encode_base64(data)

Encodes a string data into Base64.

decode_base64(encoded_data)

Decodes a Base64 encoded string back to the original string.

reverse_string(string)

Reverses the input string.

calculate_factorial(number)

Recursively calculates the factorial of number.

swap_values(a, b)

Swaps the values of a and b and returns the swapped values.

find_maximum(numbers)

Finds and returns the maximum value in the list numbers.

find_minimum(numbers)

Finds and returns the minimum value in the list numbers.

sum_list(lst)

Returns the sum of elements in the list lst.

reverse_list(lst)

Returns a reversed version of the list lst.

is_prime(n)

Returns True if n is a prime number, otherwise returns False.

split_into_chunks(text, chunk_size)

Splits a string text into chunks of size chunk_size.

unique_elements(lst)

Returns a list of unique elements from the input list lst.

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 string text.

count_sentences(text)

Counts and returns the number of sentences in the input string text.

add_commas(input_string)

Adds commas between characters in the input string.

remove_spaces(text)

Removes all spaces from the input string text.

calculate_square_root(number)

Approximates the square root of number using the Newton-Raphson method.

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 at file_path.

monitor_new_files(directory, callback)

Continuously monitors the directory for new files and calls callback whenever 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 calls callback when the file is modified.

write_to_file(filename, content)

Writes the content to the specified filename.

read_from_file(filename)

Reads and returns the content of the file specified by filename.

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 using psutil.

get_memory_usage()

Returns the current memory usage percentage using psutil.

create_zip_file(source_dir, output_zip)

Creates a ZIP archive of the specified source_dir.

extract_zip_file(zip_file, extract_dir)

Extracts a ZIP archive to the specified extract_dir.

move_file(source, destination)

Moves a file from source to destination.

copy_file(source, destination)

Copies a file from source to destination.

show_file_properties(file_path)

Displays properties of a file (size and last modified time).

start_http_server(ip="0.0.0.0", port=8000)

Starts a simple HTTP server on the given ip and port.

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 to save_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 the CustomRequestHandler.

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 pinging google.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 as rep in a new context (using exec()).

contains(input_list, substring)

Checks if the given substring exists within any element of input_list.

Jusbcam(Device_Name)

Scans connected USB devices and checks if Device_Name is present in the list of detected devices.

  1. claw()

A customizable HTTP server with:

  • Custom HTML & subdomains
  • IP and port settings (default 0.0.0.0:8000)
  • Logging control
  • Custom 404 page
  • Auth token for API
  • POST /api/message for sending messages
  1. ConsoleCam()

Records and returns changes in the console output for a specific part.

  1. prn()

A faster printing function than standard print().

  1. Key(KeyName)

Simulates keyboard actions:

  • .press(), .release(), .tap()
  • .type_text(text)
  • .press_combo(tuple_of_keys)
  1. copy_to_clipboard(text)

Copies text to system clipboard.

  1. count_occurrences(lst, element)

Counts occurrences of element in lst.

  1. get_curr_time()

Returns the current date and time in the format YYYY-MM-DD HH:MM:SS.

  1. is_palindrome(s)

Checks if the string s is a palindrome (same forward and backward).

  1. get_min_max(list)

Returns the minimum and maximum values from the list.

  1. is_digits(input)

Checks if the input is a string consisting only of digits.

  1. create_dict(keys, values)

Creates a dictionary by pairing elements from keys and values.

  1. square_number(input)

Returns the square of the number input.

  1. get_file_size(file_path)

Gets the size of the file at file_path.

  1. find_duplicates(lst)

Finds and returns duplicate elements from the list lst.

  1. get_average(list)

Calculates the average of the numbers in the list.

  1. divide(a, b)

Divides a by b and handles division by zero.

  1. extract_numbers(s)

Extracts all numbers from the string s.

  1. BinTrig

A class with multiple methods to bind various Tkinter window and widget events to custom functions, such as mouse movements, key presses, window resize, focus changes, etc.

  1. ByteJar

Sets/Deletes/Gets Cookies with a 3rd party lightweight program. Download Link

  1. letterglue(str="", *substr, str2="")

Joins strings and substrings into one string.

  1. letterglue_creator(word)

Generates code to convert each letter of a word into variables and joins them using letterglue.

  1. Baudio("filename=audio_data", mode="Write", duration=5, Warn=True)

Records audio for a specified duration, saves to a .Bau file, returns it or plays it. Requires a lightweight program. Usage: Baudio(filename="my_recording", mode="Write", duration=5, Warn=True)

  1. Btuple

A utility class with methods like:

  • .count(*words) - counts total words
  • .get(index, *words) - retrieves word at index
  • .exists(item, *words) - checks existence
  • .first(*words) - gets first word or error
  • .last(*words) - gets last word or error
  1. isgreater(*nums)

Compares two numbers; returns True if first is greater, else error if input invalid.

  1. runwfallback(func, fallback_func)

Runs func(), if it fails runs fallback_func() instead.

  1. retry(func, retries=3, delay=1)

Tries running func() multiple times with delays. Returns None if all attempts fail.

  1. fftime(func)

Measures and prints the execution time of func().

  1. debug(func)

Logs function calls, arguments, and return values for debugging.

  1. paste_from_clipboard()

Retrieves and returns text from the system clipboard.

  1. watch_file(filepath, callback)

Monitors file changes and triggers callback() on modification.

  1. is_website_online(url)

Checks if the url is reachable; returns True if online.

  1. shorten_url(long_url)

Generates and returns a shortened URL.

  1. celsius_to_fahrenheit(c)

Converts Celsius c to Fahrenheit.

  1. fahrenheit_to_celsius(f)

Converts Fahrenheit f to Celsius.

  1. efv(string)

Parses code string for variables, returns dictionary of variables. Example: parser = efv("x=5,y=2"); print(parser['y']) outputs 2.

  1. Hpass(limit=30)

Generates a strong password of specified length (limit).

  1. l(input)

Converts input into a list.

  1. dl(input)

Converts a list input into a string.

  1. mix(input)

Returns a "mix" of the input (details depend on implementation).

  1. sugar(input)

"Sugars" (super salts) the input (details depend on implementation).

  1. get_type(value)

Returns the type and string representation of value.

  1. Cache Class

A simple caching system to store and retrieve key-value pairs.

  1. cantint(egl, ftw, tw)

Performs comparisons on values based on provided parameters and clears the tw list if certain conditions are met.

  1. flatten(obj)

Flattens a nested list (or iterable) into a single iterable.

  1. memoize(func)

Caches the result of a function to optimize performance.

  1. chunk(iterable, size)

Breaks down a large iterable (e.g., list, string) into smaller chunks of a specified size.

  1. merge_dicts(*dicts)

Merges multiple dictionaries into one.

  1. deep_equal(a, b)

Checks if two objects (lists or dictionaries) are deeply equal.

  1. split_by(text, size)

Splits a string into chunks of a given size.

  1. GoodBye2Spy Class

A class that encapsulates several password and data processing techniques for security-related tasks.

  1. Passworded (Method inside GoodBye2Spy)

Provides functionality for creating and verifying password hashes with key mixing and randomization.

  1. Shifting (Method inside GoodBye2Spy)

Implements a hashing function that uses bitwise operations on the input data.

  1. Oneway (Method inside GoodBye2Spy)

Creates a one-way hashed value using a combination of key mixing and a shifting hash technique.

  1. slc(code: str)

Strips and parses the provided Python code to remove unnecessary line breaks and spaces.

  1. AI(text,questions=None,summarize_text=False,summary_length=3)

It can answer questions or summarize the text.

  1. GAI (Method inside AI)

It can answer and summarize text. (Better than summarize when it comes to QA.)

  1. summarize (Method inside AI)

It can summarize text. (Better than GAI when it comes to summarizing.)

  1. requireADMIN(For windows only!)

Shuts the program with an error when opened if not run as Administrator.

  1. __get_raw_from_web(url)

Returns the raw text from the raw text url (Module).

  1. @private

Wraps the function so it can only be used within the class where it's defined.

  1. OTKeySystem

A class that can verify user without needing a database. Has web version.

  1. creator(timestamp=25) (Method inside OTKeySystem)

Generates one-time usable, location and program reopen proof key.

  1. verifier(key,timestamp=25) (Method inside OTKeySystem)

Verifies keys generated by creator without any database (timestamp must be the same!).

  1. remove(input,*chars)

Removes all elements from chars list if they exist in the input text.

  1. get_screen_size()

Returns screen size (width, height).

  1. NCMLHS(data: str, shift_rate1=3, shift_rate2=5, rotate_rate1=5, rotate_rate2=7, bits=64)

Shifts, rotates, shifts, and rotates the data again.

  1. remove_duplicates(lst)

Removes all duplicates from the lst list if they exist.

  1. uncensor(input)

Uncensors censored content from the input text such as H311@ to Hello (accuracy approx. 85%).

  1. BendableLists

A class for managing multiple named lists that can be created, extended, or queried dynamically.

  1. create(list_name) (Method inside BendableLists)

Initializes a new empty list with the specified name, unless it already exists.

  1. add(list_name, *elements) (Method inside BendableLists)

Adds one or more elements to the specified list if it exists.

  1. remove(list_name, element) (Method inside BendableLists)

Removes a specific element from a named list, if both the list and element exist.

  1. get(list_name) (Method inside BendableLists)

Retrieves the contents of a list by name; returns None if the list doesn't exist.

  1. Nexttime(func, func2)

Executes func the first time it's called, then alternates with func2 on subsequent calls using a toggled internal state key ("runnext").

  1. Http

A class that can get and post requests to the web.

  1. get (Method inside Http)

Returns scraped data from url.

  1. post (Method inside Http)

Posts a request to a url and returns the response.

  1. getos()

Returns the OS where the script runs.

  1. str2int(input)

Returns character positions in alphabet based on input such as abc to 123 or acb to 132.

  1. int2str(input)

Does the opposite of str2int.

  1. shiftinwin(shiftrate,text)

Shifts text with the rate of shiftrate and returns it, e.g., shiftinwin(5,Hii) cycles characters.

  1. runwithin(code,call,params)

Runs the code calling class > function() or class.function() with the params.

  1. 🛡️ Locker

A class that can lock or unlock a string based on a key (numbers not supported).

  1. 🛡️i Lock (Method inside Locker)

Locks the data based on key and returns it.

  1. 🛡️i Unlock (Method inside Locker)

Unlocks the locked data with key and returns it.

  1. alphabet_shift(text, shiftrate)

Shifts text by the amount of shiftrate and returns it, e.g., "ABC",1"BCD".

  1. wkint(script, expire=5)

Waits until expire seconds expire. Use never as expire for no expiry.

  1. countdown(from_to_0)

Counts down every second and prints until from_to_0 reaches 0.

  1. inviShade

A class that turns any input into a single invisible character and another that decodes it back to the full original message.

  1. encode (Method inside inviShade)

Encodes input text to a single invisible char.

  1. decode (Method inside inviShade)

Reverses encoding.

  1. boa(string, option, pin)

Returns option from the pin in string.
Example: boa("Hello//abc", b or before, "//") outputs Hello because it comes before //. If after, outputs abc.

  1. 🛡️ Quasar

A class that turns any input into a single invisible character and another that decodes it back to the full original message.

  1. 🛡️i encode (Method inside Quasar)

Encrypts input.

  1. 🛡️i decode (Method inside Quasar)

Reverses encrypting.

  1. @time_limited_cache(seconds)

Like memoize() but caches results only for seconds period of time.

  1. GlowShell

A utility class that provides styled printing, cursor control, and animated frame playback in the terminal.

  1. print(message, fg=None, bg=None, bold=False, underline=False, dim=False, bright=False, blink=False, end="\n") (Method inside GlowShell)

Prints the message with given color and style settings. Automatically resets the style after printing.

  1. clear() (Method inside GlowShell)

Clears the entire terminal screen and moves the cursor to the top-left corner.

  1. clear_line() (Method inside GlowShell)

Clears the current line only, leaving the rest of the terminal untouched.

  1. move_cursor(row, col) (Method inside GlowShell)

Moves the terminal cursor to the specified row and column.

  1. hide_cursor() (Method inside GlowShell)

Hides the blinking terminal cursor until shown again.

  1. show_cursor() (Method inside GlowShell)

Shows the terminal cursor if it was previously hidden.

  1. test() (Method inside GlowShell)

Demonstrates usage of styles, colors, cursor movement, and clearing capabilities. Useful for checking terminal support.

  1. animate_frames(frames, ...) (Method inside GlowShell)
This function displays a sequence of multi-line text frames (like ASCII art) in the terminal, one after the other, with optional looping and formatting like color, bold, delay, etc.
--------------------------------------------------------------------------------------------------------------------------------
|    Key    |       Description        |                                   Values                                              |
|-----------|--------------------------|---------------------------------------------------------------------------------------|
| `fg`      | Foreground (text) color  | `"black"`, `"red"`, `"green"`, `"yellow"`, `"blue"`, `"magenta"`, `"cyan"`, `"white"` |
| `bg`      | Background color         | Same as `fg` colors                                                                   |
| `bold`    | Bold text                | `true` or `false`                                                                     |
| `dim`     | Dim text                 | `true` or `false`                                                                     |
|`underline`| Underline text           | `true` or `false`                                                                     |
| `bright`  | Bright color variation   | `true` or `false`                                                                     |
| `blink`   | Blinking text            | `true` or `false`                                                                     |
| `delay`   | Delay time for this frame| Any positive number like `0.3`, `1`, etc.  (Seconds)                                  |
--------------------------------------------------------------------------------------------------------------------------------
frames = [
"--/fg:green,bold:true,delay:1/--\nThis is a green bold frame.",
"--/fg:yellow,dim:true,delay:0.5/--\nNow it's dim and yellow.",
"--/fg:red,bg:white,blink:true,delay:0.3/--\nRed on white and blinking."
]
  1. @lazy_property

A property decorator that computes a value once on first access and caches it for later use.

  1. 🌐 BrowSentinel(headless=True, port=9222)

High-level browser controller class that manages a headless Chrome instance with remote debugging enabled on the specified port. Provides methods to control browsing, page navigation, interaction, and automation.

  1. 🌐i start() (Method inside BrowSentinel)

Launches Chrome with remote debugging enabled, connects to the first available browser page, and enables key domains (Page, DOM, and Network) to prepare for interaction.

  1. 🌐i navigate(url) (Method inside BrowSentinel)

Navigates the browser to the specified URL. Returns a response including frame and loader identifiers.

  1. 🌐 reload() (Method inside BrowSentinel)

Reloads the current page.

  1. 🌐 back() (Method inside BrowSentinel)

Navigates back in the browser history by retrieving the navigation history and navigating to the previous entry.

  1. 🌐 forward() (Method inside BrowSentinel)

Navigates forward in the browser history similarly by using navigation history.

  1. 🌐 set_viewport(width, height, deviceScaleFactor=1) (Method inside BrowSentinel)

Overrides the viewport size and device scale factor to emulate different screen sizes and pixel densities.

  1. 🌐 evaluate(script) (Method inside BrowSentinel)

Executes JavaScript code within the current page context and returns the result value.

  1. 🌐 get_html() (Method inside BrowSentinel)

Retrieves the full HTML markup of the current page.

  1. 🌐 get_text() (Method inside BrowSentinel)

Retrieves the visible text content of the page (equivalent to document.body.innerText).

  1. 🌐 click(selector) (Method inside BrowSentinel)

Simulates a mouse click on the first element matched by the given CSS selector.

  1. 🌐 type(selector, text) (Method inside BrowSentinel)

Sets the value of the input element matched by the selector and dispatches an input event, simulating user typing.

  1. 🌐 wait_for(selector, timeout=5) (Method inside BrowSentinel)

Waits asynchronously until an element matching the selector appears on the page or the timeout is reached.

  1. 🌐 screenshot(path="page.png") (Method inside BrowSentinel)

Captures a screenshot of the current page and saves it as a PNG file at the specified path.

  1. 🌐 close() (Method inside BrowSentinel)

Closes the browser session and terminates the Chrome process cleanly.

The BrowSentinel class provides a minimal yet robust interface for controlling a headless Chrome browser via Chrome DevTools Protocol. It enables navigation, DOM interaction, scripting, viewport control, and screenshot capture all without external dependencies beyond Python’s standard library and a local Chrome installation.

Typical workflow:

  1. Instantiate the browser object: Browser = BrowSentinel()
  2. Start the browser and connect: browser.start()
  3. Navigate pages, interact with elements, evaluate (run JavaScript in the page), capture screenshots or extract page data
  4. Close when done: browser.close()

Try out this:

```python
t2s="""
function replaceTextWithSyloraQ() {
const walker = document.createTreeWalker(
    document.body,
    NodeFilter.SHOW_TEXT,
    null,
    false
);

let node;
while (node = walker.nextNode()) {
    if (node.nodeValue.trim() !== "") {
    node.nodeValue = "SyloraQ";
    }
}
}

replaceTextWithSyloraQ();
"""

if __name__ == "__main__":
    b = BrowSentinel()
    print("Starting browser...")
    b.start()
    b.navigate("https://example.com")
    
    
    b.screenshot()
    inp=len(input("Please Check the file then delete it before pressing enter>"))
    if inp-inp==0:
        b.evaluate(t2s)
        b.screenshot()
        b.close
```

🌐 api(port) (Works with @endpoint())

Creates an api server

🌐 @endpoint(name) (Works with api())

Adds and endpoint to the api server.

Try out this: ```python import time def run_api(port=8381): @endpoint("hello") def hello_endpoint(body, headers): name = body.get("input") if isinstance(body, dict) else None if headers.get("Token") == "YourToken": return {"message": f"Hello, {name}!"} else: return {"error": "Sorry, invalid token"}

    api(port=port)

    print(f"API server running on port {port} with endpoint '/api/hello'")
    try:
        while True:time.sleep(10000000)
    except KeyboardInterrupt:
        print("Server stopped.")

run_api(8381)
```

Then run on ur cmd: bash curl -X POST http://localhost:8381/api/hello ^ -H "Content-Type: application/json" ^ -H "Token: my-secret-token" ^ -d "{\"input\":\"Alice\"}"

stick_overlay(tk_win, process_name="Notepad.exe", x_offset=20, y_offset=60, interval=30)

Creates a dynamic overlay window that tracks the position of the main window of a given process by name, updating the overlay’s position in real-time.

similarity(sentence1, sentence2, drama_mode=False)

Calculates a similarity score between two sentences.

class Jsonify

A utility class for advanced JSON manipulation. Supports conversion from strings/files, deep access and modification, merging, validation, searching, and exporting.

from_string(json_string)

Parses a JSON string into a Jsonify object using json.loads().

frs(string)

Parses loose or malformed string in the form "key1:val1,key2:val2" into a Jsonify object.

from_file(filepath)

Loads JSON from a file and returns a Jsonify instance.

to_string(pretty=False)

Converts the internal JSON data back into a string. If pretty=True, outputs formatted JSON.

to_file(filepath, pretty=False)

Saves the internal JSON to a file. Supports pretty formatting.

get(key, default=None)

Gets value by dot notation key ("a.b.c" or "a.0.b" for lists). Returns default if not found.

set(key, value)

Sets value by dot notation key. Creates nested structures if necessary.

remove(key)

Removes value by dot notation key. Returns True if removed, else False.

merge(other)

Deep-merges another dict or Jsonify into the current data. Keys are recursively updated.

search(pattern, search_keys=True, search_values=True)

Regex-based search over keys and/or string values. Returns list of matching dot notation paths.

validate_keys(required_keys)

Ensures all given dot-notation keys exist in data. Returns True if all exist.

copy()

Returns a deep copy of the current Jsonify instance.

clear()

Clears the internal data (dict or list). If another type, resets to empty dict.

class Textify

A utility class for applying functions over characters, words, groups, or sentences in a text.

for_every_char(do)

Applies function do(char) to every character in the text.

for_every_word(do)

Applies function do(word) to every word in the text (split by whitespace).

for_every_group(n, do)

Applies function do(group) to each substring group of size n.

for_every_sentence(do)

Applies function do(sentence) to each sentence (split using punctuation and space).

result()

Returns the processed text.

def exists(string, pin)

Checks if pin exists within string.

Returns True if found, else False.

🌐 UrlValidate(url)

Validates a URL. (The url must be published on internet!)

def Shut()

Suppresses all standard output, error, and logging temporarily.

Returns a tuple of original output/logging states for restoration.

def UnShut(origins)

Restores original stdout, stderr, print, and logging.

origins should be the tuple returned by Shut().

class ZypherTrail

Encodes and decodes text using a vertical zigzag (rail fence-like) cipher.

encode(string, max_row=5)

Encodes text in a zigzag pattern up to max_row. Returns a multi-line string.

decode(encoded_str)

Decodes the zigzag-encoded string back to its original form.

NLDurationParser(seconds: int, full=False)

Converts a number of seconds into a human-readable duration string, choosing the largest suitable unit (seconds, minutes, hours, days, or years). When full is True, uses full unit names; otherwise, uses abbreviations.

justify(words, max_width)

Formats a list of words into fully justified lines of a given width. Distributes spaces evenly between words, padding the last line with spaces on the right.

draw_tree(path, prefix="")

Recursively prints a visual tree of directories and files starting from a specified path. Uses branch and indent symbols to represent file system hierarchy.

@prefix(pfx)

A decorator that scans command-line arguments and calls the decorated function with arguments matching a specific prefix (with the prefix removed).

SQS(path)

A configuration file manager supporting global keys and named sections. Loads, reads, writes, deletes, toggles, and saves config values, parsing expressions and inline comments.

#This is a comment!

# Global variables
debug = true
max_retries = 5
pi_value = 3.14159

# Section with variables
[network]
host = "localhost"
port = 8080

# Conditional assignment
if max_retries >= 3 then retry_mode = "aggressive"

# Toggle a boolean
toggle debug

# Arithmetic operation
max_retries += 2

# Copy value from one key to another
set retry_count to max_retries

# etc.

read(key, default=None, section=None) (Method inside SQS)

Retrieves a stored value from the specified section or global scope, returning a default if key is missing.

write(text) (Method inside SQS)

Parses and processes multiple lines of config expressions from a text block, updating internal state.

delete(key, section=None) (Method inside SQS)

Removes a key from a given section or the global config if no section specified.

has_key(key, section=None) (Method inside SQS)

Checks existence of a key in a section or globally.

save() (Method inside SQS)

Writes current global keys and all sections with their keys back to the config file, preserving format.

reload() (Method inside SQS)

Clears internal data and reloads configuration from the file.

 to_dict() (Method inside SQS)

Returns the entire configuration as a nested dictionary with globals and sections.

 PYCify

Utility class for compiling Python source files into bytecode and loading compiled modules dynamically.

compile(source_path, pyc_path=None) (Method inside PYCify)

Reads a Python source file, compiles it into bytecode, writes the .pyc file with correct header info (magic number, timestamp).

load(pyc_path, module_name) (Method inside PYCify)

Loads a compiled .pyc file as a Python module by name, enabling dynamic imports from bytecode.

tts(text,gender)

Plays the audio of a gender (male/female) saying text. This is a basic text to speech so dont expect very much from it. ;)

Cursor

Utility class for managing and editing multiline text with cursor navigation, selection, and undo/redo functionality.

move(direction, steps=1) (Method inside Cursor)

Moves the cursor in the specified direction ("u" up, "d" down, "l" left, "r" right) by the given number of steps.

move_to_start_of_line() (Method inside Cursor)

Positions the cursor at the start of the current line.

move_to_end_of_line() (Method inside Cursor)

Positions the cursor at the end of the current line.

goto_start() (Method inside Cursor)

Moves the cursor to the very beginning of the text.

goto_end() (Method inside Cursor)

Moves the cursor to the very end of the text.

goto_line(line_number) (Method inside Cursor)

Moves the cursor to the specified line, keeping the column position if possible.

select_all() (Method inside Cursor)

Selects the entire text from start to end.

hold() (Method inside Cursor)

Starts a text selection at the current cursor position.

release() (Method inside Cursor)

Cancels any active text selection.

undo() (Method inside Cursor)

Reverts the most recent text change.

redo() (Method inside Cursor)

Reapplies an undone change.

trim_trailing_spaces() (Method inside Cursor)

Removes trailing whitespace from every line in the text.

replace_all(old, new) (Method inside Cursor)

Replaces all occurrences of old with new across all lines.

get_position() (Method inside Cursor)

Returns the current cursor row and column as a tuple.

get_selection_text() (Method inside Cursor)

Retrieves the text currently selected, or an empty string if no selection is active.

copy() (Method inside Cursor)

Copies the selected text into the internal clipboard.

cut() (Method inside Cursor)

Copies the selected text to the clipboard and deletes it from the text.

paste() (Method inside Cursor)

Inserts the clipboard contents at the cursor position.

keyboard (Property of Cursor)

Provides access to an internal Keyboard object offering typing and deletion operations.

Keyboard.type(text) (Method inside Keyboard)

Types the provided text at the cursor position, replacing any active selection.

Keyboard.backspace() (Method inside Keyboard)

Deletes the character before the cursor or removes the selection if active.

Keyboard.delete() (Method inside Keyboard)

Deletes the character after the cursor.

Keyboard.enter() (Method inside Keyboard)

Inserts a new line at the cursor position.

Keyboard.delete_selection() (Method inside Keyboard)

Deletes the currently selected text region.

HardCache

Utility class for compressing and storing text content in hidden files on the desktop, supporting retrieval and decompression.

create() (Method inside HardCache)

Compresses the content and writes it to a hidden file on the desktop, setting attributes based on the operating system.

read() (Method inside HardCache)

Reveals the cached file, decompresses its content, deletes the file, and returns the text.

info() (Static Method inside HardCache)

Prints a brief description of the class purpose.

🛡️ CoLine

Utility class for encoding and decoding strings arranged in a grid by shifting lines or columns.

🛡️i encode(input_str, cols, shifttype, line_idx=None, col_idx=None) (Static Method inside CoLine)

Arranges text into a grid of cols columns and shifts either a line or a column depending on shifttype. Returns the transformed string.

🛡️i decode(input_str, cols, shifttype, line_idx=None, col_idx=None) (Static Method inside CoLine)

Reverses the transformation applied by encode, restoring the original grid arrangement.

🛡️ ParseShield

Utility class for hiding text by inserting invisible Unicode characters and decoding it back.

🛡️i encode(input_text, expansion_factor=5) (Static Method inside ParseShield)

Inserts random invisible characters after each character in the input, making the text visually unchanged (in console and some editors) but harder to parse.

🛡️i decode(input_text) (Static Method inside ParseShield)

Removes all invisible characters to restore the original text.

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

syloraq-3.1.tar.gz (87.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

syloraq-3.1-py3-none-any.whl (62.5 kB view details)

Uploaded Python 3

File details

Details for the file syloraq-3.1.tar.gz.

File metadata

  • Download URL: syloraq-3.1.tar.gz
  • Upload date:
  • Size: 87.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for syloraq-3.1.tar.gz
Algorithm Hash digest
SHA256 ec828c96c189156c90a24ec02b4841854b499bd6e635447e271d4031f9eb28f8
MD5 ce12f3f6c39ce32104f8d52a7546ba1d
BLAKE2b-256 28f1d300e09c6428fb64ee65b92f0512b61df2dc866606c1396dcfba23d0b7c5

See more details on using hashes here.

File details

Details for the file syloraq-3.1-py3-none-any.whl.

File metadata

  • Download URL: syloraq-3.1-py3-none-any.whl
  • Upload date:
  • Size: 62.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.7

File hashes

Hashes for syloraq-3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 975c92a6144d18038bf94d0ffaf2f6fa4ce0445586c16f37a5bd48139a030e03
MD5 7e060670f682f307a8b19305401d863a
BLAKE2b-256 2b53cca26657a2f354f8a5f9fcaa750308b2b73a9a554d5c54eb47a77aed904d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page