xulbux 1.6.4__tar.gz → 1.6.5__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 (32) hide show
  1. {xulbux-1.6.4/src/xulbux.egg-info → xulbux-1.6.5}/PKG-INFO +17 -17
  2. {xulbux-1.6.4 → xulbux-1.6.5}/README.md +10 -10
  3. {xulbux-1.6.4 → xulbux-1.6.5}/pyproject.toml +7 -7
  4. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/__init__.py +2 -2
  5. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/_consts_.py +6 -6
  6. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_color.py +22 -24
  7. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_console.py +57 -17
  8. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_data.py +3 -3
  9. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_file.py +1 -1
  10. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_format_codes.py +14 -1
  11. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_string.py +5 -6
  12. {xulbux-1.6.4 → xulbux-1.6.5/src/xulbux.egg-info}/PKG-INFO +17 -17
  13. {xulbux-1.6.4 → xulbux-1.6.5}/LICENSE +0 -0
  14. {xulbux-1.6.4 → xulbux-1.6.5}/setup.cfg +0 -0
  15. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/_cli_.py +0 -0
  16. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_code.py +0 -0
  17. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_env_path.py +0 -0
  18. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_json.py +0 -0
  19. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_path.py +0 -0
  20. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_regex.py +0 -0
  21. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux/xx_system.py +0 -0
  22. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux.egg-info/SOURCES.txt +0 -0
  23. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux.egg-info/dependency_links.txt +0 -0
  24. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux.egg-info/entry_points.txt +0 -0
  25. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux.egg-info/requires.txt +0 -0
  26. {xulbux-1.6.4 → xulbux-1.6.5}/src/xulbux.egg-info/top_level.txt +0 -0
  27. {xulbux-1.6.4 → xulbux-1.6.5}/tests/test_color.py +0 -0
  28. {xulbux-1.6.4 → xulbux-1.6.5}/tests/test_color_types.py +0 -0
  29. {xulbux-1.6.4 → xulbux-1.6.5}/tests/test_console_info.py +0 -0
  30. {xulbux-1.6.4 → xulbux-1.6.5}/tests/test_data.py +0 -0
  31. {xulbux-1.6.4 → xulbux-1.6.5}/tests/test_env_vars.py +0 -0
  32. {xulbux-1.6.4 → xulbux-1.6.5}/tests/test_format_codes.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xulbux
3
- Version: 1.6.4
3
+ Version: 1.6.5
4
4
  Summary: A library which includes a lot of really helpful functions.
5
5
  Author-email: XulbuX <xulbux.real@gmail.com>
6
6
  License: MIT License
@@ -25,12 +25,12 @@ License: MIT License
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
27
 
28
- Project-URL: Bug Reports, https://github.com/XulbuX-dev/PythonLibraryXulbuX/issues
29
- Project-URL: Changelog, https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md
30
- Project-URL: Documentation, https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki
31
- Project-URL: Homepage, https://github.com/XulbuX-dev/PythonLibraryXulbuX
32
- Project-URL: License, https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/LICENSE
33
- Project-URL: Source Code, https://github.com/XulbuX-dev/PythonLibraryXulbuX/tree/main/src
28
+ Project-URL: Bug Reports, https://github.com/XulbuX/PythonLibraryXulbuX/issues
29
+ Project-URL: Changelog, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md
30
+ Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
31
+ Project-URL: Homepage, https://github.com/XulbuX/PythonLibraryXulbuX
32
+ Project-URL: License, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE
33
+ Project-URL: Source Code, https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src
34
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
35
35
  Classifier: Intended Audience :: Developers
36
36
  Classifier: Programming Language :: Python :: 3
@@ -57,8 +57,8 @@ Requires-Dist: flake8>=6.1.0; extra == "dev"
57
57
 
58
58
  **$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
59
59
 
60
- For precise information about the library, see the library's [Wiki page](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki).<br>
61
- For the libraries latest changes, see the [change log](https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
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).
62
62
 
63
63
 
64
64
  ## Installation
@@ -90,17 +90,17 @@ from xulbux import rgba, hsla, hexa
90
90
 
91
91
  | | |
92
92
  | :--------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
93
- | <h3>[`xx_code`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
94
- | <h3>[`xx_color`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
95
- | <h3>[`xx_console`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
96
- | <h3>[`xx_data`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_data)</h3> | advanced operations with data structures (*compare, generate path ID's, pretty print/format, ...*) |
97
- | <h3>[`xx_env_path`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_env_path)</h3> | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
98
- | <h3>[`xx_file`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
99
- | <h3>[`xx_format_codes`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_format_codes)</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
93
+ | <h3>[`xx_code`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
94
+ | <h3>[`xx_color`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
95
+ | <h3>[`xx_console`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
96
+ | <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, ...*) |
97
+ | <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, ...*) |
98
+ | <h3>[`xx_file`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
99
+ | <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, ...*) |
100
100
  | <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
101
101
  | <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
102
102
  | <h3>`xx_regex`</h3> | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
103
- | <h3>[`xx_string`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
103
+ | <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
104
104
  | <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
105
105
 
106
106
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  **$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
4
4
 
5
- For precise information about the library, see the library's [Wiki page](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki).<br>
6
- For the libraries latest changes, see the [change log](https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
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
7
 
8
8
 
9
9
  ## Installation
@@ -35,17 +35,17 @@ from xulbux import rgba, hsla, hexa
35
35
 
36
36
  | | |
37
37
  | :--------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
38
- | <h3>[`xx_code`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
39
- | <h3>[`xx_color`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
40
- | <h3>[`xx_console`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
41
- | <h3>[`xx_data`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_data)</h3> | advanced operations with data structures (*compare, generate path ID's, pretty print/format, ...*) |
42
- | <h3>[`xx_env_path`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_env_path)</h3> | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
43
- | <h3>[`xx_file`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
44
- | <h3>[`xx_format_codes`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_format_codes)</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
38
+ | <h3>[`xx_code`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
39
+ | <h3>[`xx_color`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
40
+ | <h3>[`xx_console`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
41
+ | <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, ...*) |
42
+ | <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, ...*) |
43
+ | <h3>[`xx_file`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
44
+ | <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, ...*) |
45
45
  | <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
46
46
  | <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
47
47
  | <h3>`xx_regex`</h3> | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
48
- | <h3>[`xx_string`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
48
+ | <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
49
49
  | <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
50
50
 
51
51
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xulbux"
7
- version = "1.6.4"
7
+ version = "1.6.5"
8
8
  authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
9
9
  description = "A library which includes a lot of really helpful functions."
10
10
  readme = "README.md"
@@ -63,12 +63,12 @@ keywords = [
63
63
  ]
64
64
 
65
65
  [project.urls]
66
- "Bug Reports" = "https://github.com/XulbuX-dev/PythonLibraryXulbuX/issues"
67
- "Changelog" = "https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md"
68
- "Documentation" = "https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki"
69
- "Homepage" = "https://github.com/XulbuX-dev/PythonLibraryXulbuX"
70
- "License" = "https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/LICENSE"
71
- "Source Code" = "https://github.com/XulbuX-dev/PythonLibraryXulbuX/tree/main/src"
66
+ "Bug Reports" = "https://github.com/XulbuX/PythonLibraryXulbuX/issues"
67
+ "Changelog" = "https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md"
68
+ "Documentation" = "https://github.com/XulbuX/PythonLibraryXulbuX/wiki"
69
+ "Homepage" = "https://github.com/XulbuX/PythonLibraryXulbuX"
70
+ "License" = "https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE"
71
+ "Source Code" = "https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src"
72
72
 
73
73
 
74
74
  [project.scripts]
@@ -19,12 +19,12 @@
19
19
  • REGEX PATTERN TEMPLATES xx.Regex
20
20
  """
21
21
 
22
- __version__ = "1.6.4"
22
+ __version__ = "1.6.5"
23
23
  __author__ = "XulbuX"
24
24
  __email__ = "xulbux.real@gmail.com"
25
25
  __license__ = "MIT"
26
26
  __copyright__ = "Copyright (c) 2024 XulbuX"
27
- __url__ = "https://github.com/XulbuX-dev/PythonLibraryXulbuX"
27
+ __url__ = "https://github.com/XulbuX/PythonLibraryXulbuX"
28
28
  __description__ = "A library which includes a lot of really helpful functions."
29
29
  __all__ = [
30
30
  "_consts_",
@@ -85,7 +85,7 @@ class ANSI:
85
85
  ]
86
86
 
87
87
  codes_map: dict[str | tuple[str], int] = {
88
- ###################### RESETS ######################
88
+ ################# SPECIFIC RESETS ##################
89
89
  "_": 0,
90
90
  ("_bold", "_b"): 22,
91
91
  ("_dim", "_d"): 22,
@@ -97,7 +97,7 @@ class ANSI:
97
97
  ("_strikethrough", "_s"): 29,
98
98
  ("_color", "_c"): 39,
99
99
  ("_background", "_bg"): 49,
100
- ################### TEXT FORMATS ###################
100
+ ################### TEXT STYLES ####################
101
101
  ("bold", "b"): 1,
102
102
  ("dim", "d"): 2,
103
103
  ("italic", "i"): 3,
@@ -106,7 +106,7 @@ class ANSI:
106
106
  ("hidden", "hide", "h"): 8,
107
107
  ("strikethrough", "s"): 9,
108
108
  ("double-underline", "du"): 21,
109
- ############## DEFAULT CONSOLE COLORS ##############
109
+ ################## DEFAULT COLORS ##################
110
110
  "black": 30,
111
111
  "red": 31,
112
112
  "green": 32,
@@ -115,7 +115,7 @@ class ANSI:
115
115
  "magenta": 35,
116
116
  "cyan": 36,
117
117
  "white": 37,
118
- ########## BRIGHT DEFAULT CONSOLE COLORS ###########
118
+ ############## BRIGHT DEFAULT COLORS ###############
119
119
  "br:black": 90,
120
120
  "br:red": 91,
121
121
  "br:green": 92,
@@ -124,7 +124,7 @@ class ANSI:
124
124
  "br:magenta": 95,
125
125
  "br:cyan": 96,
126
126
  "br:white": 97,
127
- ######## DEFAULT CONSOLE BACKGROUND COLORS #########
127
+ ############ DEFAULT BACKGROUND COLORS #############
128
128
  "bg:black": 40,
129
129
  "bg:red": 41,
130
130
  "bg:green": 42,
@@ -133,7 +133,7 @@ class ANSI:
133
133
  "bg:magenta": 45,
134
134
  "bg:cyan": 46,
135
135
  "bg:white": 47,
136
- ##### BRIGHT DEFAULT CONSOLE BACKGROUND COLORS #####
136
+ ######### BRIGHT DEFAULT BACKGROUND COLORS #########
137
137
  "bg:br:black": 100,
138
138
  "bg:br:red": 101,
139
139
  "bg:br:green": 102,
@@ -75,25 +75,25 @@ class rgba:
75
75
  self.r, self.g, self.b = r, g, b
76
76
  self.a = None if a is None else (1.0 if a > 1.0 else float(a))
77
77
 
78
- def __len__(self):
78
+ def __len__(self) -> int:
79
79
  return 3 if self.a is None else 4
80
80
 
81
- def __iter__(self):
81
+ def __iter__(self) -> iter:
82
82
  return iter((self.r, self.g, self.b) + (() if self.a is None else (self.a,)))
83
83
 
84
- def __dict__(self):
84
+ def __dict__(self) -> dict:
85
85
  return self.dict()
86
86
 
87
- def __getitem__(self, index):
87
+ def __getitem__(self, index: int) -> int:
88
88
  return ((self.r, self.g, self.b) + (() if self.a is None else (self.a,)))[index]
89
89
 
90
- def __repr__(self):
90
+ def __repr__(self) -> str:
91
91
  return f'rgba({self.r}, {self.g}, {self.b}{"" if self.a is None else f", {self.a}"})'
92
92
 
93
- def __str__(self):
93
+ def __str__(self) -> str:
94
94
  return f'({self.r}, {self.g}, {self.b}{"" if self.a is None else f", {self.a}"})'
95
95
 
96
- def __eq__(self, other):
96
+ def __eq__(self, other: "rgba") -> bool:
97
97
  if not isinstance(other, rgba):
98
98
  return False
99
99
  return (self.r, self.g, self.b, self.a) == (
@@ -278,25 +278,25 @@ class hsla:
278
278
  self.h, self.s, self.l = h, s, l
279
279
  self.a = None if a is None else (1.0 if a > 1.0 else float(a))
280
280
 
281
- def __len__(self):
281
+ def __len__(self) -> int:
282
282
  return 3 if self.a is None else 4
283
283
 
284
- def __iter__(self):
284
+ def __iter__(self) -> iter:
285
285
  return iter((self.h, self.s, self.l) + (() if self.a is None else (self.a,)))
286
286
 
287
- def __dict__(self):
287
+ def __dict__(self) -> dict:
288
288
  return self.dict()
289
289
 
290
- def __getitem__(self, index):
290
+ def __getitem__(self, index: int) -> int:
291
291
  return ((self.h, self.s, self.l) + (() if self.a is None else (self.a,)))[index]
292
292
 
293
- def __repr__(self):
293
+ def __repr__(self) -> str:
294
294
  return f'hsla({self.h}, {self.s}, {self.l}{"" if self.a is None else f", {self.a}"})'
295
295
 
296
- def __str__(self):
296
+ def __str__(self) -> str:
297
297
  return f'({self.h}, {self.s}, {self.l}{"" if self.a is None else f", {self.a}"})'
298
298
 
299
- def __eq__(self, other):
299
+ def __eq__(self, other: "hsla") -> bool:
300
300
  if not isinstance(other, hsla):
301
301
  return False
302
302
  return (self.h, self.s, self.l, self.a) == (
@@ -504,29 +504,29 @@ class hexa:
504
504
  else:
505
505
  raise TypeError(f"HEX color must be of type 'str' or 'int': got '{type(color)}'")
506
506
 
507
- def __len__(self):
507
+ def __len__(self) -> int:
508
508
  return 3 if self.a is None else 4
509
509
 
510
- def __iter__(self):
510
+ def __iter__(self) -> iter:
511
511
  return iter(
512
512
  (f"{self.r:02X}", f"{self.g:02X}", f"{self.b:02X}") + (() if self.a is None else (f"{int(self.a * 255):02X}",))
513
513
  )
514
514
 
515
- def __dict__(self):
515
+ def __dict__(self) -> dict:
516
516
  return self.dict()
517
517
 
518
- def __getitem__(self, index):
518
+ def __getitem__(self, index: int) -> int:
519
519
  return (
520
520
  (f"{self.r:02X}", f"{self.g:02X}", f"{self.b:02X}") + (() if self.a is None else (f"{int(self.a * 255):02X}",))
521
521
  )[index]
522
522
 
523
- def __repr__(self):
523
+ def __repr__(self) -> str:
524
524
  return f'hexa(#{self.r:02X}{self.g:02X}{self.b:02X}{"" if self.a is None else f"{int(self.a * 255):02X}"})'
525
525
 
526
- def __str__(self):
526
+ def __str__(self) -> str:
527
527
  return f'#{self.r:02X}{self.g:02X}{self.b:02X}{"" if self.a is None else f"{int(self.a * 255):02X}"}'
528
528
 
529
- def __eq__(self, other):
529
+ def __eq__(self, other: "hexa") -> bool:
530
530
  if not isinstance(other, hexa):
531
531
  return False
532
532
  return (self.r, self.g, self.b, self.a) == (
@@ -914,9 +914,7 @@ class Color:
914
914
  return round(l * 100) if isinstance(output_type, int) else round(l * 255) if output_type is None else l
915
915
 
916
916
  @staticmethod
917
- def text_color_for_on_bg(
918
- text_bg_color: rgba | hexa = "#FFF",
919
- ) -> rgba | hexa:
917
+ def text_color_for_on_bg(text_bg_color: rgba | hexa) -> rgba | hexa:
920
918
  was_hexa, was_int = Color.is_valid_hexa(text_bg_color), isinstance(text_bg_color, int)
921
919
  text_bg_color = Color.to_rgba(text_bg_color)
922
920
  brightness = 0.2126 * text_bg_color[0] + 0.7152 * text_bg_color[1] + 0.0722 * text_bg_color[2]
@@ -105,7 +105,7 @@ class Console:
105
105
  - `title` -⠀the title of the log message (e.g. `DEBUG`, `WARN`, `FAIL`, etc.)
106
106
  - `prompt` -⠀the log message
107
107
  - `start` -⠀something to print before the log is printed
108
- - `end` -⠀something to print after the log is printed (e.g. `\\n\\n`)
108
+ - `end` -⠀something to print after the log is printed (e.g. `\\n`)
109
109
  - `title_bg_color` -⠀the background color of the `title`
110
110
  - `default_color` -⠀the default text color of the `prompt`\n
111
111
  --------------------------------------------------------------------------------
@@ -129,8 +129,8 @@ class Console:
129
129
  def debug(
130
130
  prompt: object = "Point in program reached.",
131
131
  active: bool = True,
132
- start: str = "\n",
133
- end: str = "\n\n",
132
+ start: str = "",
133
+ end: str = "\n",
134
134
  title_bg_color: hexa | rgba = DEFAULT.color["yellow"],
135
135
  default_color: hexa | rgba = DEFAULT.text_color,
136
136
  pause: bool = False,
@@ -145,8 +145,8 @@ class Console:
145
145
  @staticmethod
146
146
  def info(
147
147
  prompt: object = "Program running.",
148
- start: str = "\n",
149
- end: str = "\n\n",
148
+ start: str = "",
149
+ end: str = "\n",
150
150
  title_bg_color: hexa | rgba = DEFAULT.color["blue"],
151
151
  default_color: hexa | rgba = DEFAULT.text_color,
152
152
  pause: bool = False,
@@ -160,8 +160,8 @@ class Console:
160
160
  @staticmethod
161
161
  def done(
162
162
  prompt: object = "Program finished.",
163
- start: str = "\n",
164
- end: str = "\n\n",
163
+ start: str = "",
164
+ end: str = "\n",
165
165
  title_bg_color: hexa | rgba = DEFAULT.color["teal"],
166
166
  default_color: hexa | rgba = DEFAULT.text_color,
167
167
  pause: bool = False,
@@ -175,8 +175,8 @@ class Console:
175
175
  @staticmethod
176
176
  def warn(
177
177
  prompt: object = "Important message.",
178
- start: str = "\n",
179
- end: str = "\n\n",
178
+ start: str = "",
179
+ end: str = "\n",
180
180
  title_bg_color: hexa | rgba = DEFAULT.color["orange"],
181
181
  default_color: hexa | rgba = DEFAULT.text_color,
182
182
  pause: bool = False,
@@ -190,8 +190,8 @@ class Console:
190
190
  @staticmethod
191
191
  def fail(
192
192
  prompt: object = "Program error.",
193
- start: str = "\n",
194
- end: str = "\n\n",
193
+ start: str = "",
194
+ end: str = "\n",
195
195
  title_bg_color: hexa | rgba = DEFAULT.color["red"],
196
196
  default_color: hexa | rgba = DEFAULT.text_color,
197
197
  pause: bool = False,
@@ -206,8 +206,8 @@ class Console:
206
206
  @staticmethod
207
207
  def exit(
208
208
  prompt: object = "Program ended.",
209
- start: str = "\n",
210
- end: str = "\n\n",
209
+ start: str = "",
210
+ end: str = "\n",
211
211
  title_bg_color: hexa | rgba = DEFAULT.color["magenta"],
212
212
  default_color: hexa | rgba = DEFAULT.text_color,
213
213
  pause: bool = False,
@@ -219,10 +219,44 @@ class Console:
219
219
  Console.log("EXIT", prompt, start, end, title_bg_color, default_color)
220
220
  Console.pause_exit(pause, exit, reset_ansi=reset_ansi)
221
221
 
222
+ @staticmethod
223
+ def log_box(
224
+ *values: object,
225
+ start: str = "",
226
+ end: str = "\n",
227
+ box_bg_color: str | hexa | rgba = "green",
228
+ default_color: hexa | rgba = "#000",
229
+ _padding: int = 2,
230
+ ) -> None:
231
+ """Will print a box, containing a formatted log message:
232
+ - `*values` -⠀the box content (each value is on a new line)
233
+ - `start` -⠀something to print before the log box is printed
234
+ - `end` -⠀something to print after the log box is printed (e.g. `\\n`)
235
+ - `box_bg_color` -⠀the box's background color
236
+ - `default_color` -⠀the default text color of the `*values`\n
237
+ --------------------------------------------------------------------------------
238
+ The log message supports special formatting codes. For more detailed
239
+ information about formatting codes, see `xx_format_codes` class description."""
240
+ lines = [line for val in values for line in val.splitlines()]
241
+ unfmt_lines = [FormatCodes.remove_formatting(line) for line in lines]
242
+ max_line_len = max(len(line) for line in unfmt_lines)
243
+ lines = [
244
+ f"[bg:{box_bg_color}]{' ' * _padding}{line}{' ' * (_padding + max_line_len - len(unfmt))}[_bg]"
245
+ for line, unfmt in zip(lines, unfmt_lines)
246
+ ]
247
+ FormatCodes.print(
248
+ f"{start}[bg:{box_bg_color}]{(pad := " " * (max_line_len + (2 * _padding)))}[_bg]\n"
249
+ + "\n".join(lines)
250
+ + f"\n[bg:{box_bg_color}]{pad}[_]",
251
+ default_color=default_color,
252
+ sep="\n",
253
+ end=end,
254
+ )
255
+
222
256
  @staticmethod
223
257
  def confirm(
224
258
  prompt: object = "Do you want to continue?",
225
- start="\n",
259
+ start="",
226
260
  end="\n",
227
261
  default_color: hexa | rgba = DEFAULT.color["cyan"],
228
262
  default_is_yes: bool = True,
@@ -244,6 +278,9 @@ class Console:
244
278
  @staticmethod
245
279
  def restricted_input(
246
280
  prompt: object = "",
281
+ start="",
282
+ end="\n",
283
+ default_color: hexa | rgba = DEFAULT.color["cyan"],
247
284
  allowed_chars: str = CHARS.all,
248
285
  min_len: int = None,
249
286
  max_len: int = None,
@@ -258,7 +295,7 @@ class Console:
258
295
  -----------------------------------------------------------------------------------
259
296
  The input can be formatted with special formatting codes. For more detailed
260
297
  information about formatting codes, see the `xx_format_codes` description."""
261
- FormatCodes.print(prompt, end="", flush=True)
298
+ FormatCodes.print(start + prompt, default_color=default_color, end="")
262
299
  result = ""
263
300
  select_all = False
264
301
  last_line_count = 1
@@ -292,7 +329,7 @@ class Console:
292
329
  def handle_enter():
293
330
  if min_len is not None and len(result) < min_len:
294
331
  return False
295
- FormatCodes.print("[_]" if reset_ansi else "", flush=True)
332
+ FormatCodes.print(f"[_]{end}" if reset_ansi else end, default_color=default_color)
296
333
  return True
297
334
 
298
335
  def handle_backspace_delete():
@@ -356,6 +393,9 @@ class Console:
356
393
  @staticmethod
357
394
  def pwd_input(
358
395
  prompt: object = "Password: ",
396
+ start="",
397
+ end="\n",
398
+ default_color: hexa | rgba = DEFAULT.color["cyan"],
359
399
  allowed_chars: str = CHARS.standard_ascii,
360
400
  min_len: int = None,
361
401
  max_len: int = None,
@@ -363,4 +403,4 @@ class Console:
363
403
  ) -> str:
364
404
  """Password input (preset for `Console.restricted_input()`)
365
405
  that always masks the entered characters with asterisks."""
366
- return Console.restricted_input(prompt, allowed_chars, min_len, max_len, "*", _reset_ansi)
406
+ return Console.restricted_input(prompt, start, end, default_color, allowed_chars, min_len, max_len, "*", _reset_ansi)
@@ -381,10 +381,10 @@ class Data:
381
381
  data: DataStructure,
382
382
  indent: int = 4,
383
383
  compactness: int = 1,
384
- sep: str = ", ",
385
384
  max_width: int = 127,
386
- as_json: bool = False,
385
+ sep: str = ", ",
387
386
  end: str = "\n",
387
+ as_json: bool = False,
388
388
  ) -> None:
389
389
  """Print nicely formatted data structures.\n
390
390
  ------------------------------------------------------------------------------
@@ -407,8 +407,8 @@ class Data:
407
407
  data: DataStructure,
408
408
  indent: int = 4,
409
409
  compactness: int = 1,
410
- sep: str = ", ",
411
410
  max_width: int = 127,
411
+ sep: str = ", ",
412
412
  as_json: bool = False,
413
413
  ) -> str:
414
414
  """Get nicely formatted data structure-strings.\n
@@ -53,7 +53,7 @@ class File:
53
53
  """Tries to find the file and extend the path to be absolute and if the file was not found:\n
54
54
  Generate the absolute path to the file in the CWD or the running program's base-directory.\n
55
55
  ----------------------------------------------------------------------------------------------
56
- If the `file` is not found in the above directories, it will be searched in the `search_in`
56
+ If the `file` is not found in predefined directories, it will be searched in the `search_in`
57
57
  directory/directories. If the file is still not found, it will return the path to the file in
58
58
  the base-dir per default or to the file in the CWD if `prefer_base_dir` is set to `False`.\n
59
59
  ----------------------------------------------------------------------------------------------
@@ -173,6 +173,7 @@ _PREFIX_RX = {
173
173
  _COMPILED = { # PRECOMPILE REGULAR EXPRESSIONS
174
174
  "*": _re.compile(r"\[\s*([^]_]*?)\s*\*\s*([^]_]*?)\]"),
175
175
  "*color": _re.compile(r"\[\s*([^]_]*?)\s*\*color\s*([^]_]*?)\]"),
176
+ "ansi_seq": _re.compile(ANSI.char + r"(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])"),
176
177
  "formatting": _rx.compile(
177
178
  Regex.brackets("[", "]", is_group=True)
178
179
  + r"(?:\s*([/\\]?)\s*"
@@ -246,6 +247,8 @@ class FormatCodes:
246
247
  -------------------------------------------------------------------------
247
248
  For exact information about how to use special formatting codes, see the
248
249
  `xx_format_codes` module documentation."""
250
+ if not isinstance(string, str):
251
+ string = str(string)
249
252
  if Color.is_valid_rgba(default_color, False):
250
253
  use_default = True
251
254
  elif Color.is_valid_hexa(default_color, False):
@@ -325,9 +328,19 @@ class FormatCodes:
325
328
 
326
329
  @staticmethod
327
330
  def escape_ansi(ansi_string: str) -> str:
328
- """Escapes all ANSI codes in a string, so they are visible when output to the console."""
331
+ """Escapes all ANSI codes in the string, so they are visible when output to the console."""
329
332
  return ansi_string.replace(ANSI.char, ANSI.escaped_char)
330
333
 
334
+ @staticmethod
335
+ def remove_ansi(ansi_string: str) -> str:
336
+ """Removes all ANSI codes from the string."""
337
+ return _COMPILED["ansi_seq"].sub("", ansi_string)
338
+
339
+ @staticmethod
340
+ def remove_formatting(string: str) -> str:
341
+ """Removes all formatting codes from the string."""
342
+ return _COMPILED["ansi_seq"].sub("", FormatCodes.to_ansi(string))
343
+
331
344
  @staticmethod
332
345
  def __config_console() -> None:
333
346
  """Configure the console to be able to interpret ANSI formatting."""
@@ -75,12 +75,11 @@ class String:
75
75
 
76
76
  @staticmethod
77
77
  def escape(string: str, str_quotes: str = '"') -> str:
78
- """Escapes the special characters and quotes inside a string.\n
79
- ---------------------------------------------------------------------------
80
- `str_quotes` can be either `"` or `'` and should match the quotes,
81
- the string will be put inside of. So if your string will be `"string"`,
82
- you should pass `"` to the parameter `str_quotes`.
83
- That way, if the string includes the same quotes, they will be escaped."""
78
+ """Escapes Python's special characters (e.g. `\n`, `\t`, ...) and quotes inside the string.\n
79
+ ----------------------------------------------------------------------------------------------
80
+ `str_quotes` can be either `"` or `'` and should match the quotes, the string will be put
81
+ inside of. So if your string will be `"string"`, you should pass `"` to the parameter
82
+ `str_quotes`. That way, if the string includes the same quotes, they will be escaped."""
84
83
  string = (
85
84
  string.replace("\\", r"\\")
86
85
  .replace("\n", r"\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: xulbux
3
- Version: 1.6.4
3
+ Version: 1.6.5
4
4
  Summary: A library which includes a lot of really helpful functions.
5
5
  Author-email: XulbuX <xulbux.real@gmail.com>
6
6
  License: MIT License
@@ -25,12 +25,12 @@ License: MIT License
25
25
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
26
  SOFTWARE.
27
27
 
28
- Project-URL: Bug Reports, https://github.com/XulbuX-dev/PythonLibraryXulbuX/issues
29
- Project-URL: Changelog, https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md
30
- Project-URL: Documentation, https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki
31
- Project-URL: Homepage, https://github.com/XulbuX-dev/PythonLibraryXulbuX
32
- Project-URL: License, https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/LICENSE
33
- Project-URL: Source Code, https://github.com/XulbuX-dev/PythonLibraryXulbuX/tree/main/src
28
+ Project-URL: Bug Reports, https://github.com/XulbuX/PythonLibraryXulbuX/issues
29
+ Project-URL: Changelog, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md
30
+ Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
31
+ Project-URL: Homepage, https://github.com/XulbuX/PythonLibraryXulbuX
32
+ Project-URL: License, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE
33
+ Project-URL: Source Code, https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src
34
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
35
35
  Classifier: Intended Audience :: Developers
36
36
  Classifier: Programming Language :: Python :: 3
@@ -57,8 +57,8 @@ Requires-Dist: flake8>=6.1.0; extra == "dev"
57
57
 
58
58
  **$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
59
59
 
60
- For precise information about the library, see the library's [Wiki page](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki).<br>
61
- For the libraries latest changes, see the [change log](https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
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).
62
62
 
63
63
 
64
64
  ## Installation
@@ -90,17 +90,17 @@ from xulbux import rgba, hsla, hexa
90
90
 
91
91
  | | |
92
92
  | :--------------------------------------------------------------------------------------------------: | :------------------------------------------------------------------------------------------------- |
93
- | <h3>[`xx_code`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
94
- | <h3>[`xx_color`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
95
- | <h3>[`xx_console`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
96
- | <h3>[`xx_data`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_data)</h3> | advanced operations with data structures (*compare, generate path ID's, pretty print/format, ...*) |
97
- | <h3>[`xx_env_path`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_env_path)</h3> | getting and editing the PATH variable (*get paths, check for paths, add paths, ...*) |
98
- | <h3>[`xx_file`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
99
- | <h3>[`xx_format_codes`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_format_codes)</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
93
+ | <h3>[`xx_code`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_code)</h3> | advanced code-string operations (*changing the indent, finding function calls, ...*) |
94
+ | <h3>[`xx_color`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_color)</h3> | everything around colors (*converting, blending, searching colors in strings, ...*) |
95
+ | <h3>[`xx_console`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_console)</h3> | advanced actions related to the console (*pretty logging, advanced inputs, ...*) |
96
+ | <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, ...*) |
97
+ | <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, ...*) |
98
+ | <h3>[`xx_file`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_file)</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
99
+ | <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, ...*) |
100
100
  | <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
101
101
  | <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
102
102
  | <h3>`xx_regex`</h3> | generated regex pattern-templates (*match bracket- and quote pairs, match colors, ...*) |
103
- | <h3>[`xx_string`](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
103
+ | <h3>[`xx_string`](https://github.com/XulbuX/PythonLibraryXulbuX/wiki/xx_string)</h3> | helpful actions when working with strings. (*normalize, escape, decompose, ...*) |
104
104
  | <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
105
105
 
106
106
 
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes