xulbux 1.6.5__tar.gz → 1.6.7__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of xulbux might be problematic. Click here for more details.

Files changed (35) hide show
  1. {xulbux-1.6.5/src/xulbux.egg-info → xulbux-1.6.7}/PKG-INFO +92 -13
  2. {xulbux-1.6.5 → xulbux-1.6.7}/README.md +87 -10
  3. {xulbux-1.6.5 → xulbux-1.6.7}/pyproject.toml +9 -6
  4. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/__init__.py +1 -1
  5. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/_cli_.py +9 -9
  6. xulbux-1.6.7/src/xulbux/_consts_.py +181 -0
  7. xulbux-1.6.7/src/xulbux/xx_code.py +100 -0
  8. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_color.py +27 -55
  9. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_console.py +205 -110
  10. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_data.py +176 -128
  11. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_env_path.py +3 -7
  12. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_file.py +10 -4
  13. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_format_codes.py +26 -37
  14. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_json.py +2 -5
  15. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_path.py +33 -23
  16. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_regex.py +18 -20
  17. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_string.py +23 -76
  18. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux/xx_system.py +16 -19
  19. {xulbux-1.6.5 → xulbux-1.6.7/src/xulbux.egg-info}/PKG-INFO +92 -13
  20. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux.egg-info/requires.txt +2 -0
  21. xulbux-1.6.7/tests/test_console_info.py +37 -0
  22. {xulbux-1.6.5 → xulbux-1.6.7}/tests/test_data.py +2 -2
  23. xulbux-1.6.5/src/xulbux/_consts_.py +0 -145
  24. xulbux-1.6.5/src/xulbux/xx_code.py +0 -105
  25. xulbux-1.6.5/tests/test_console_info.py +0 -19
  26. {xulbux-1.6.5 → xulbux-1.6.7}/LICENSE +0 -0
  27. {xulbux-1.6.5 → xulbux-1.6.7}/setup.cfg +0 -0
  28. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux.egg-info/SOURCES.txt +0 -0
  29. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux.egg-info/dependency_links.txt +0 -0
  30. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux.egg-info/entry_points.txt +0 -0
  31. {xulbux-1.6.5 → xulbux-1.6.7}/src/xulbux.egg-info/top_level.txt +0 -0
  32. {xulbux-1.6.5 → xulbux-1.6.7}/tests/test_color.py +0 -0
  33. {xulbux-1.6.5 → xulbux-1.6.7}/tests/test_color_types.py +0 -0
  34. {xulbux-1.6.5 → xulbux-1.6.7}/tests/test_env_vars.py +0 -0
  35. {xulbux-1.6.5 → xulbux-1.6.7}/tests/test_format_codes.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xulbux
3
- Version: 1.6.5
4
- Summary: A library which includes a lot of really helpful functions.
3
+ Version: 1.6.7
4
+ Summary: A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler.
5
5
  Author-email: XulbuX <xulbux.real@gmail.com>
6
6
  License: MIT License
7
7
 
@@ -31,7 +31,7 @@ Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
31
31
  Project-URL: Homepage, https://github.com/XulbuX/PythonLibraryXulbuX
32
32
  Project-URL: License, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE
33
33
  Project-URL: Source Code, https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src
34
- Keywords: xulbux,python,library,utility,helper,functions,tools,classes,types,methods,cmd,console,code,color,data,structures,env,environment,file,format,json,path,regex,string,system,operations,presets
34
+ Keywords: xulbux,python,library,utility,helper,functions,tools,classes,types,methods,cmd,console,constants,code,color,data,structures,env,environment,file,format,json,path,regex,string,system,operations,presets
35
35
  Classifier: Intended Audience :: Developers
36
36
  Classifier: Programming Language :: Python :: 3
37
37
  Classifier: Programming Language :: Python :: 3.10
@@ -45,6 +45,7 @@ Description-Content-Type: text/markdown
45
45
  License-File: LICENSE
46
46
  Requires-Dist: keyboard>=0.13.5
47
47
  Requires-Dist: mouse>=0.7.1
48
+ Requires-Dist: prompt_toolkit>=3.0.41
48
49
  Requires-Dist: pyperclip>=1.9.0
49
50
  Requires-Dist: regex>=2023.10.3
50
51
  Provides-Extra: dev
@@ -52,41 +53,54 @@ Requires-Dist: pytest>=7.4.2; extra == "dev"
52
53
  Requires-Dist: black>=23.7.0; extra == "dev"
53
54
  Requires-Dist: isort>=5.12.0; extra == "dev"
54
55
  Requires-Dist: flake8>=6.1.0; extra == "dev"
56
+ Requires-Dist: flake8-pyproject>=1.2.3; extra == "dev"
55
57
 
56
58
  # **$\color{#8085FF}\Huge\textsf{XulbuX}$**
57
59
 
58
- **$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
60
+ **$\color{#8085FF}\textsf{XulbuX}$** is library that contains many useful classes, types, and functions,
61
+ ranging from console logging and working with colors to file management and system operations.
62
+ The library is designed to simplify common programming tasks and improve code readability through its collection of tools.
59
63
 
60
- For precise information about the library, see the library's [Wiki page](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
61
- For the libraries latest changes, see the [change log](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
64
+ For precise information about the library, see the library's [wiki page](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
65
+ For the libraries latest changes and updates, see the [change log](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
62
66
 
67
+ <br>
63
68
 
64
69
  ## Installation
65
70
 
66
- To install the library and all its dependencies, open a console and run the command:
67
- ```prolog
71
+ Run the following commands in a console with administrator privileges, so the actions take effect for all users.
72
+
73
+ Install the library and all its dependencies with the command:
74
+ ```console
68
75
  pip install xulbux
69
76
  ```
70
77
 
71
- To upgrade the library to the latest available version, run the following command in your console:
72
- ```prolog
78
+ Upgrade the library and all its dependencies to their latest available version with the command:
79
+ ```console
73
80
  pip install --upgrade xulbux
74
81
  ```
75
82
 
83
+ <br>
76
84
 
77
85
  ## Usage
78
86
 
79
- Import the full library under the alias `xx`, so it's classes, types and functions are accessible with `xx.Class.method()`, `xx.type()` and `xx.function()`:
87
+ Import the full library under the alias `xx`, so its constants, classes, methods and types are accessible with `xx.CONSTANT.value`, `xx.Class.method()`, `xx.type()`:
80
88
  ```python
81
89
  import xulbux as xx
82
90
  ```
83
- So you don't have to write `xx` in front of the library's types, you can import them directly:
91
+ So you don't have to import the full library under an alias, you can also import only certain parts of the library's contents:
84
92
  ```python
93
+ # CONSTANTS
94
+ from xulbux import COLOR, CHARS, ANSI
95
+ # Classes
96
+ from xulbux import Code, Color, Console, ...
97
+ # types
85
98
  from xulbux import rgba, hsla, hexa
86
99
  ```
87
100
 
101
+ <br>
88
102
 
89
- # Modules
103
+ ## Modules
90
104
 
91
105
  | | |
92
106
  | :--------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
@@ -103,7 +117,72 @@ from xulbux import rgba, hsla, hexa
103
117
  | <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
104
118
  | <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
105
119
 
120
+ <br>
121
+
122
+ ## Example Usage
106
123
 
124
+ This is what it could look like using this library for a simple but very nice looking color converter:
125
+ ```python
126
+ from xulbux import COLOR # CONSTANTS
127
+ from xulbux import FormatCodes, Console # Classes
128
+ from xulbux import hexa # types
129
+
130
+
131
+ def main() -> None:
132
+
133
+ # LET THE USER ENTER A HEXA COLOR IN ANY HEXA FORMAT
134
+ input_clr = FormatCodes.input(
135
+ "\n[b](Enter a HEXA color in any format) [dim](>) "
136
+ )
137
+
138
+ # ANNOUNCE INDEXING THE INPUT COLOR
139
+ Console.log(
140
+ "INDEX",
141
+ "Indexing the input HEXA color...",
142
+ start="\n",
143
+ title_bg_color=COLOR.blue,
144
+ )
145
+
146
+ try:
147
+ # TRY TO CONVERT THE INPUT COLOR INTO A hexa() COLOR
148
+ hexa_color = hexa(input_clr)
149
+
150
+ except ValueError:
151
+ # ANNOUNCE THE ERROR AND EXIT THE PROGRAM
152
+ Console.fail(
153
+ "The input HEXA color is invalid.",
154
+ end="\n\n",
155
+ exit=True,
156
+ )
157
+
158
+ # ANNOUNCE STARTING THE CONVERSION
159
+ Console.log(
160
+ "CONVERT",
161
+ "Converting the HEXA color into different types...",
162
+ title_bg_color=COLOR.tangerine,
163
+ )
164
+
165
+ # CONVERT THE HEXA COLOR INTO THE TWO OTHER COLOR TYPES
166
+ rgba_color = hexa_color.to_rgba()
167
+ hsla_color = hexa_color.to_hsla()
168
+
169
+ # ANNOUNCE THE SUCCESSFUL CONVERSION
170
+ Console.done(
171
+ "Successfully converted color into different types.",
172
+ end="\n\n",
173
+ )
174
+
175
+ # PRETTY PRINT THE COLOR IN DIFFERENT TYPES
176
+ FormatCodes.print(f"[b](HEXA:) [i|white]({hexa_color})")
177
+ FormatCodes.print(f"[b](RGBA:) [i|white]({rgba_color})")
178
+ FormatCodes.print(f"[b](HSLA:) [i|white]({hsla_color})\n")
179
+
180
+
181
+ if __name__ == "__main__":
182
+ main()
183
+ ```
184
+
185
+ <br>
107
186
  <br>
108
187
 
109
188
  --------------------------------------------------------------
@@ -1,37 +1,49 @@
1
1
  # **$\color{#8085FF}\Huge\textsf{XulbuX}$**
2
2
 
3
- **$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
3
+ **$\color{#8085FF}\textsf{XulbuX}$** is library that contains many useful classes, types, and functions,
4
+ ranging from console logging and working with colors to file management and system operations.
5
+ The library is designed to simplify common programming tasks and improve code readability through its collection of tools.
4
6
 
5
- For precise information about the library, see the library's [Wiki page](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
6
- For the libraries latest changes, see the [change log](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
7
+ For precise information about the library, see the library's [wiki page](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
8
+ For the libraries latest changes and updates, see the [change log](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
7
9
 
10
+ <br>
8
11
 
9
12
  ## Installation
10
13
 
11
- To install the library and all its dependencies, open a console and run the command:
12
- ```prolog
14
+ Run the following commands in a console with administrator privileges, so the actions take effect for all users.
15
+
16
+ Install the library and all its dependencies with the command:
17
+ ```console
13
18
  pip install xulbux
14
19
  ```
15
20
 
16
- To upgrade the library to the latest available version, run the following command in your console:
17
- ```prolog
21
+ Upgrade the library and all its dependencies to their latest available version with the command:
22
+ ```console
18
23
  pip install --upgrade xulbux
19
24
  ```
20
25
 
26
+ <br>
21
27
 
22
28
  ## Usage
23
29
 
24
- Import the full library under the alias `xx`, so it's classes, types and functions are accessible with `xx.Class.method()`, `xx.type()` and `xx.function()`:
30
+ Import the full library under the alias `xx`, so its constants, classes, methods and types are accessible with `xx.CONSTANT.value`, `xx.Class.method()`, `xx.type()`:
25
31
  ```python
26
32
  import xulbux as xx
27
33
  ```
28
- So you don't have to write `xx` in front of the library's types, you can import them directly:
34
+ So you don't have to import the full library under an alias, you can also import only certain parts of the library's contents:
29
35
  ```python
36
+ # CONSTANTS
37
+ from xulbux import COLOR, CHARS, ANSI
38
+ # Classes
39
+ from xulbux import Code, Color, Console, ...
40
+ # types
30
41
  from xulbux import rgba, hsla, hexa
31
42
  ```
32
43
 
44
+ <br>
33
45
 
34
- # Modules
46
+ ## Modules
35
47
 
36
48
  | | |
37
49
  | :--------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
@@ -48,7 +60,72 @@ from xulbux import rgba, hsla, hexa
48
60
  | <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
49
61
  | <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
50
62
 
63
+ <br>
64
+
65
+ ## Example Usage
66
+
67
+ This is what it could look like using this library for a simple but very nice looking color converter:
68
+ ```python
69
+ from xulbux import COLOR # CONSTANTS
70
+ from xulbux import FormatCodes, Console # Classes
71
+ from xulbux import hexa # types
72
+
73
+
74
+ def main() -> None:
75
+
76
+ # LET THE USER ENTER A HEXA COLOR IN ANY HEXA FORMAT
77
+ input_clr = FormatCodes.input(
78
+ "\n[b](Enter a HEXA color in any format) [dim](>) "
79
+ )
51
80
 
81
+ # ANNOUNCE INDEXING THE INPUT COLOR
82
+ Console.log(
83
+ "INDEX",
84
+ "Indexing the input HEXA color...",
85
+ start="\n",
86
+ title_bg_color=COLOR.blue,
87
+ )
88
+
89
+ try:
90
+ # TRY TO CONVERT THE INPUT COLOR INTO A hexa() COLOR
91
+ hexa_color = hexa(input_clr)
92
+
93
+ except ValueError:
94
+ # ANNOUNCE THE ERROR AND EXIT THE PROGRAM
95
+ Console.fail(
96
+ "The input HEXA color is invalid.",
97
+ end="\n\n",
98
+ exit=True,
99
+ )
100
+
101
+ # ANNOUNCE STARTING THE CONVERSION
102
+ Console.log(
103
+ "CONVERT",
104
+ "Converting the HEXA color into different types...",
105
+ title_bg_color=COLOR.tangerine,
106
+ )
107
+
108
+ # CONVERT THE HEXA COLOR INTO THE TWO OTHER COLOR TYPES
109
+ rgba_color = hexa_color.to_rgba()
110
+ hsla_color = hexa_color.to_hsla()
111
+
112
+ # ANNOUNCE THE SUCCESSFUL CONVERSION
113
+ Console.done(
114
+ "Successfully converted color into different types.",
115
+ end="\n\n",
116
+ )
117
+
118
+ # PRETTY PRINT THE COLOR IN DIFFERENT TYPES
119
+ FormatCodes.print(f"[b](HEXA:) [i|white]({hexa_color})")
120
+ FormatCodes.print(f"[b](RGBA:) [i|white]({rgba_color})")
121
+ FormatCodes.print(f"[b](HSLA:) [i|white]({hsla_color})\n")
122
+
123
+
124
+ if __name__ == "__main__":
125
+ main()
126
+ ```
127
+
128
+ <br>
52
129
  <br>
53
130
 
54
131
  --------------------------------------------------------------
@@ -4,15 +4,16 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xulbux"
7
- version = "1.6.5"
7
+ version = "1.6.7"
8
8
  authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
9
- description = "A library which includes a lot of really helpful functions."
9
+ description = "A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler."
10
10
  readme = "README.md"
11
11
  license = { file = "LICENSE" }
12
12
  requires-python = ">=3.10.0"
13
13
  dependencies = [
14
14
  "keyboard>=0.13.5",
15
15
  "mouse>=0.7.1",
16
+ "prompt_toolkit>=3.0.41",
16
17
  "pyperclip>=1.9.0",
17
18
  "regex>=2023.10.3",
18
19
  ]
@@ -21,6 +22,7 @@ optional-dependencies = { dev = [
21
22
  "black>=23.7.0",
22
23
  "isort>=5.12.0",
23
24
  "flake8>=6.1.0",
25
+ "flake8-pyproject>=1.2.3",
24
26
  ] }
25
27
  classifiers = [
26
28
  "Intended Audience :: Developers",
@@ -45,6 +47,7 @@ keywords = [
45
47
  "methods",
46
48
  "cmd",
47
49
  "console",
50
+ "constants",
48
51
  "code",
49
52
  "color",
50
53
  "data",
@@ -103,11 +106,11 @@ use_parentheses = true
103
106
  ensure_newline_before_comments = true
104
107
 
105
108
  [tool.flake8]
109
+ max-complexity = 12
106
110
  max-line-length = 127
107
- extend-ignore = ["E203", "E266", "E501", "W503", "E303"]
108
- max-complexity = 18
109
- select = ["B", "C", "E", "F", "W", "T4", "B9"]
110
- per-file-ignores = ["__init__.py:F401,F403"]
111
+ select = ["E", "F", "W", "C90"]
112
+ extend-ignore = ["E203", "E266", "W503"]
113
+ per-file-ignores = ["__init__.py:F403,F405"]
111
114
 
112
115
  [tool.setuptools]
113
116
  packages = ["xulbux"]
@@ -19,7 +19,7 @@
19
19
  • REGEX PATTERN TEMPLATES xx.Regex
20
20
  """
21
21
 
22
- __version__ = "1.6.5"
22
+ __version__ = "1.6.7"
23
23
  __author__ = "XulbuX"
24
24
  __email__ = "xulbux.real@gmail.com"
25
25
  __license__ = "MIT"
@@ -1,5 +1,5 @@
1
1
  from . import __version__
2
- from ._consts_ import DEFAULT
2
+ from ._consts_ import COLOR
3
3
  from .xx_format_codes import FormatCodes
4
4
  from .xx_console import Console
5
5
 
@@ -7,20 +7,20 @@ from .xx_console import Console
7
7
  def help_command():
8
8
  """Show some info about the library, with a brief explanation of how to use it."""
9
9
  color = {
10
- "lib": DEFAULT.color["ice"],
11
- "import": DEFAULT.color["red"],
12
- "class": DEFAULT.color["lavender"],
13
- "types": DEFAULT.color["lightblue"],
14
- "punctuators": DEFAULT.color["darkgray"],
10
+ "lib": COLOR.ice,
11
+ "import": COLOR.red,
12
+ "class": COLOR.lavender,
13
+ "types": COLOR.lightblue,
14
+ "punctuators": COLOR.darkgray,
15
15
  }
16
16
  FormatCodes.print(
17
17
  rf""" [_|b|#7075FF] __ __
18
18
  [b|#7075FF] _ __ __ __/ / / /_ __ ___ __
19
19
  [b|#7075FF] | |/ // / / / / / __ \/ / / | |/ /
20
20
  [b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
21
- [b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{DEFAULT.color['gray']}|#000] v[b]{__version__} [*]
21
+ [b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{COLOR.gray}|#000] v[b]{__version__} [*]
22
22
 
23
- [i|{DEFAULT.color['coral']}]A TON OF COOL FUNCTIONS, YOU NEED![*]
23
+ [i|{COLOR.coral}]A TON OF COOL FUNCTIONS, YOU NEED![*]
24
24
 
25
25
  [b|#75A2FF]Usage:[*]
26
26
  [{color['punctuators']}]# GENERAL LIBRARY[*]
@@ -48,6 +48,6 @@ def help_command():
48
48
  [_]
49
49
  [dim](Press any key to exit...)
50
50
  """,
51
- default_color=DEFAULT.text_color,
51
+ default_color=COLOR.text
52
52
  )
53
53
  Console.pause_exit(pause=True)
@@ -0,0 +1,181 @@
1
+ from dataclasses import dataclass
2
+ from typing import TypeAlias
3
+
4
+
5
+ FormattableString: TypeAlias = str
6
+ """A `str` object that is made to be formatted with the `.format()` method."""
7
+
8
+
9
+ @dataclass
10
+ class COLOR:
11
+ """Color presets used in the `xulbux` library."""
12
+
13
+ text = "#A5D6FF"
14
+ """The default text color used in the `xulbux` library."""
15
+
16
+ white = "#F1F2FF"
17
+ lightgray = "#B6B7C0"
18
+ gray = "#7B7C8D"
19
+ darkgray = "#67686C"
20
+ black = "#202125"
21
+ red = "#FF606A"
22
+ coral = "#FF7069"
23
+ orange = "#FF876A"
24
+ tangerine = "#FF9962"
25
+ gold = "#FFAF60"
26
+ yellow = "#FFD260"
27
+ lime = "#C9F16E"
28
+ green = "#7EE787"
29
+ teal = "#50EAAF"
30
+ cyan = "#3EDEE6"
31
+ ice = "#77DBEF"
32
+ lightblue = "#60AAFF"
33
+ blue = "#8085FF"
34
+ lavender = "#9B7DFF"
35
+ purple = "#AD68FF"
36
+ magenta = "#C860FF"
37
+ pink = "#F162EF"
38
+ rose = "#FF609F"
39
+
40
+
41
+ class _AllTextCharacters:
42
+ pass
43
+
44
+
45
+ @dataclass
46
+ class CHARS:
47
+ """Text character sets."""
48
+
49
+ all = _AllTextCharacters
50
+ """Code to signal that all characters are allowed."""
51
+
52
+ digits: str = "0123456789"
53
+ """Digits: `0`-`9`"""
54
+ float_digits: str = digits + "."
55
+ """Digits: `0`-`9` with decimal point `.`"""
56
+ hex_digits: str = digits + "#abcdefABCDEF"
57
+ """Digits: `0`-`9` Letters: `a`-`f` `A`-`F` and a hashtag `#`"""
58
+
59
+ lowercase: str = "abcdefghijklmnopqrstuvwxyz"
60
+ """Lowercase letters `a`-`z`"""
61
+ lowercase_extended: str = lowercase + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
62
+ """Lowercase letters `a`-`z` with all lowercase diacritic letters."""
63
+ uppercase: str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
64
+ """Uppercase letters `A`-`Z`"""
65
+ uppercase_extended: str = uppercase + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
66
+ """Uppercase letters `A`-`Z` with all uppercase diacritic letters."""
67
+
68
+ letters: str = lowercase + uppercase
69
+ """Lowercase and uppercase letters `a`-`z` and `A`-`Z`"""
70
+ letters_extended: str = lowercase_extended + uppercase_extended
71
+ """Lowercase and uppercase letters `a`-`z` `A`-`Z` and all diacritic letters."""
72
+
73
+ special_ascii: str = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
74
+ """All ASCII special characters."""
75
+ special_ascii_extended: str = special_ascii + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡­±‗¾¶§÷¸°¨·¹³²■ "
76
+ """All ASCII special characters with the extended ASCII special characters."""
77
+ standard_ascii: str = special_ascii + digits + letters
78
+ """All standard ASCII characters."""
79
+ full_ascii: str = special_ascii_extended + digits + letters_extended
80
+ """All characters in the ASCII table."""
81
+
82
+
83
+ class ANSI:
84
+ """Constants and class-methods for use of ANSI escape codes."""
85
+
86
+ escaped_char: str = "\\x1b"
87
+ """The printable ANSI escape character."""
88
+ CHAR = char = "\x1b"
89
+ """The ANSI escape character."""
90
+ START = start = "["
91
+ """The start of an ANSI escape sequence."""
92
+ SEP = sep = ";"
93
+ """The separator between ANSI escape sequence parts."""
94
+ END = end = "m"
95
+ """The end of an ANSI escape sequence."""
96
+ default_color_modifiers: dict[str, str] = {"lighten": "+l", "darken": "-d"}
97
+ """Characters to modify the lightness of the default color with."""
98
+
99
+ @classmethod
100
+ def seq(cls, parts: int = 1) -> FormattableString:
101
+ """Generate an ANSI sequence with `parts` amount of placeholders."""
102
+ return cls.CHAR + cls.START + cls.SEP.join(["{}" for _ in range(parts)]) + cls.END
103
+
104
+ seq_color: FormattableString = CHAR + START + "38" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
105
+ """The ANSI escape sequence for setting the text RGB color."""
106
+ seq_bg_color: FormattableString = CHAR + START + "48" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
107
+ """The ANSI escape sequence for setting the background RGB color."""
108
+
109
+ color_map: list[str] = [
110
+ ########### DEFAULT CONSOLE COLOR NAMES ############
111
+ "black",
112
+ "red",
113
+ "green",
114
+ "yellow",
115
+ "blue",
116
+ "magenta",
117
+ "cyan",
118
+ "white",
119
+ ]
120
+ """The console default color names."""
121
+
122
+ codes_map: dict[str | tuple[str, ...], int] = {
123
+ ################# SPECIFIC RESETS ##################
124
+ "_": 0,
125
+ ("_bold", "_b"): 22,
126
+ ("_dim", "_d"): 22,
127
+ ("_italic", "_i"): 23,
128
+ ("_underline", "_u"): 24,
129
+ ("_double-underline", "_du"): 24,
130
+ ("_inverse", "_invert", "_in"): 27,
131
+ ("_hidden", "_hide", "_h"): 28,
132
+ ("_strikethrough", "_s"): 29,
133
+ ("_color", "_c"): 39,
134
+ ("_background", "_bg"): 49,
135
+ ################### TEXT STYLES ####################
136
+ ("bold", "b"): 1,
137
+ ("dim", "d"): 2,
138
+ ("italic", "i"): 3,
139
+ ("underline", "u"): 4,
140
+ ("inverse", "invert", "in"): 7,
141
+ ("hidden", "hide", "h"): 8,
142
+ ("strikethrough", "s"): 9,
143
+ ("double-underline", "du"): 21,
144
+ ################## DEFAULT COLORS ##################
145
+ "black": 30,
146
+ "red": 31,
147
+ "green": 32,
148
+ "yellow": 33,
149
+ "blue": 34,
150
+ "magenta": 35,
151
+ "cyan": 36,
152
+ "white": 37,
153
+ ############## BRIGHT DEFAULT COLORS ###############
154
+ "br:black": 90,
155
+ "br:red": 91,
156
+ "br:green": 92,
157
+ "br:yellow": 93,
158
+ "br:blue": 94,
159
+ "br:magenta": 95,
160
+ "br:cyan": 96,
161
+ "br:white": 97,
162
+ ############ DEFAULT BACKGROUND COLORS #############
163
+ "bg:black": 40,
164
+ "bg:red": 41,
165
+ "bg:green": 42,
166
+ "bg:yellow": 43,
167
+ "bg:blue": 44,
168
+ "bg:magenta": 45,
169
+ "bg:cyan": 46,
170
+ "bg:white": 47,
171
+ ######### BRIGHT DEFAULT BACKGROUND COLORS #########
172
+ "bg:br:black": 100,
173
+ "bg:br:red": 101,
174
+ "bg:br:green": 102,
175
+ "bg:br:yellow": 103,
176
+ "bg:br:blue": 104,
177
+ "bg:br:magenta": 105,
178
+ "bg:br:cyan": 106,
179
+ "bg:br:white": 107,
180
+ }
181
+ """All custom format keys and their corresponding ANSI format number codes."""