xulbux 1.7.3__tar.gz → 1.8.1__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.8.1/PKG-INFO +190 -0
- xulbux-1.8.1/README.md +154 -0
- {xulbux-1.7.3 → xulbux-1.8.1}/pyproject.toml +9 -8
- xulbux-1.8.1/src/xulbux/__init__.py +23 -0
- xulbux-1.7.3/src/xulbux/_consts_.py → xulbux-1.8.1/src/xulbux/base/consts.py +51 -58
- xulbux-1.8.1/src/xulbux/cli/help.py +45 -0
- xulbux-1.7.3/src/xulbux/xx_code.py → xulbux-1.8.1/src/xulbux/code.py +3 -3
- xulbux-1.7.3/src/xulbux/xx_color.py → xulbux-1.8.1/src/xulbux/color.py +1 -1
- xulbux-1.7.3/src/xulbux/xx_console.py → xulbux-1.8.1/src/xulbux/console.py +358 -200
- xulbux-1.7.3/src/xulbux/xx_data.py → xulbux-1.8.1/src/xulbux/data.py +14 -14
- xulbux-1.7.3/src/xulbux/xx_env_path.py → xulbux-1.8.1/src/xulbux/env_path.py +1 -1
- xulbux-1.7.3/src/xulbux/xx_file.py → xulbux-1.8.1/src/xulbux/file.py +1 -1
- xulbux-1.7.3/src/xulbux/xx_format_codes.py → xulbux-1.8.1/src/xulbux/format_codes.py +21 -21
- xulbux-1.7.3/src/xulbux/xx_json.py → xulbux-1.8.1/src/xulbux/json.py +3 -3
- xulbux-1.7.3/src/xulbux/xx_system.py → xulbux-1.8.1/src/xulbux/system.py +11 -11
- xulbux-1.8.1/src/xulbux.egg-info/PKG-INFO +190 -0
- {xulbux-1.7.3 → xulbux-1.8.1}/src/xulbux.egg-info/SOURCES.txt +14 -15
- xulbux-1.8.1/src/xulbux.egg-info/entry_points.txt +2 -0
- {xulbux-1.7.3 → xulbux-1.8.1}/src/xulbux.egg-info/requires.txt +0 -1
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_code.py +1 -1
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_color.py +3 -3
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_color_types.py +1 -1
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_console.py +32 -18
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_data.py +1 -1
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_env_path.py +1 -1
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_file.py +1 -2
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_format_codes.py +18 -18
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_json.py +2 -2
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_path.py +1 -2
- {xulbux-1.7.3 → xulbux-1.8.1}/tests/test_string.py +1 -1
- xulbux-1.7.3/LICENSE +0 -21
- xulbux-1.7.3/PKG-INFO +0 -173
- xulbux-1.7.3/README.md +0 -136
- xulbux-1.7.3/src/xulbux/__init__.py +0 -25
- xulbux-1.7.3/src/xulbux/_cli_.py +0 -46
- xulbux-1.7.3/src/xulbux.egg-info/PKG-INFO +0 -173
- xulbux-1.7.3/src/xulbux.egg-info/entry_points.txt +0 -3
- {xulbux-1.7.3 → xulbux-1.8.1}/setup.cfg +0 -0
- /xulbux-1.7.3/src/xulbux/xx_path.py → /xulbux-1.8.1/src/xulbux/path.py +0 -0
- /xulbux-1.7.3/src/xulbux/xx_regex.py → /xulbux-1.8.1/src/xulbux/regex.py +0 -0
- /xulbux-1.7.3/src/xulbux/xx_string.py → /xulbux-1.8.1/src/xulbux/string.py +0 -0
- {xulbux-1.7.3 → xulbux-1.8.1}/src/xulbux.egg-info/dependency_links.txt +0 -0
- {xulbux-1.7.3 → xulbux-1.8.1}/src/xulbux.egg-info/top_level.txt +0 -0
xulbux-1.8.1/PKG-INFO
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: xulbux
|
|
3
|
+
Version: 1.8.1
|
|
4
|
+
Summary: A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler.
|
|
5
|
+
Author-email: XulbuX <xulbux.real@gmail.com>
|
|
6
|
+
Maintainer-email: XulbuX <xulbux.real@gmail.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/XulbuX/PythonLibraryXulbuX
|
|
9
|
+
Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
|
|
10
|
+
Project-URL: Source Code, https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src
|
|
11
|
+
Project-URL: Changelog, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md
|
|
12
|
+
Project-URL: Bug Reports, https://github.com/XulbuX/PythonLibraryXulbuX/issues
|
|
13
|
+
Project-URL: Stats, https://clickpy.clickhouse.com/dashboard/xulbux
|
|
14
|
+
Project-URL: License, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE
|
|
15
|
+
Keywords: args,arguments,attributes,classes,client,cmd,code,codes,color,commands,console,constants,consts,conversion,convert,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
|
|
16
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Operating System :: OS Independent
|
|
22
|
+
Classifier: Intended Audience :: Developers
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Requires-Python: >=3.10.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
Requires-Dist: keyboard>=0.13.5
|
|
27
|
+
Requires-Dist: prompt_toolkit>=3.0.41
|
|
28
|
+
Requires-Dist: pyperclip>=1.9.0
|
|
29
|
+
Requires-Dist: regex>=2023.10.3
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: black>=23.7.0; extra == "dev"
|
|
32
|
+
Requires-Dist: flake8-pyproject>=1.2.3; extra == "dev"
|
|
33
|
+
Requires-Dist: flake8>=6.1.0; extra == "dev"
|
|
34
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
35
|
+
Requires-Dist: pytest>=7.4.2; extra == "dev"
|
|
36
|
+
|
|
37
|
+
# **XulbuX**
|
|
38
|
+
|
|
39
|
+
[](https://pypi.org/project/xulbux) [](https://clickpy.clickhouse.com/dashboard/xulbux) [](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE) [](https://github.com/XulbuX/PythonLibraryXulbuX/commits) [](https://github.com/XulbuX/PythonLibraryXulbuX/issues)
|
|
40
|
+
|
|
41
|
+
**XulbuX** is a library that contains many useful classes, types, and functions,
|
|
42
|
+
ranging from console logging and working with colors to file management and system operations.
|
|
43
|
+
The library is designed to simplify common programming tasks and improve code readability through its collection of tools.
|
|
44
|
+
|
|
45
|
+
For precise information about the library, see the library's [**documentation**](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
|
|
46
|
+
For the libraries latest changes and updates, see the [**change log**](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
|
|
47
|
+
|
|
48
|
+
### The best modules, you have to check out:
|
|
49
|
+
|
|
50
|
+
[](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/format_codes) [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/console) [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/color)
|
|
51
|
+
|
|
52
|
+
<br>
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
Run the following commands in a console with administrator privileges, so the actions take effect for all users.
|
|
57
|
+
|
|
58
|
+
Install the library and all its dependencies with the command:
|
|
59
|
+
```console
|
|
60
|
+
pip install xulbux
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Upgrade the library and all its dependencies to their latest available version with the command:
|
|
64
|
+
```console
|
|
65
|
+
pip install --upgrade xulbux
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
<br>
|
|
69
|
+
|
|
70
|
+
## CLI Commands
|
|
71
|
+
|
|
72
|
+
When the library is installed, the following commands are available in the console:
|
|
73
|
+
| Command | Description |
|
|
74
|
+
| :------------ | :--------------------------------------- |
|
|
75
|
+
| `xulbux-help` | shows some information about the library |
|
|
76
|
+
|
|
77
|
+
<br>
|
|
78
|
+
|
|
79
|
+
## Usage
|
|
80
|
+
|
|
81
|
+
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
|
+
```python
|
|
83
|
+
import xulbux as xx
|
|
84
|
+
```
|
|
85
|
+
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
|
+
```python
|
|
87
|
+
# LIBRARY CONSTANTS
|
|
88
|
+
from xulbux.base.consts import COLOR, CHARS, ANSI
|
|
89
|
+
# Main Classes
|
|
90
|
+
from xulbux import Code, Color, Console, ...
|
|
91
|
+
# module specific imports
|
|
92
|
+
from xulbux.color import rgba, hsla, hexa
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
<br>
|
|
96
|
+
|
|
97
|
+
## Modules
|
|
98
|
+
|
|
99
|
+
| Module | Short Description |
|
|
100
|
+
| :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |
|
|
101
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/base) | includes more modules like library constants |
|
|
102
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/code) | advanced code-string operations (*changing the indent, finding function calls, ...*) |
|
|
103
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/color) | everything around colors (*converting, blending, searching colors in strings, ...*) |
|
|
104
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/console) | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
|
|
105
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/data) | advanced operations with data structures (*compare, generate path IDs, pretty print, ...*) |
|
|
106
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/env_path) | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
|
|
107
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/file) | advanced working with files (*create files, rename file-extensions, ...*) |
|
|
108
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/format_codes) | easy pretty printing using custom format codes (*print, inputs, format codes to ANSI, ...*) |
|
|
109
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/json) | advanced working with json files (*read, create, update, ...*) |
|
|
110
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/path) | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
|
|
111
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/regex) | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
|
|
112
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/string) | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
|
|
113
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/system) | advanced system actions (*restart with message, check installed Python libs, ...*) |
|
|
114
|
+
|
|
115
|
+
<br>
|
|
116
|
+
|
|
117
|
+
## Example Usage
|
|
118
|
+
|
|
119
|
+
This is what it could look like using this library for a simple but ultra good-looking color converter:
|
|
120
|
+
```python
|
|
121
|
+
from xulbux.base.consts import COLOR, CHARS
|
|
122
|
+
from xulbux.color import hexa
|
|
123
|
+
from xulbux import Console
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def main() -> None:
|
|
127
|
+
|
|
128
|
+
# LET THE USER ENTER A HEXA COLOR IN ANY HEXA FORMAT
|
|
129
|
+
input_clr = Console.input(
|
|
130
|
+
"[b](Enter a HEXA color in any format) > ",
|
|
131
|
+
start="\n",
|
|
132
|
+
placeholder="#7075FF",
|
|
133
|
+
max_len=7,
|
|
134
|
+
allowed_chars=CHARS.HEX_DIGITS,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
# ANNOUNCE INDEXING THE INPUT COLOR
|
|
138
|
+
Console.log(
|
|
139
|
+
"INDEX",
|
|
140
|
+
"Indexing the input HEXA color...",
|
|
141
|
+
start="\n",
|
|
142
|
+
title_bg_color=COLOR.BLUE,
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
try:
|
|
146
|
+
# TRY TO CONVERT THE INPUT COLOR INTO A hexa() COLOR
|
|
147
|
+
hexa_color = hexa(input_clr)
|
|
148
|
+
|
|
149
|
+
except ValueError:
|
|
150
|
+
# ANNOUNCE THE ERROR AND EXIT THE PROGRAM
|
|
151
|
+
Console.fail(
|
|
152
|
+
"The input HEXA color is invalid.",
|
|
153
|
+
end="\n\n",
|
|
154
|
+
exit=True,
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
# ANNOUNCE STARTING THE CONVERSION
|
|
158
|
+
Console.log(
|
|
159
|
+
"CONVERT",
|
|
160
|
+
"Converting the HEXA color into different types...",
|
|
161
|
+
title_bg_color=COLOR.TANGERINE,
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
# CONVERT THE HEXA COLOR INTO THE TWO OTHER COLOR TYPES
|
|
165
|
+
rgba_color = hexa_color.to_rgba()
|
|
166
|
+
hsla_color = hexa_color.to_hsla()
|
|
167
|
+
|
|
168
|
+
# ANNOUNCE THE SUCCESSFUL CONVERSION
|
|
169
|
+
Console.done(
|
|
170
|
+
"Successfully converted color into different types.",
|
|
171
|
+
end="\n\n",
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
# PRETTY PRINT THE COLOR IN DIFFERENT TYPES
|
|
175
|
+
Console.log_box_bordered(
|
|
176
|
+
f"[b](HEXA:) [i|white]({hexa_color})",
|
|
177
|
+
f"[b](RGBA:) [i|white]({rgba_color})",
|
|
178
|
+
f"[b](HSLA:) [i|white]({hsla_color})",
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
if __name__ == "__main__":
|
|
183
|
+
main()
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
<br>
|
|
187
|
+
<br>
|
|
188
|
+
|
|
189
|
+
--------------------------------------------------------------
|
|
190
|
+
[View this library on **PyPI**](https://pypi.org/project/xulbux)
|
xulbux-1.8.1/README.md
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
# **XulbuX**
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/xulbux) [](https://clickpy.clickhouse.com/dashboard/xulbux) [](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE) [](https://github.com/XulbuX/PythonLibraryXulbuX/commits) [](https://github.com/XulbuX/PythonLibraryXulbuX/issues)
|
|
4
|
+
|
|
5
|
+
**XulbuX** is a library that contains many useful classes, types, and functions,
|
|
6
|
+
ranging from console logging and working with colors to file management and system operations.
|
|
7
|
+
The library is designed to simplify common programming tasks and improve code readability through its collection of tools.
|
|
8
|
+
|
|
9
|
+
For precise information about the library, see the library's [**documentation**](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
|
|
10
|
+
For the libraries latest changes and updates, see the [**change log**](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
|
|
11
|
+
|
|
12
|
+
### The best modules, you have to check out:
|
|
13
|
+
|
|
14
|
+
[](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/format_codes) [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/console) [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/color)
|
|
15
|
+
|
|
16
|
+
<br>
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Run the following commands in a console with administrator privileges, so the actions take effect for all users.
|
|
21
|
+
|
|
22
|
+
Install the library and all its dependencies with the command:
|
|
23
|
+
```console
|
|
24
|
+
pip install xulbux
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Upgrade the library and all its dependencies to their latest available version with the command:
|
|
28
|
+
```console
|
|
29
|
+
pip install --upgrade xulbux
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
<br>
|
|
33
|
+
|
|
34
|
+
## CLI Commands
|
|
35
|
+
|
|
36
|
+
When the library is installed, the following commands are available in the console:
|
|
37
|
+
| Command | Description |
|
|
38
|
+
| :------------ | :--------------------------------------- |
|
|
39
|
+
| `xulbux-help` | shows some information about the library |
|
|
40
|
+
|
|
41
|
+
<br>
|
|
42
|
+
|
|
43
|
+
## Usage
|
|
44
|
+
|
|
45
|
+
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()`:
|
|
46
|
+
```python
|
|
47
|
+
import xulbux as xx
|
|
48
|
+
```
|
|
49
|
+
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:
|
|
50
|
+
```python
|
|
51
|
+
# LIBRARY CONSTANTS
|
|
52
|
+
from xulbux.base.consts import COLOR, CHARS, ANSI
|
|
53
|
+
# Main Classes
|
|
54
|
+
from xulbux import Code, Color, Console, ...
|
|
55
|
+
# module specific imports
|
|
56
|
+
from xulbux.color import rgba, hsla, hexa
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
<br>
|
|
60
|
+
|
|
61
|
+
## Modules
|
|
62
|
+
|
|
63
|
+
| Module | Short Description |
|
|
64
|
+
| :-------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |
|
|
65
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/base) | includes more modules like library constants |
|
|
66
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/code) | advanced code-string operations (*changing the indent, finding function calls, ...*) |
|
|
67
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/color) | everything around colors (*converting, blending, searching colors in strings, ...*) |
|
|
68
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/console) | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
|
|
69
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/data) | advanced operations with data structures (*compare, generate path IDs, pretty print, ...*) |
|
|
70
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/env_path) | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
|
|
71
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/file) | advanced working with files (*create files, rename file-extensions, ...*) |
|
|
72
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/format_codes) | easy pretty printing using custom format codes (*print, inputs, format codes to ANSI, ...*) |
|
|
73
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/json) | advanced working with json files (*read, create, update, ...*) |
|
|
74
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/path) | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
|
|
75
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/regex) | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
|
|
76
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/string) | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
|
|
77
|
+
| [](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/system) | advanced system actions (*restart with message, check installed Python libs, ...*) |
|
|
78
|
+
|
|
79
|
+
<br>
|
|
80
|
+
|
|
81
|
+
## Example Usage
|
|
82
|
+
|
|
83
|
+
This is what it could look like using this library for a simple but ultra good-looking color converter:
|
|
84
|
+
```python
|
|
85
|
+
from xulbux.base.consts import COLOR, CHARS
|
|
86
|
+
from xulbux.color import hexa
|
|
87
|
+
from xulbux import Console
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def main() -> None:
|
|
91
|
+
|
|
92
|
+
# LET THE USER ENTER A HEXA COLOR IN ANY HEXA FORMAT
|
|
93
|
+
input_clr = Console.input(
|
|
94
|
+
"[b](Enter a HEXA color in any format) > ",
|
|
95
|
+
start="\n",
|
|
96
|
+
placeholder="#7075FF",
|
|
97
|
+
max_len=7,
|
|
98
|
+
allowed_chars=CHARS.HEX_DIGITS,
|
|
99
|
+
)
|
|
100
|
+
|
|
101
|
+
# ANNOUNCE INDEXING THE INPUT COLOR
|
|
102
|
+
Console.log(
|
|
103
|
+
"INDEX",
|
|
104
|
+
"Indexing the input HEXA color...",
|
|
105
|
+
start="\n",
|
|
106
|
+
title_bg_color=COLOR.BLUE,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
try:
|
|
110
|
+
# TRY TO CONVERT THE INPUT COLOR INTO A hexa() COLOR
|
|
111
|
+
hexa_color = hexa(input_clr)
|
|
112
|
+
|
|
113
|
+
except ValueError:
|
|
114
|
+
# ANNOUNCE THE ERROR AND EXIT THE PROGRAM
|
|
115
|
+
Console.fail(
|
|
116
|
+
"The input HEXA color is invalid.",
|
|
117
|
+
end="\n\n",
|
|
118
|
+
exit=True,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
# ANNOUNCE STARTING THE CONVERSION
|
|
122
|
+
Console.log(
|
|
123
|
+
"CONVERT",
|
|
124
|
+
"Converting the HEXA color into different types...",
|
|
125
|
+
title_bg_color=COLOR.TANGERINE,
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
# CONVERT THE HEXA COLOR INTO THE TWO OTHER COLOR TYPES
|
|
129
|
+
rgba_color = hexa_color.to_rgba()
|
|
130
|
+
hsla_color = hexa_color.to_hsla()
|
|
131
|
+
|
|
132
|
+
# ANNOUNCE THE SUCCESSFUL CONVERSION
|
|
133
|
+
Console.done(
|
|
134
|
+
"Successfully converted color into different types.",
|
|
135
|
+
end="\n\n",
|
|
136
|
+
)
|
|
137
|
+
|
|
138
|
+
# PRETTY PRINT THE COLOR IN DIFFERENT TYPES
|
|
139
|
+
Console.log_box_bordered(
|
|
140
|
+
f"[b](HEXA:) [i|white]({hexa_color})",
|
|
141
|
+
f"[b](RGBA:) [i|white]({rgba_color})",
|
|
142
|
+
f"[b](HSLA:) [i|white]({hsla_color})",
|
|
143
|
+
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
if __name__ == "__main__":
|
|
147
|
+
main()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
<br>
|
|
151
|
+
<br>
|
|
152
|
+
|
|
153
|
+
--------------------------------------------------------------
|
|
154
|
+
[View this library on **PyPI**](https://pypi.org/project/xulbux)
|
|
@@ -4,16 +4,16 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "xulbux"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.8.1"
|
|
8
8
|
authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
|
|
9
|
+
maintainers = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
|
|
9
10
|
description = "A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler."
|
|
10
11
|
readme = "README.md"
|
|
11
12
|
license = "MIT"
|
|
12
|
-
license-files = ["
|
|
13
|
+
license-files = ["LICEN[CS]E.*"]
|
|
13
14
|
requires-python = ">=3.10.0"
|
|
14
15
|
dependencies = [
|
|
15
16
|
"keyboard>=0.13.5",
|
|
16
|
-
"mouse>=0.7.1",
|
|
17
17
|
"prompt_toolkit>=3.0.41",
|
|
18
18
|
"pyperclip>=1.9.0",
|
|
19
19
|
"regex>=2023.10.3",
|
|
@@ -26,7 +26,7 @@ optional-dependencies = { dev = [
|
|
|
26
26
|
"pytest>=7.4.2",
|
|
27
27
|
] }
|
|
28
28
|
classifiers = [
|
|
29
|
-
"
|
|
29
|
+
"Development Status :: 5 - Production/Stable",
|
|
30
30
|
"Programming Language :: Python :: 3.13",
|
|
31
31
|
"Programming Language :: Python :: 3.12",
|
|
32
32
|
"Programming Language :: Python :: 3.11",
|
|
@@ -102,12 +102,11 @@ keywords = [
|
|
|
102
102
|
"Source Code" = "https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src"
|
|
103
103
|
"Changelog" = "https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md"
|
|
104
104
|
"Bug Reports" = "https://github.com/XulbuX/PythonLibraryXulbuX/issues"
|
|
105
|
+
"Stats" = "https://clickpy.clickhouse.com/dashboard/xulbux"
|
|
105
106
|
"License" = "https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE"
|
|
106
107
|
|
|
107
|
-
|
|
108
108
|
[project.scripts]
|
|
109
|
-
|
|
110
|
-
xulbux-help = "xulbux._cli_:help_command"
|
|
109
|
+
xulbux-help = "xulbux.cli.help:show_help"
|
|
111
110
|
|
|
112
111
|
[tool.black]
|
|
113
112
|
line-length = 127
|
|
@@ -144,9 +143,11 @@ extend-ignore = ["E203", "E266", "W503"]
|
|
|
144
143
|
per-file-ignores = ["__init__.py:F403,F405"]
|
|
145
144
|
|
|
146
145
|
[tool.setuptools]
|
|
147
|
-
packages = ["xulbux"]
|
|
148
146
|
package-dir = { "" = "src" }
|
|
149
147
|
|
|
148
|
+
[tool.setuptools.packages.find]
|
|
149
|
+
where = ["src"]
|
|
150
|
+
|
|
150
151
|
[tool.pytest.ini_options]
|
|
151
152
|
minversion = "7.0"
|
|
152
153
|
addopts = "-ra -q"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
__version__ = "1.8.1"
|
|
2
|
+
|
|
3
|
+
__author__ = "XulbuX"
|
|
4
|
+
__email__ = "xulbux.real@gmail.com"
|
|
5
|
+
__license__ = "MIT"
|
|
6
|
+
__copyright__ = "Copyright (c) 2024 XulbuX"
|
|
7
|
+
__url__ = "https://github.com/XulbuX/PythonLibraryXulbuX"
|
|
8
|
+
__description__ = "A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler."
|
|
9
|
+
|
|
10
|
+
__all__ = ["Code", "Color", "Console", "Data", "EnvPath", "File", "FormatCodes", "Json", "Path", "Regex", "String", "System"]
|
|
11
|
+
|
|
12
|
+
from .code import Code
|
|
13
|
+
from .color import Color
|
|
14
|
+
from .console import Console
|
|
15
|
+
from .data import Data
|
|
16
|
+
from .env_path import EnvPath
|
|
17
|
+
from .file import File
|
|
18
|
+
from .format_codes import FormatCodes
|
|
19
|
+
from .json import Json
|
|
20
|
+
from .path import Path
|
|
21
|
+
from .regex import Regex
|
|
22
|
+
from .string import String
|
|
23
|
+
from .system import System
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
1
|
from typing import TypeAlias
|
|
3
2
|
|
|
4
3
|
|
|
@@ -6,85 +5,79 @@ FormattableString: TypeAlias = str
|
|
|
6
5
|
"""A `str` object that is made to be formatted with the `.format()` method."""
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
@dataclass
|
|
10
8
|
class COLOR:
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
rose = "#FF609F"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class _AllTextCharacters:
|
|
43
|
-
pass
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@dataclass
|
|
9
|
+
"""Hexa color presets."""
|
|
10
|
+
|
|
11
|
+
WHITE = "#F1F2FF"
|
|
12
|
+
LIGHT_GRAY = "#B6B7C0"
|
|
13
|
+
GRAY = "#7B7C8D"
|
|
14
|
+
DARK_GRAY = "#67686C"
|
|
15
|
+
BLACK = "#202125"
|
|
16
|
+
RED = "#FF606A"
|
|
17
|
+
CORAL = "#FF7069"
|
|
18
|
+
ORANGE = "#FF876A"
|
|
19
|
+
TANGERINE = "#FF9962"
|
|
20
|
+
GOLD = "#FFAF60"
|
|
21
|
+
YELLOW = "#FFD260"
|
|
22
|
+
LIME = "#C9F16E"
|
|
23
|
+
GREEN = "#7EE787"
|
|
24
|
+
NEON_GREEN = "#4CFF85"
|
|
25
|
+
TEAL = "#50EAAF"
|
|
26
|
+
CYAN = "#3EDEE6"
|
|
27
|
+
ICE = "#77DBEF"
|
|
28
|
+
LIGHT_BLUE = "#60AAFF"
|
|
29
|
+
BLUE = "#8085FF"
|
|
30
|
+
LAVENDER = "#9B7DFF"
|
|
31
|
+
PURPLE = "#AD68FF"
|
|
32
|
+
MAGENTA = "#C860FF"
|
|
33
|
+
PINK = "#F162EF"
|
|
34
|
+
ROSE = "#FF609F"
|
|
35
|
+
|
|
36
|
+
|
|
47
37
|
class CHARS:
|
|
48
38
|
"""Text character sets."""
|
|
49
39
|
|
|
50
|
-
|
|
40
|
+
class _AllTextChars:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
ALL = _AllTextChars
|
|
51
44
|
"""Code to signal that all characters are allowed."""
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
DIGITS = "0123456789"
|
|
54
47
|
"""Digits: `0`-`9`"""
|
|
55
|
-
|
|
48
|
+
FLOAT_DIGITS = DIGITS + "."
|
|
56
49
|
"""Digits: `0`-`9` with decimal point `.`"""
|
|
57
|
-
|
|
50
|
+
HEX_DIGITS = DIGITS + "#abcdefABCDEF"
|
|
58
51
|
"""Digits: `0`-`9` Letters: `a`-`f` `A`-`F` and a hashtag `#`"""
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
LOWERCASE = "abcdefghijklmnopqrstuvwxyz"
|
|
61
54
|
"""Lowercase letters `a`-`z`"""
|
|
62
|
-
|
|
55
|
+
LOWERCASE_EXTENDED = LOWERCASE + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
|
|
63
56
|
"""Lowercase letters `a`-`z` with all lowercase diacritic letters."""
|
|
64
|
-
|
|
57
|
+
UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
65
58
|
"""Uppercase letters `A`-`Z`"""
|
|
66
|
-
|
|
59
|
+
UPPERCASE_EXTENDED = UPPERCASE + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
|
|
67
60
|
"""Uppercase letters `A`-`Z` with all uppercase diacritic letters."""
|
|
68
61
|
|
|
69
|
-
|
|
62
|
+
LETTERS = LOWERCASE + UPPERCASE
|
|
70
63
|
"""Lowercase and uppercase letters `a`-`z` and `A`-`Z`"""
|
|
71
|
-
|
|
64
|
+
LETTERS_EXTENDED = LOWERCASE_EXTENDED + UPPERCASE_EXTENDED
|
|
72
65
|
"""Lowercase and uppercase letters `a`-`z` `A`-`Z` and all diacritic letters."""
|
|
73
66
|
|
|
74
|
-
|
|
67
|
+
SPECIAL_ASCII = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
|
75
68
|
"""All ASCII special characters."""
|
|
76
|
-
|
|
69
|
+
SPECIAL_ASCII_EXTENDED = SPECIAL_ASCII + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡±‗¾¶§÷¸°¨·¹³²■ "
|
|
77
70
|
"""All ASCII special characters with the extended ASCII special characters."""
|
|
78
|
-
|
|
71
|
+
STANDARD_ASCII = SPECIAL_ASCII + DIGITS + LETTERS
|
|
79
72
|
"""All standard ASCII characters."""
|
|
80
|
-
|
|
73
|
+
FULL_ASCII = SPECIAL_ASCII_EXTENDED + DIGITS + LETTERS_EXTENDED
|
|
81
74
|
"""All characters in the ASCII table."""
|
|
82
75
|
|
|
83
76
|
|
|
84
77
|
class ANSI:
|
|
85
|
-
"""Constants and
|
|
78
|
+
"""Constants and methods for use of ANSI escape codes"""
|
|
86
79
|
|
|
87
|
-
|
|
80
|
+
ESCAPED_CHAR = "\\x1b"
|
|
88
81
|
"""The printable ANSI escape character."""
|
|
89
82
|
CHAR = char = "\x1b"
|
|
90
83
|
"""The ANSI escape character."""
|
|
@@ -100,12 +93,12 @@ class ANSI:
|
|
|
100
93
|
"""Generate an ANSI sequence with `parts` amount of placeholders."""
|
|
101
94
|
return cls.CHAR + cls.START + cls.SEP.join(["{}" for _ in range(parts)]) + cls.END
|
|
102
95
|
|
|
103
|
-
|
|
96
|
+
SEQ_COLOR: FormattableString = CHAR + START + "38" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
104
97
|
"""The ANSI escape sequence for setting the text RGB color."""
|
|
105
|
-
|
|
98
|
+
SEQ_BG_COLOR: FormattableString = CHAR + START + "48" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
106
99
|
"""The ANSI escape sequence for setting the background RGB color."""
|
|
107
100
|
|
|
108
|
-
|
|
101
|
+
COLOR_MAP: tuple[str, ...] = (
|
|
109
102
|
########### DEFAULT CONSOLE COLOR NAMES ############
|
|
110
103
|
"black",
|
|
111
104
|
"red",
|
|
@@ -118,7 +111,7 @@ class ANSI:
|
|
|
118
111
|
)
|
|
119
112
|
"""The console default color names."""
|
|
120
113
|
|
|
121
|
-
|
|
114
|
+
CODES_MAP: dict[str | tuple[str, ...], int] = {
|
|
122
115
|
################# SPECIFIC RESETS ##################
|
|
123
116
|
"_": 0,
|
|
124
117
|
("_bold", "_b"): 22,
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from .. import __version__
|
|
2
|
+
from ..base.consts import COLOR
|
|
3
|
+
from ..format_codes import FormatCodes
|
|
4
|
+
from ..console import Console
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
CLR = {
|
|
8
|
+
"class": COLOR.TANGERINE,
|
|
9
|
+
"const": COLOR.RED,
|
|
10
|
+
"func": COLOR.CYAN,
|
|
11
|
+
"import": COLOR.NEON_GREEN,
|
|
12
|
+
"lib": COLOR.ORANGE,
|
|
13
|
+
"punctuators": COLOR.DARK_GRAY,
|
|
14
|
+
"code_border": COLOR.GRAY,
|
|
15
|
+
}
|
|
16
|
+
HELP = FormatCodes.to_ansi(
|
|
17
|
+
rf""" [_|b|#7075FF] __ __
|
|
18
|
+
[b|#7075FF] _ __ __ __/ / / /_ __ ___ __
|
|
19
|
+
[b|#7075FF] | |/ // / / / / / __ \/ / / | |/ /
|
|
20
|
+
[b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
|
|
21
|
+
[b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{COLOR.GRAY}|#000] v[b]{__version__} [*]
|
|
22
|
+
|
|
23
|
+
[i|{COLOR.CORAL}]A TON OF COOL FUNCTIONS, YOU NEED![*]
|
|
24
|
+
|
|
25
|
+
[b|#FCFCFF]Usage:[*]
|
|
26
|
+
[dim|{CLR['code_border']}](╭────────────────────────────────────────────────────╮)
|
|
27
|
+
[dim|{CLR['code_border']}](│) [{CLR['punctuators']}]# LIBRARY CONSTANTS[*] [dim|{CLR['code_border']}](│)
|
|
28
|
+
[dim|{CLR['code_border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux[{CLR['punctuators']}].[{CLR['lib']}]base[{CLR['punctuators']}].[{CLR['lib']}]consts [{CLR['import']}]import [{CLR['const']}]COLOR[{CLR['punctuators']}], [{CLR['const']}]CHARS[{CLR['punctuators']}], [{CLR['const']}]ANSI[*] [dim|{CLR['code_border']}](│)
|
|
29
|
+
[dim|{CLR['code_border']}](│) [{CLR['punctuators']}]# Main Classes[*] [dim|{CLR['code_border']}](│)
|
|
30
|
+
[dim|{CLR['code_border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux [{CLR['import']}]import [{CLR['class']}]Code[{CLR['punctuators']}], [{CLR['class']}]Color[{CLR['punctuators']}], [{CLR['class']}]Console[{CLR['punctuators']}], ...[*] [dim|{CLR['code_border']}](│)
|
|
31
|
+
[dim|{CLR['code_border']}](│) [{CLR['punctuators']}]# module specific imports[*] [dim|{CLR['code_border']}](│)
|
|
32
|
+
[dim|{CLR['code_border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux[{CLR['punctuators']}].[{CLR['lib']}]color [{CLR['import']}]import [{CLR['func']}]rgba[{CLR['punctuators']}], [{CLR['func']}]hsla[{CLR['punctuators']}], [{CLR['func']}]hexa[*] [dim|{CLR['code_border']}](│)
|
|
33
|
+
[dim|{CLR['code_border']}](╰────────────────────────────────────────────────────╯)
|
|
34
|
+
[b|#FCFCFF]Documentation:[*]
|
|
35
|
+
[dim|{CLR['code_border']}](╭────────────────────────────────────────────────────╮)
|
|
36
|
+
[dim|{CLR['code_border']}](│) [#DADADD]For more information see the GitHub page. [dim|{CLR['code_border']}](│)
|
|
37
|
+
[dim|{CLR['code_border']}](│) [u|#8085FF](https://github.com/XulbuX/PythonLibraryXulbuX/wiki) [dim|{CLR['code_border']}](│)
|
|
38
|
+
[dim|{CLR['code_border']}](╰────────────────────────────────────────────────────╯)
|
|
39
|
+
[_]"""
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def show_help() -> None:
|
|
44
|
+
print(HELP)
|
|
45
|
+
Console.pause_exit(pause=True, prompt=" [dim](Press any key to exit...)\n\n")
|