Package: toolboxy
toolboxyThis repository is a collection of tools for developers. The goal is to offer a variety of resources that are constantly used, in order to accelerate the workflow. It is a way to quickly and easily access relevant solutions for development.The functionality is diverse, some examples of code use are listed below. Feel free to suggest new functionality or directly contribute to the development of this repository.LanguageThe repository, as well as the docstrings of the functions, were developed with support for English and Brazilian Portuguese in order to facilitate access to functionality.English ReadmePortuguês-br ReadmeTable of ContentsInstallationUsageWeb ScrappingError IdentificationFile ManipulationGit ToolsWindows ToolsOptimizationMiscellaneousFree APIsCreditsInstallationTo install, simply open the terminal and enter the following command:pip install toolboxyBack to table of contentsUsageWeb ScrappingConvert header to Python dictionaryimporttoolboxyheaders="""sec-ch-ua-platform: "Windows"sec-fetch-dest: documentsec-fetch-mode: navigatesec-fetch-site: same-originuser-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"""headers_dict=toolboxy.chrome2dict(headers_str=headers)Save source code in text fileimporttoolboxyurl='https://raw.githubusercontent.com/Lima-e-Silva/toolboxy/main/README.md'toolboxy.html2txt(url=url,output_path='Github-toolboxy.txt')Check if a given IP address and port can be used as a proxyimporttoolboxy# IP addresses and respective ports can be found here: "https://free-proxy-list.net"ip='80.252.5.34'port='7001'iftoolboxy.verify_proxy(ip=ip,port=port):print('IP and port are functional!')Back to table of contentsError IdentificationRun a function with error loggingimporttoolboxy# Function that is experiencing errorsdeffoo(a,b):returna/btoolboxy.debug_function(foo,a=1,b=0,output='logfile')Back to table of contentsFile ManipulationCreate configuration file (cfg)importtoolboxyconfig_dict={'section':{'A':'1','B':'2'}}toolboxy.create_cfg(file='config.cfg',cfg_dict=config_dict)Read a configuration file (cfg)importtoolboxyconfig_dict=toolboxy.read_cfg(file='config.cfg')Create file backupimporttoolboxytoolboxy.backup(file='important_file.txt',output_path='backups/security_copies')Verify file integrity or get hashesimporttoolboxyiftoolboxy.check_hash('file.txt','backup.txt'):print('Integrity Verified')file_hash=toolboxy.check_hash('file.txt')Back to table of contentsGit ToolsCreate a virtual environmentimporttoolboxytoolboxy.create_env()Create a license fileimporttoolboxytoolboxy.license(license_type='MIT',name='Luiz Paulo Lima e Silva')Generate a .gitignore file based on a standard templateimporttoolboxytoolboxy.git_ignore(folders=['personal-folder'],extensions=['xlsx','pdf'])Create requirements.txtimporttoolboxytoolboxy.requirements()Back to table of contentsWindows ToolsCreate Windows notificationimporttoolboxytoolboxy.notify(id='toolboxy',title='Demonstration',message='This notification is merely a demonstration',buttons={'Open link':'https://github.com/Lima-e-Silva/toolboxy/'},sound=True,audio_loop=False)Schedule computer shutdownimporttoolboxytoolboxy.shutdown(time=3600,message="Time to sleep Zzz...")Back to table of contentsOptimizationGenerate function performance profileimporttoolboxydeffoo(x,y=3):forninrange(x):print(n**y)toolboxy.prof('output',foo,100,y=2)Calculate the elapsed time while running a functionimporttoolboxydeffoo(n):values=list()foriinrange(n):for_inrange(i):values.append(i)print(values)print(toolboxy.elapsed_clocktime(foo,100))Display the elapsed CPU time while running a functionimporttoolboxydeffoo(n):values=list()foriinrange(n):for_inrange(i):values.append(i)print(values)toolboxy.elapsed_cputime(foo,100)Back to table of contentsMiscellaneousDisplays strings in console with delay (like typing)importtoolboxytoolboxy.delay_print('Hello World!')Generates a docstring (according to the repository pattern) for a functionimporttoolboxydefmy_function():print("this is my function")print(toolboxy.gpt_docstring(my_function,api_key="YOUR_API_KEY"))# Output:# """# English:# ----------# Prints a string to the console.## Returns# -------# None## Português (brasileiro):# ----------# Imprime uma string no console.## Retorna# -------# None# """# You can also store your api_key in a .env file then call the function without specifying the api_key.# Example:# toolboxy.gpt_docstring(my_function)Generates a unique identification stringimporttoolboxyid=toolboxy.unique_id(length=6,letters=True,numbers=True,lower_case=False,blocks=4)# Example output: 0AMKPJ-LITCGF-N5A1LM-TCSHZFGenerate QR Code for a linkimporttoolboxytoolboxy.QRcode(url='https://github.com/Lima-e-Silva/toolboxy/',size=150,output='My QR Code')Back to table of contentsFree APIsCreate push notification (mobile)importtoolboxyTOPIC='notifications'# More information here: https://ntfy.shtoolboxy.smartphone_notify(topic=TOPIC,message='This is a demonstration notification',title='Test Notification')Shorten URLimporttoolboxyurl='https://www.google.com.br'ifshort:=toolboxy.short_url(url):print(short)# Example Output: https://gotiny.cc/xr4cs6Back to table of contentsCreditsDue to the nature of the repository, many of the implemented functions are full of dependencies. Therefore, it is essential to explicitly acknowledge the contribution of the community as a way of thanking them for the tools provided. Below is a list of the libraries and resources used and their respective licenses:LibraryLicenseBeautifulSoupMITloguruMITopenaiMITntfyApache 2.0-GPL 2.0pipreqsApache 2.0pyperclipBSD-3-Clausepython-dotenvBSD-3-ClauserequestsApache 2.0setuptoolsMITsnakevizLicensewinotifyMITBack to table of contents