xulbux 1.6.6__tar.gz → 1.6.8__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.
- {xulbux-1.6.6/src/xulbux.egg-info → xulbux-1.6.8}/PKG-INFO +96 -19
- xulbux-1.6.8/README.md +132 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/pyproject.toml +46 -15
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/__init__.py +1 -1
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/_consts_.py +31 -8
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_code.py +2 -3
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_console.py +175 -51
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_data.py +13 -16
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_env_path.py +5 -17
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_file.py +12 -14
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_format_codes.py +43 -17
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_path.py +30 -20
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_regex.py +1 -5
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_system.py +11 -6
- {xulbux-1.6.6 → xulbux-1.6.8/src/xulbux.egg-info}/PKG-INFO +96 -19
- xulbux-1.6.6/README.md +0 -55
- {xulbux-1.6.6 → xulbux-1.6.8}/LICENSE +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/setup.cfg +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/_cli_.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_color.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_json.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux/xx_string.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux.egg-info/SOURCES.txt +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux.egg-info/dependency_links.txt +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux.egg-info/entry_points.txt +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux.egg-info/requires.txt +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/src/xulbux.egg-info/top_level.txt +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/tests/test_color.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/tests/test_color_types.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/tests/test_console_info.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/tests/test_data.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/tests/test_env_vars.py +0 -0
- {xulbux-1.6.6 → xulbux-1.6.8}/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.
|
|
4
|
-
Summary: A library which includes
|
|
3
|
+
Version: 1.6.8
|
|
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:
|
|
34
|
+
Keywords: args,arguments,attributes,classes,cmd,client,code,codes,color,commands,console,consts,constants,convert,conversion,data,debug,easier,env,environment,error,file,format,formatting,functions,helper,hex,hexa,hsl,hsla,info,input,json,library,log,logging,methods,nice,operations,path,presets,pretty,printing,properties,python,re,regex,rgb,rgba,string,structures,system,tools,types,utility,warn,warning,xulbux
|
|
35
35
|
Classifier: Intended Audience :: Developers
|
|
36
36
|
Classifier: Programming Language :: Python :: 3
|
|
37
37
|
Classifier: Programming Language :: Python :: 3.10
|
|
@@ -57,41 +57,53 @@ Requires-Dist: flake8-pyproject>=1.2.3; extra == "dev"
|
|
|
57
57
|
|
|
58
58
|
# **$\color{#8085FF}\Huge\textsf{XulbuX}$**
|
|
59
59
|
|
|
60
|
-
**$\color{#8085FF}\textsf{XulbuX}$** is
|
|
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.
|
|
61
63
|
|
|
62
|
-
For precise information about the library, see the library's [
|
|
63
|
-
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).
|
|
64
66
|
|
|
67
|
+
<br>
|
|
65
68
|
|
|
66
69
|
## Installation
|
|
67
70
|
|
|
68
|
-
|
|
69
|
-
|
|
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
|
|
70
75
|
pip install xulbux
|
|
71
76
|
```
|
|
72
77
|
|
|
73
|
-
|
|
74
|
-
```
|
|
78
|
+
Upgrade the library and all its dependencies to their latest available version with the command:
|
|
79
|
+
```console
|
|
75
80
|
pip install --upgrade xulbux
|
|
76
81
|
```
|
|
77
82
|
|
|
83
|
+
<br>
|
|
78
84
|
|
|
79
85
|
## Usage
|
|
80
86
|
|
|
81
|
-
Import the full library under the alias `xx`, so
|
|
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()`:
|
|
82
88
|
```python
|
|
83
89
|
import xulbux as xx
|
|
84
90
|
```
|
|
85
|
-
So you don't have to
|
|
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:
|
|
86
92
|
```python
|
|
93
|
+
# CONSTANTS
|
|
94
|
+
from xulbux import COLOR, CHARS, ANSI
|
|
95
|
+
# Classes
|
|
96
|
+
from xulbux import Code, Color, Console, ...
|
|
97
|
+
# types
|
|
87
98
|
from xulbux import rgba, hsla, hexa
|
|
88
99
|
```
|
|
89
100
|
|
|
101
|
+
<br>
|
|
90
102
|
|
|
91
|
-
|
|
103
|
+
## Modules
|
|
92
104
|
|
|
93
|
-
| | |
|
|
94
|
-
|
|
|
105
|
+
| Module | Short Description |
|
|
106
|
+
| :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
|
|
95
107
|
| <h3>[`xx_code`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
|
|
96
108
|
| <h3>[`xx_color`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
|
|
97
109
|
| <h3>[`xx_console`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
|
|
@@ -99,13 +111,78 @@ from xulbux import rgba, hsla, hexa
|
|
|
99
111
|
| <h3>[`xx_env_path`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_env_path)</h3> | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
|
|
100
112
|
| <h3>[`xx_file`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
|
|
101
113
|
| <h3>[`xx_format_codes`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_format_codes)</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
|
|
102
|
-
| <h3>`xx_json`</h3>
|
|
103
|
-
| <h3>`xx_path`</h3>
|
|
104
|
-
| <h3>`xx_regex`</h3>
|
|
114
|
+
| <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
|
|
115
|
+
| <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
|
|
116
|
+
| <h3>`xx_regex`</h3> | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
|
|
105
117
|
| <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
|
|
106
|
-
| <h3>`xx_system`</h3>
|
|
118
|
+
| <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
|
|
119
|
+
|
|
120
|
+
<br>
|
|
107
121
|
|
|
122
|
+
## Example Usage
|
|
108
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>
|
|
109
186
|
<br>
|
|
110
187
|
|
|
111
188
|
--------------------------------------------------------------
|
xulbux-1.6.8/README.md
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# **$\color{#8085FF}\Huge\textsf{XulbuX}$**
|
|
2
|
+
|
|
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.
|
|
6
|
+
|
|
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).
|
|
9
|
+
|
|
10
|
+
<br>
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
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
|
|
18
|
+
pip install xulbux
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Upgrade the library and all its dependencies to their latest available version with the command:
|
|
22
|
+
```console
|
|
23
|
+
pip install --upgrade xulbux
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
<br>
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
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()`:
|
|
31
|
+
```python
|
|
32
|
+
import xulbux as xx
|
|
33
|
+
```
|
|
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:
|
|
35
|
+
```python
|
|
36
|
+
# CONSTANTS
|
|
37
|
+
from xulbux import COLOR, CHARS, ANSI
|
|
38
|
+
# Classes
|
|
39
|
+
from xulbux import Code, Color, Console, ...
|
|
40
|
+
# types
|
|
41
|
+
from xulbux import rgba, hsla, hexa
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
<br>
|
|
45
|
+
|
|
46
|
+
## Modules
|
|
47
|
+
|
|
48
|
+
| Module | Short Description |
|
|
49
|
+
| :----------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
|
|
50
|
+
| <h3>[`xx_code`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
|
|
51
|
+
| <h3>[`xx_color`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
|
|
52
|
+
| <h3>[`xx_console`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
|
|
53
|
+
| <h3>[`xx_data`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_data)</h3> | advanced operations with data structures (*compare, generate path ID's, pretty print/format, ...*) |
|
|
54
|
+
| <h3>[`xx_env_path`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_env_path)</h3> | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
|
|
55
|
+
| <h3>[`xx_file`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
|
|
56
|
+
| <h3>[`xx_format_codes`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_format_codes)</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
|
|
57
|
+
| <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
|
|
58
|
+
| <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
|
|
59
|
+
| <h3>`xx_regex`</h3> | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
|
|
60
|
+
| <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
|
|
61
|
+
| <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
|
|
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
|
+
)
|
|
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>
|
|
129
|
+
<br>
|
|
130
|
+
|
|
131
|
+
--------------------------------------------------------------
|
|
132
|
+
[View this library on PyPI](https://pypi.org/project/XulbuX/)
|
|
@@ -4,9 +4,9 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "xulbux"
|
|
7
|
-
version = "1.6.
|
|
7
|
+
version = "1.6.8"
|
|
8
8
|
authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
|
|
9
|
-
description = "A library which includes
|
|
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"
|
|
@@ -35,33 +35,64 @@ classifiers = [
|
|
|
35
35
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
36
36
|
]
|
|
37
37
|
keywords = [
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
41
|
-
"utility",
|
|
42
|
-
"helper",
|
|
43
|
-
"functions",
|
|
44
|
-
"tools",
|
|
38
|
+
"args",
|
|
39
|
+
"arguments",
|
|
40
|
+
"attributes",
|
|
45
41
|
"classes",
|
|
46
|
-
"types",
|
|
47
|
-
"methods",
|
|
48
42
|
"cmd",
|
|
49
|
-
"
|
|
43
|
+
"client",
|
|
50
44
|
"code",
|
|
45
|
+
"codes",
|
|
51
46
|
"color",
|
|
47
|
+
"commands",
|
|
48
|
+
"console",
|
|
49
|
+
"consts",
|
|
50
|
+
"constants",
|
|
51
|
+
"convert",
|
|
52
|
+
"conversion",
|
|
52
53
|
"data",
|
|
53
|
-
"
|
|
54
|
+
"debug",
|
|
55
|
+
"easier",
|
|
54
56
|
"env",
|
|
55
57
|
"environment",
|
|
58
|
+
"error",
|
|
56
59
|
"file",
|
|
57
60
|
"format",
|
|
61
|
+
"formatting",
|
|
62
|
+
"functions",
|
|
63
|
+
"helper",
|
|
64
|
+
"hex",
|
|
65
|
+
"hexa",
|
|
66
|
+
"hsl",
|
|
67
|
+
"hsla",
|
|
68
|
+
"info",
|
|
69
|
+
"input",
|
|
58
70
|
"json",
|
|
71
|
+
"library",
|
|
72
|
+
"log",
|
|
73
|
+
"logging",
|
|
74
|
+
"methods",
|
|
75
|
+
"nice",
|
|
76
|
+
"operations",
|
|
59
77
|
"path",
|
|
78
|
+
"presets",
|
|
79
|
+
"pretty",
|
|
80
|
+
"printing",
|
|
81
|
+
"properties",
|
|
82
|
+
"python",
|
|
83
|
+
"re",
|
|
60
84
|
"regex",
|
|
85
|
+
"rgb",
|
|
86
|
+
"rgba",
|
|
61
87
|
"string",
|
|
88
|
+
"structures",
|
|
62
89
|
"system",
|
|
63
|
-
"
|
|
64
|
-
"
|
|
90
|
+
"tools",
|
|
91
|
+
"types",
|
|
92
|
+
"utility",
|
|
93
|
+
"warn",
|
|
94
|
+
"warning",
|
|
95
|
+
"xulbux",
|
|
65
96
|
]
|
|
66
97
|
|
|
67
98
|
[project.urls]
|
|
@@ -3,13 +3,16 @@ from typing import TypeAlias
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
FormattableString: TypeAlias = str
|
|
6
|
+
"""A `str` object that is made to be formatted with the `.format()` method."""
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
@dataclass
|
|
9
10
|
class COLOR:
|
|
10
|
-
"""Color presets used in the
|
|
11
|
+
"""Color presets used in the `xulbux` library."""
|
|
11
12
|
|
|
12
13
|
text = "#A5D6FF"
|
|
14
|
+
"""The default text color used in the `xulbux` library."""
|
|
15
|
+
|
|
13
16
|
white = "#F1F2FF"
|
|
14
17
|
lightgray = "#B6B7C0"
|
|
15
18
|
gray = "#7B7C8D"
|
|
@@ -21,6 +24,7 @@ class COLOR:
|
|
|
21
24
|
tangerine = "#FF9962"
|
|
22
25
|
gold = "#FFAF60"
|
|
23
26
|
yellow = "#FFD260"
|
|
27
|
+
lime = "#C9F16E"
|
|
24
28
|
green = "#7EE787"
|
|
25
29
|
teal = "#50EAAF"
|
|
26
30
|
cyan = "#3EDEE6"
|
|
@@ -40,50 +44,67 @@ class _AllTextCharacters:
|
|
|
40
44
|
|
|
41
45
|
@dataclass
|
|
42
46
|
class CHARS:
|
|
43
|
-
"""
|
|
47
|
+
"""Text character sets."""
|
|
44
48
|
|
|
45
|
-
# CODE TO SIGNAL, ALL CHARACTERS ARE ALLOWED
|
|
46
49
|
all = _AllTextCharacters
|
|
50
|
+
"""Code to signal that all characters are allowed."""
|
|
47
51
|
|
|
48
|
-
# DIGIT SETS
|
|
49
52
|
digits: str = "0123456789"
|
|
53
|
+
"""Digits: `0`-`9`"""
|
|
50
54
|
float_digits: str = digits + "."
|
|
55
|
+
"""Digits: `0`-`9` with decimal point `.`"""
|
|
51
56
|
hex_digits: str = digits + "#abcdefABCDEF"
|
|
57
|
+
"""Digits: `0`-`9` Letters: `a`-`f` `A`-`F` and a hashtag `#`"""
|
|
52
58
|
|
|
53
|
-
# LETTER CATEGORIES
|
|
54
59
|
lowercase: str = "abcdefghijklmnopqrstuvwxyz"
|
|
60
|
+
"""Lowercase letters `a`-`z`"""
|
|
55
61
|
lowercase_extended: str = lowercase + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
|
|
62
|
+
"""Lowercase letters `a`-`z` with all lowercase diacritic letters."""
|
|
56
63
|
uppercase: str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
64
|
+
"""Uppercase letters `A`-`Z`"""
|
|
57
65
|
uppercase_extended: str = uppercase + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
|
|
66
|
+
"""Uppercase letters `A`-`Z` with all uppercase diacritic letters."""
|
|
58
67
|
|
|
59
|
-
# COMBINED LETTER SETS
|
|
60
68
|
letters: str = lowercase + uppercase
|
|
69
|
+
"""Lowercase and uppercase letters `a`-`z` and `A`-`Z`"""
|
|
61
70
|
letters_extended: str = lowercase_extended + uppercase_extended
|
|
71
|
+
"""Lowercase and uppercase letters `a`-`z` `A`-`Z` and all diacritic letters."""
|
|
62
72
|
|
|
63
|
-
# ASCII sets
|
|
64
73
|
special_ascii: str = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
|
74
|
+
"""All ASCII special characters."""
|
|
65
75
|
special_ascii_extended: str = special_ascii + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡±‗¾¶§÷¸°¨·¹³²■ "
|
|
76
|
+
"""All ASCII special characters with the extended ASCII special characters."""
|
|
66
77
|
standard_ascii: str = special_ascii + digits + letters
|
|
78
|
+
"""All standard ASCII characters."""
|
|
67
79
|
full_ascii: str = special_ascii_extended + digits + letters_extended
|
|
80
|
+
"""All characters in the ASCII table."""
|
|
68
81
|
|
|
69
82
|
|
|
70
83
|
class ANSI:
|
|
71
84
|
"""Constants and class-methods for use of ANSI escape codes."""
|
|
72
85
|
|
|
73
86
|
escaped_char: str = "\\x1b"
|
|
87
|
+
"""The printable ANSI escape character."""
|
|
74
88
|
CHAR = char = "\x1b"
|
|
89
|
+
"""The ANSI escape character."""
|
|
75
90
|
START = start = "["
|
|
91
|
+
"""The start of an ANSI escape sequence."""
|
|
76
92
|
SEP = sep = ";"
|
|
93
|
+
"""The separator between ANSI escape sequence parts."""
|
|
77
94
|
END = end = "m"
|
|
95
|
+
"""The end of an ANSI escape sequence."""
|
|
78
96
|
default_color_modifiers: dict[str, str] = {"lighten": "+l", "darken": "-d"}
|
|
97
|
+
"""Characters to modify the lightness of the default color with."""
|
|
79
98
|
|
|
80
99
|
@classmethod
|
|
81
|
-
def seq(cls, parts: int = 1) ->
|
|
100
|
+
def seq(cls, parts: int = 1) -> FormattableString:
|
|
82
101
|
"""Generate an ANSI sequence with `parts` amount of placeholders."""
|
|
83
102
|
return cls.CHAR + cls.START + cls.SEP.join(["{}" for _ in range(parts)]) + cls.END
|
|
84
103
|
|
|
85
104
|
seq_color: FormattableString = CHAR + START + "38" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
105
|
+
"""The ANSI escape sequence for setting the text RGB color."""
|
|
86
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."""
|
|
87
108
|
|
|
88
109
|
color_map: list[str] = [
|
|
89
110
|
########### DEFAULT CONSOLE COLOR NAMES ############
|
|
@@ -96,6 +117,7 @@ class ANSI:
|
|
|
96
117
|
"cyan",
|
|
97
118
|
"white",
|
|
98
119
|
]
|
|
120
|
+
"""The console default color names."""
|
|
99
121
|
|
|
100
122
|
codes_map: dict[str | tuple[str, ...], int] = {
|
|
101
123
|
################# SPECIFIC RESETS ##################
|
|
@@ -156,3 +178,4 @@ class ANSI:
|
|
|
156
178
|
"bg:br:cyan": 106,
|
|
157
179
|
"bg:br:white": 107,
|
|
158
180
|
}
|
|
181
|
+
"""All custom format keys and their corresponding ANSI format number codes."""
|
|
@@ -21,14 +21,13 @@ class Code:
|
|
|
21
21
|
non_zero_indents = [i for i in indents if i > 0]
|
|
22
22
|
return min(non_zero_indents) if non_zero_indents else 0
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
def change_tab_size(code: str, new_tab_size: int, remove_empty_lines: bool = False) -> str:
|
|
24
|
+
def change_tab_size(self, code: str, new_tab_size: int, remove_empty_lines: bool = False) -> str:
|
|
26
25
|
"""Replaces all tabs with `new_tab_size` spaces.\n
|
|
27
26
|
----------------------------------------------------------------------------------
|
|
28
27
|
If `remove_empty_lines` is `True`, empty lines will be removed in the process."""
|
|
29
28
|
code_lines = String.get_lines(code, remove_empty_lines=True)
|
|
30
29
|
lines = code_lines if remove_empty_lines else String.get_lines(code)
|
|
31
|
-
tab_spaces =
|
|
30
|
+
tab_spaces = self.get_tab_spaces(code)
|
|
32
31
|
if (tab_spaces == new_tab_size) or tab_spaces == 0:
|
|
33
32
|
if remove_empty_lines:
|
|
34
33
|
return "\n".join(code_lines)
|