A collection of personal scripts for json, File/Folder Operations, String Validation, Custom Errors, Cache and stuff.
- timed_lru_cache()
Lru_cache decorator with expiration time.
- EnvironmentVariableNotFound()
Error Raised when a required environment variable is missing from os. - ApplicationNotFound()
Error Raised when an Application Name required is not found.
- replace_strings_in_file()
Opens a file and replaces all occurrences from strings into a new string. - remove_line_from_file()
Removes given list of lines from ascii file - file_is_writeable()
Checks if a file is writeable, returns True if it is, False otherwise.
- browse_folder()
Open windows explorer on folder - create_folders()
Create multiple folders in a given path - create_folder()
Create a folder in a given path, can remove old folder - remove_files_in_dir()
Remove all files in a directory, can remove subdirectories too - recursive_dir_copy()
Copy all files src dir to dest dir, including sub-directories.
- JsonMetaFile()
saves/load a class/dict as a json metadata file
- JsonUserSettings()
Class to manage load/save settings in a JSON file on local user folder
- json_load()
Function to load a JSON file with validation. - json_save()
Function to save a JSON file with validation.
- Singleton(): Singleton pattern implementation.
-
reformat_input_string()
Function to reformat an input string, leaves only alphanumeric chars and replaces spaces and hyphens for underscores. -
begin_or_end_with_numbers()
Function to check if a string begins or ends with numbers. -
begin_with_number()
Function to check if a string begins with a number. -
has_numbers()
Function to check if a string contains numbers. -
camelcase_to_snakecase()
Function to convert a camelCase string to snake_case.
- time_function_decorator()
Decorator to measure the execution time of a function. - random_string()
Generate a random string of a given length.
pip install python-backpack