{"id":20292516,"url":"https://github.com/mauricelambert/pythontoolskit","last_synced_at":"2025-03-04T05:13:43.480Z","repository":{"id":57457651,"uuid":"445651802","full_name":"mauricelambert/PythonToolsKit","owner":"mauricelambert","description":"This package implements useful tools and functions for producing python packages or tools implemented in python.","archived":false,"fork":false,"pushed_at":"2023-05-25T19:41:18.000Z","size":224,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-14T09:14:45.692Z","etag":null,"topics":["dynamic-object","encoding","getpass","print-color","print-formatter","pypi-package","python3","report","stringify","terminal-control","timeout-function","urlopen"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mauricelambert.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-07T21:02:11.000Z","updated_at":"2022-04-15T23:05:09.000Z","dependencies_parsed_at":"2023-02-17T23:31:44.407Z","dependency_job_id":null,"html_url":"https://github.com/mauricelambert/PythonToolsKit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FPythonToolsKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FPythonToolsKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FPythonToolsKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mauricelambert%2FPythonToolsKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mauricelambert","download_url":"https://codeload.github.com/mauricelambert/PythonToolsKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241787485,"owners_count":20020101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dynamic-object","encoding","getpass","print-color","print-formatter","pypi-package","python3","report","stringify","terminal-control","timeout-function","urlopen"],"created_at":"2024-11-14T15:17:37.080Z","updated_at":"2025-03-04T05:13:43.461Z","avatar_url":"https://github.com/mauricelambert.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![PythonToolsKit logo](https://mauricelambert.github.io/info/python/code/PythonToolsKit/logo_small.png \"PythonToolsKit logo\")\r\n\r\n# PythonToolsKit\r\n\r\n## Description\r\n\r\nThis package implements useful tools and functions for producing python packages or tools implemented in python.\r\n\r\nFeatures implemented:\r\n\r\n - Timeout: \r\n     - Timeout decorator using MultiThreading\r\n     - Timeout decorator using MultiProcessing\r\n     - Timeout decorator using signal (UNIX only)\r\n - Terminal: ANSI features for terminal (color, position of the cursor, style...)\r\n - StringF:\r\n     - Format the strings length\r\n     - Make a table from Sequence of strings\r\n     - Make a table of Attribute/Value from python object\r\n - PrintF:\r\n     - Print states of tasks/programs\r\n     - Print info, check OK/NOK, error... with prefix and color management\r\n - Process: generator to read process output lines in real time\r\n - Logs\r\n     - Default logger builder\r\n     - Decorator trace function (log the beginning and end of function execution)\r\n     - Colored logger (StreamHandler only)\r\n     - CSV formatter (logs in CSV format)\r\n     - Handler for compressed log file rotation and store indefinitely\r\n - GetPass: a getpass function showing \"\\*\"\r\n - Encodings:\r\n     - Generator to obtain probable encodings\r\n     - Function to try to decode the data with probable encodings\r\n     - Fast Base64 functions (without types/regex checks)\r\n - DictObject:\r\n     - Dynamic object (build from dict)\r\n     - JsonDeserializer\r\n     - CsvDeserializer\r\n - Report:\r\n     - Report as text/markdown\r\n     - Report as CSV\r\n     - Report as JSON\r\n     - Report as HTML\r\n     - Statistics\r\n     - Sort and filter elements in the reports\r\n     - The frequency and percentage of filtered elements\r\n - urlopen:\r\n     - New urlopen based on urllib.request with a easiest way to manage HTTP error code (using decorator)\r\n - Dict:\r\n     - Clean dict (for example, after loading the API response, you want to keep only certain informations)\r\n     - Operator (some basic functions callable from operator)\r\n - List:\r\n     - Operator (some basic functions callable from operator)\r\n - Tuple:\r\n     - Operator (some basic functions callable from operator)\r\n - Function:\r\n     - Operator (some basic functions callable from operator)\r\n - Arguments:\r\n     - Password and password prompt\r\n     - Input file and stdin\r\n     - Output file and stdout\r\n     - Verbose mode\r\n     - Debug mode\r\n - Thread:\r\n     - Join all\r\n     - Class SimpleThread\r\n     - Thread decorator\r\n - Import:\r\n     - import from path/filename\r\n - GetFile:\r\n     - Research an existant file from current directory and lib directory\r\n     - Open an existant file from current directory or lib directory\r\n - ScapyTools:\r\n     - Command line arguments for scapy (ArgumentParser with an optional argument \"interface\" by default and iface research)\r\n - GetType\r\n     - Type string value (None, bool, int, float, IP)\r\n     - Numbers (int, float) and IP/network generator from string\r\n - Random: Get random strings (random length, generator, check for strong password, secure, urlsafe, ...)\r\n - Json:\r\n     - Load invalid JSON\r\n     - Correct invalid JSON\r\n - WindowsTerminal:\r\n     - Activate/desactivate temporary/persistent virtual terminal (colors, font, ...) on Windows\r\n     - Set temporary/persistent terminal transparency on Windows\r\n - Colors:\r\n     - Build 8bits-color byte\r\n     - Get 3 bytes color from HTML/CSS colors (#HEX, rgb function and rgba function)\r\n     - Check and safe methods are available for all these features\r\n - DataAnalysis:\r\n     - Data statistics\r\n         - frequences (pourcent)\r\n             - Keys\r\n             - Values\r\n             - Keys and values\r\n             - Keys and values counters\r\n         - averages\r\n         - variances\r\n         - deviations\r\n         - medians\r\n         - sum\r\n         - max\r\n         - min\r\n     - Data filtering\r\n     - Counter/getter\r\n         - Count/get values greater than\r\n         - Count/get values lesser than\r\n         - Count value equal to\r\n         - Count different values by key\r\n     - Sort\r\n         - Values\r\n         - Keys\r\n         - Values counters\r\n         - Values sum\r\n     - Generate chart (using matplotlib)\r\n         - statistictypes\r\n         - valuetypes (values)\r\n         - valuetypes (counters)\r\n     - Print data tables\r\n         - statistictypes\r\n         - dictionnaries\r\n         - valuetypes\r\n     - Group data by values\r\n - RecursionDebug: Help you to debug RecursionError\r\n - OrdDict: A fast and powerful *Ordered Dict*\r\n - Characters: Returns integers, string (latin-1), binary and hexadecimal from integers, string (latin-1), binary or hexadecimal\r\n - DebugEncoding: Found used encoding when you have encoding problems\r\n\r\n## Requirements\r\n\r\nThis package require:\r\n\r\n - python3\r\n - python3 Standard Library\r\n \r\n\u003e To use `PythonToolsKit.ScapyTools` you need `Scapy`, but is not installed by default (because this is the only module that needs it), install it with `python3 -m pip install scapy`\r\n\r\n\u003e To use `PythonToolsKit.DataAnalysis.show_chart` you need `matplotlib`, but is not installed by default (because this is the only function that needs it), install it with `python3 -m pip install matplotlib`\r\n\r\n## Installation\r\n\r\n```bash\r\npip install PythonToolsKit\r\n```\r\n\r\n## Usages\r\n\r\nExamples with responses (mode console) are available in HTML documentation.\r\n\r\nNote for import: add `PythonToolsKit.\u003cmodule\u003e`\r\n\r\n```python\r\nfrom PythonToolsKit.Timeout import *\r\nimport PythonToolsKit.Timeout\r\n```\r\n\r\n### Tools\r\n\r\n#### Characters\r\n\r\n```bash\r\npython3 Characters.pyz mystring\r\npython3 -m PythonToolsKit.Characters integers 97,98,99\r\n\r\nCharacters string abc\r\nCharacters hexa 616263\r\nCharacters hexa '61-62-63'\r\nCharacters hexa '61 62 63'\r\nCharacters hexa '61:62:63'\r\nCharacters binary '1100001 1100010 1100011'\r\n\r\npython3 DebugEncoding.pyz éêâ --bad-values \"‚ˆƒ\"\r\npython3 -m PythonToolsKit.DebugEncoding éêâ --decoding cp1252 --bad-values \"‚ˆƒ\" --json\r\n\r\nDebugEncoding éêâ\r\nDebugEncoding éêâ --encoding cp437\r\n```\r\n\r\n## Unittests\r\n\r\nFor `GetType` and `Json`, `Encodings`, `Colors` and `WindowsTerminal` modules i use `doctest` (unittests in documentation) and `coverage`:\r\n\r\n```bash\r\npython3 GetType.py             # run doctest with verbose mode\r\npython3 -m doctest GetType.py  # run doctest without verbose mode\r\ncoverage run GetType.py        # Calcul coverage\r\ncoverage report                # Report in console\r\ncoverage html                  # Report in HTML page\r\n```\r\n\r\n| Module             | Coverage  | Statements | missing    |\r\n|--------------------|-----------|------------|------------|\r\n| GetType.py         | 100%      | 130        | 000        |\r\n| Json.py            | 100%      | 046        | 000        |\r\n| Encodings.py       | 100%      | 054        | 000        |\r\n| WindowsTerminal.py | 094%      | 096        | 006        |\r\n| Colors.py          | 100%      | 176        | 000        |\r\n| DataAnalysis.py    | 100%      | 290        | 000        |\r\n| Report.py          | 099%      | 160        | 001        |\r\n| StringF.py         | 100%      | 067        | 000        |\r\n| OrdDict.py         | 100%      | 172        | 000        |\r\n| Characters.py      | 078%      | 063        | 014        |\r\n\r\n## Links\r\n\r\n - [Github Page](https://github.com/mauricelambert/PythonToolsKit/)\r\n - [Documentation Timeout](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Timeout.html)\r\n - [Documentation Terminal](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Terminal.html)\r\n - [Documentation StringF](https://mauricelambert.github.io/info/python/code/PythonToolsKit/StringF.html)\r\n - [Documentation PrintF](https://mauricelambert.github.io/info/python/code/PythonToolsKit/PrintF.html)\r\n - [Documentation Process](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Process.html)\r\n - [Documentation Logs](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Logs.html)\r\n - [Documentation GetPass](https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetPass.html)\r\n - [Documentation Encodings](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Encodings.html)\r\n - [Documentation DictObject](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DictObject.html)\r\n - [Documentation Report](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Report.html)\r\n - [Documentation urlopen](https://mauricelambert.github.io/info/python/code/PythonToolsKit/urlopen.html)\r\n - [Documentation Dict](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Dict.html)\r\n - [Documentation Arguments](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Arguments.html)\r\n - [Documentation Tuple](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Tuple.html)\r\n - [Documentation List](https://mauricelambert.github.io/info/python/code/PythonToolsKit/List.html)\r\n - [Documentation Function](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Function.html)\r\n - [Documentation Thread](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Thread.html)\r\n - [Documentation Import](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Import.html)\r\n - [Documentation ScapyTools](https://mauricelambert.github.io/info/python/code/PythonToolsKit/ScapyTools.html)\r\n - [Documentation GetFile](https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetFile.html)\r\n - [Documentation GetType](https://mauricelambert.github.io/info/python/code/PythonToolsKit/GetType.html)\r\n - [Documentation Random](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Random.html)\r\n - [Documentation Json](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Json.html)\r\n - [Documentation WindowsTerminal](https://mauricelambert.github.io/info/python/code/PythonToolsKit/WindowsTerminal.html)\r\n - [Documentation Colors](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Colors.html)\r\n - [Documentation DataAnalysis](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DataAnalysis.html)\r\n - [Documentation RecursionDebug](https://mauricelambert.github.io/info/python/code/PythonToolsKit/RecursionDebug.html)\r\n - [Documentation OrdDict](https://mauricelambert.github.io/info/python/code/PythonToolsKit/OrdDict.html)\r\n - [Documentation Characters](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Characters.html)\r\n - [Executable Characters](https://mauricelambert.github.io/info/python/code/PythonToolsKit/Characters.pyz)\r\n - [Documentation DebugEncoding](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DebugEncoding.html)\r\n - [Executable DebugEncoding](https://mauricelambert.github.io/info/python/code/PythonToolsKit/DebugEncoding.pyz)\r\n - [Pypi package](https://pypi.org/project/PythonToolsKit/)\r\n\r\n## Licence\r\n\r\nLicensed under the [GPL, version 3](https://www.gnu.org/licenses/).\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricelambert%2Fpythontoolskit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmauricelambert%2Fpythontoolskit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmauricelambert%2Fpythontoolskit/lists"}