Package: generalpy
🔰 generalpyPython package for general classes and methodsInstall usingpip install generalpy💠Attribclass(windows OS only)Handles theattribcommand from windows OS.To set/modify/remove theA/H/I/R/Sattributes for files/folders.Useattrib /?in CMD for more info.💠CustomLoggingclassClass to handle logging in easy way.All logging class features + more.Compact & Full formatting are applied wherever applicable.Stream logging to Terminal.File logging: For all logs, and error logs in different files.You can also set different time zone for%(asctime)s.💠DatabaseCollectionclassHandles the data of a collectioncollectionNamein some database.This database will be in memory, but you can extend this functionality by using this class as a base class.And you can create a class which handles db locally or on cloud like MongoDB.Databasestructure should be:DataBase > collection > collection-data.Structure ofcollection-data:dict[str, dict[str, Any]]i.edataID: {dataType: dataValue, ...}, ...💠ICACLSclass(windows OS only)Handles functions related toicaclscommand from windows OS.To set/modify/remove the permissions for files/folders.Useicacls /?in CMD for more info.💠IgnoreError(Exception)classThis exception should be ignored after catching it for the sake of continuity.You can ignore it intry: ... except IgnoreError: passblock, orBy logging/printing to console.💠LevelFormatterclassCustomlogging.Formatterclass.To set formatting based on logging Levels. Likelogging.INFO,logging.ERRORetc.You can also set different time zone for%(asctime)s💠SettingsclassHandles all settings related aspect for an app.Based on settings file stored in storage.💠SignalclassA signal object that can be used to connect callback.Simply connect a callback using.connect(...)method.Emit the signal using.emit(...)method.💠TaskListclass(windows OS only)Handles functions related totasklistcommand of windows OS.Get running tasks/executables.Check if an exe is running or not, or how many of it's instances are running.💠decoratormoduleThis module contains decoratorscombine_single_items: Combine item of sublists(which contain only one item)into a single sublist.conditional: Run decorated function and return it's value, only if provided condition is True.platform_specific: Run decorated function only if current platform is one of thesupportedPlatformsretry_support: Retry the decorated function gracefully.run_threaded: Run decorated function in a new thread.time_it: Prints the time taken by decorated function.💠filesmoduleThis module contains methods to work with filesdelete_files_by_condition: Deletes all files in directory and its subdirectories according to some condition.delete_files_by_prefix_suffix: Deletes all files in directory and its subdirectories according to prefix/suffix in their name.get_new_path: Returns new filePath for files(which do not exist)by appending (1/2/3/..).get_random_file_path: Returns a random path of a file(which do not exist)in parentDirectory.get_unsupported_file_path_chars: Returns A list of characters which can't used in file names (windows_only)read_file_chunks: Read file and returns possible data chunk by chunk.sanitised_filename: Sanitize filename by replacing unsupported or non-printable characters (for windows).💠generalmoduleThis module contains general methodsfirst_capital: Make first letter capital without changing any other thing.format_bytes: Returns human readable formats from bytes.generate_repr_str: Returns a suitable string for__repr__method of classes.get_digit_from_text: Returns the digit from the first occurrence of(digit).get_first_non_alphabet: Returns the first non-alphabet character from string.is_python: ReturnsTrueif current running app ispython.punctuate: Adds punctuation after string, if not present.remove_extra_spaces: Removed extra spaces between words.replace_html_tags: Replace html tags from a string.replace_multiple_chars: Replace multiple characters from a string.set_app_user_model_id: Sets the App User Model ID for the current process on windows OS.similarized: Takes a list of strings and returns a list of sublists of similar-strings.sliced_list: Slice a list into a list of sublists, where each sublist contains specific no. of items.classCalender_Class: Class Containing functions related to Calendar