xulbux 1.5.8__py3-none-any.whl → 1.5.9__py3-none-any.whl
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/__init__.py +2 -2
- xulbux/_cli_.py +3 -2
- xulbux/_consts_.py +1 -0
- xulbux/xx_code.py +3 -3
- xulbux/xx_color.py +11 -15
- xulbux/xx_file.py +23 -23
- xulbux/xx_format_codes.py +53 -33
- xulbux/xx_json.py +2 -2
- xulbux/xx_regex.py +7 -10
- xulbux/xx_string.py +60 -72
- xulbux-1.5.9.dist-info/METADATA +110 -0
- xulbux-1.5.9.dist-info/RECORD +21 -0
- {xulbux-1.5.8.dist-info → xulbux-1.5.9.dist-info}/WHEEL +2 -1
- xulbux-1.5.9.dist-info/top_level.txt +1 -0
- xulbux-1.5.8.dist-info/METADATA +0 -101
- xulbux-1.5.8.dist-info/RECORD +0 -20
- {xulbux-1.5.8.dist-info/licenses → xulbux-1.5.9.dist-info}/LICENSE +0 -0
- {xulbux-1.5.8.dist-info → xulbux-1.5.9.dist-info}/entry_points.txt +0 -0
xulbux/__init__.py
CHANGED
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
• REGEX PATTERN TEMPLATES xx.Regex
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
__version__ = "1.5.
|
|
22
|
+
__version__ = "1.5.9"
|
|
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/
|
|
27
|
+
__url__ = "https://github.com/XulbuX-dev/PythonLibraryXulbuX"
|
|
28
28
|
__description__ = "A library which includes a lot of really helpful functions."
|
|
29
29
|
__all__ = [
|
|
30
30
|
"_consts_",
|
xulbux/_cli_.py
CHANGED
|
@@ -32,7 +32,7 @@ def help_command():
|
|
|
32
32
|
[dim](•) CUSTOM TYPES:
|
|
33
33
|
[dim](•) [{color['class']}]rgba[{color['punctuators']}]/([i|{color['types']}]int[_|{color['punctuators']}],[i|{color['types']}]int[_|{color['punctuators']}],[i|{color['types']}]int[_|{color['punctuators']}],[i|{color['types']}]float[_|{color['punctuators']}])[*]
|
|
34
34
|
[dim](•) [{color['class']}]hsla[{color['punctuators']}]/([i|{color['types']}]int[_|{color['punctuators']}],[i|{color['types']}]int[_|{color['punctuators']}],[i|{color['types']}]int[_|{color['punctuators']}],[i|{color['types']}]float[_|{color['punctuators']}])[*]
|
|
35
|
-
[dim](•) [{color['class']}]hexa[{color['punctuators']}]/([i|{color['types']}]str[_|{color['punctuators']}])[*]
|
|
35
|
+
[dim](•) [{color['class']}]hexa[{color['punctuators']}]/([i|{color['types']}]str[_|{color['punctuators']}]|[i|{color['types']}]int[_|{color['punctuators']}])[*]
|
|
36
36
|
[dim](•) PATH OPERATIONS [{color['lib']}]xx[{color['punctuators']}].[{color['class']}]Path[*]
|
|
37
37
|
[dim](•) FILE OPERATIONS [{color['lib']}]xx[{color['punctuators']}].[{color['class']}]File[*]
|
|
38
38
|
[dim](•) JSON FILE OPERATIONS [{color['lib']}]xx[{color['punctuators']}].[{color['class']}]Json[*]
|
|
@@ -47,6 +47,7 @@ def help_command():
|
|
|
47
47
|
[dim](•) REGEX PATTERN TEMPLATES [{color['lib']}]xx[{color['punctuators']}].[{color['class']}]Regex[*]
|
|
48
48
|
[_]
|
|
49
49
|
[dim](Press any key to exit...)
|
|
50
|
-
"""
|
|
50
|
+
""",
|
|
51
|
+
default_color=DEFAULT.text_color,
|
|
51
52
|
)
|
|
52
53
|
Console.pause_exit(pause=True)
|
xulbux/_consts_.py
CHANGED
xulbux/xx_code.py
CHANGED
|
@@ -16,7 +16,7 @@ class Code:
|
|
|
16
16
|
@staticmethod
|
|
17
17
|
def get_tab_spaces(code: str) -> int:
|
|
18
18
|
"""Will try to get the amount of spaces used for indentation."""
|
|
19
|
-
code_lines = String.
|
|
19
|
+
code_lines = String.get_lines(code, remove_empty_lines=True)
|
|
20
20
|
indents = [len(line) - len(line.lstrip()) for line in code_lines]
|
|
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
|
|
@@ -26,8 +26,8 @@ class Code:
|
|
|
26
26
|
"""Replaces all tabs with `new_tab_size` spaces.<br>
|
|
27
27
|
If `remove_empty_lines` is `True`, empty lines will be removed in the process.
|
|
28
28
|
"""
|
|
29
|
-
code_lines = String.
|
|
30
|
-
lines = code_lines if remove_empty_lines else String.
|
|
29
|
+
code_lines = String.get_lines(code, remove_empty_lines=True)
|
|
30
|
+
lines = code_lines if remove_empty_lines else String.get_lines(code)
|
|
31
31
|
tab_spaces = Code.get_tab_spaces(code)
|
|
32
32
|
if (tab_spaces == new_tab_size) or tab_spaces == 0:
|
|
33
33
|
if remove_empty_lines:
|
xulbux/xx_color.py
CHANGED
|
@@ -904,28 +904,25 @@ class Color:
|
|
|
904
904
|
|
|
905
905
|
@staticmethod
|
|
906
906
|
def text_color_for_on_bg(
|
|
907
|
-
|
|
907
|
+
text_bg_color: rgba | hexa = 0xFFF,
|
|
908
908
|
) -> rgba | hexa:
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
title_bg_color = Color.to_rgba(title_bg_color)
|
|
913
|
-
brightness = 0.2126 * title_bg_color[0] + 0.7152 * title_bg_color[1] + 0.0722 * title_bg_color[2]
|
|
909
|
+
was_hexa, was_int = Color.is_valid_hexa(text_bg_color), isinstance(text_bg_color, int)
|
|
910
|
+
text_bg_color = Color.to_rgba(text_bg_color)
|
|
911
|
+
brightness = 0.2126 * text_bg_color[0] + 0.7152 * text_bg_color[1] + 0.0722 * text_bg_color[2]
|
|
914
912
|
return (
|
|
915
|
-
(hexa(
|
|
913
|
+
(hexa("#FFF") if was_hexa else rgba(255, 255, 255))
|
|
916
914
|
if brightness < 128
|
|
917
|
-
else ((0x000 if was_int else hexa(
|
|
915
|
+
else ((0x000 if was_int else hexa("#000")) if was_hexa else rgba(0, 0, 0))
|
|
918
916
|
)
|
|
919
917
|
|
|
920
918
|
@staticmethod
|
|
921
|
-
def adjust_lightness(color: rgba | hexa,
|
|
919
|
+
def adjust_lightness(color: rgba | hexa, lightness_change: float) -> rgba | hexa:
|
|
922
920
|
"""In- or decrease the lightness of the input color.\n
|
|
923
921
|
----------------------------------------------------------------------------------------------------
|
|
924
922
|
**color** (rgba|hexa): HEX or RGBA color<br>
|
|
925
|
-
**
|
|
923
|
+
**lightness_change** (float): float between -1.0 (darken by `100%`) and 1.0 (lighten by `100%`)\n
|
|
926
924
|
----------------------------------------------------------------------------------------------------
|
|
927
|
-
**returns** (rgba|hexa): the adjusted color in the format of the input color
|
|
928
|
-
"""
|
|
925
|
+
**returns** (rgba|hexa): the adjusted color in the format of the input color"""
|
|
929
926
|
was_hexa = Color.is_valid_hexa(color)
|
|
930
927
|
color = Color.to_hsla(color)
|
|
931
928
|
h, s, l, a = (
|
|
@@ -934,7 +931,7 @@ class Color:
|
|
|
934
931
|
color[2],
|
|
935
932
|
color[3] if Color.has_alpha(color) else None,
|
|
936
933
|
)
|
|
937
|
-
l = int(max(0, min(100, l +
|
|
934
|
+
l = int(max(0, min(100, l + lightness_change * 100)))
|
|
938
935
|
return Color.to_hexa((h, s, l, a)) if was_hexa else Color.to_rgba((h, s, l, a))
|
|
939
936
|
|
|
940
937
|
@staticmethod
|
|
@@ -944,8 +941,7 @@ class Color:
|
|
|
944
941
|
**color** (rgba|hexa): HEX or RGBA color<br>
|
|
945
942
|
**saturation_change** (float): float between -1.0 (saturate by `100%`) and 1.0 (desaturate by `100%`)\n
|
|
946
943
|
---------------------------------------------------------------------------------------------------------
|
|
947
|
-
**returns** (rgba|hexa): the adjusted color in the format of the input color
|
|
948
|
-
"""
|
|
944
|
+
**returns** (rgba|hexa): the adjusted color in the format of the input color"""
|
|
949
945
|
was_hexa = Color.is_valid_hexa(color)
|
|
950
946
|
color = Color.to_hsla(color)
|
|
951
947
|
h, s, l, a = (
|
xulbux/xx_file.py
CHANGED
|
@@ -6,29 +6,6 @@ import os as _os
|
|
|
6
6
|
|
|
7
7
|
class File:
|
|
8
8
|
|
|
9
|
-
@staticmethod
|
|
10
|
-
def _make_path(
|
|
11
|
-
filename: str,
|
|
12
|
-
filetype: str,
|
|
13
|
-
search_in: str | list[str] = None,
|
|
14
|
-
prefer_base_dir: bool = True,
|
|
15
|
-
correct_path: bool = False,
|
|
16
|
-
) -> str:
|
|
17
|
-
"""Get the path to a file in the cwd, the base-dir, or predefined directories.\n
|
|
18
|
-
--------------------------------------------------------------------------------------
|
|
19
|
-
If the `filename` is not found in the above directories, it will be searched<br>
|
|
20
|
-
in the `search_in` directory/directories. If the file is still not found, it will<br>
|
|
21
|
-
return the path to the file in the base-dir per default or to the file in the<br>
|
|
22
|
-
cwd if `prefer_base_dir` is set to `False`."""
|
|
23
|
-
if not filename.lower().endswith(f".{filetype.lower()}"):
|
|
24
|
-
filename = f"{filename}.{filetype.lower()}"
|
|
25
|
-
try:
|
|
26
|
-
return Path.extend(filename, search_in, True, correct_path)
|
|
27
|
-
except FileNotFoundError:
|
|
28
|
-
return (
|
|
29
|
-
_os.path.join(Path.get(base_dir=True), filename) if prefer_base_dir else _os.path.join(_os.getcwd(), filename)
|
|
30
|
-
)
|
|
31
|
-
|
|
32
9
|
@staticmethod
|
|
33
10
|
def rename_extension(file_path: str, new_extension: str) -> str:
|
|
34
11
|
directory, filename_with_ext = _os.path.split(file_path)
|
|
@@ -54,3 +31,26 @@ class File:
|
|
|
54
31
|
f.write(content)
|
|
55
32
|
full_path = _os.path.abspath(file)
|
|
56
33
|
return full_path
|
|
34
|
+
|
|
35
|
+
@staticmethod
|
|
36
|
+
def make_path(
|
|
37
|
+
filename: str,
|
|
38
|
+
filetype: str,
|
|
39
|
+
search_in: str | list[str] = None,
|
|
40
|
+
prefer_base_dir: bool = True,
|
|
41
|
+
correct_path: bool = False,
|
|
42
|
+
) -> str:
|
|
43
|
+
"""Create the path to a file in the cwd, the base-dir, or predefined directories.\n
|
|
44
|
+
--------------------------------------------------------------------------------------
|
|
45
|
+
If the `filename` is not found in the above directories, it will be searched<br>
|
|
46
|
+
in the `search_in` directory/directories. If the file is still not found, it will<br>
|
|
47
|
+
return the path to the file in the base-dir per default or to the file in the<br>
|
|
48
|
+
cwd if `prefer_base_dir` is set to `False`."""
|
|
49
|
+
if not filename.lower().endswith(f".{filetype.lower()}"):
|
|
50
|
+
filename = f"{filename}.{filetype.lower()}"
|
|
51
|
+
try:
|
|
52
|
+
return Path.extend(filename, search_in, True, correct_path)
|
|
53
|
+
except FileNotFoundError:
|
|
54
|
+
return (
|
|
55
|
+
_os.path.join(Path.get(base_dir=True), filename) if prefer_base_dir else _os.path.join(_os.getcwd(), filename)
|
|
56
|
+
)
|
xulbux/xx_format_codes.py
CHANGED
|
@@ -124,7 +124,8 @@ class FormatCodes:
|
|
|
124
124
|
def to_ansi(
|
|
125
125
|
string: str, default_color: hexa | rgba = None, brightness_steps: int = 20, _default_start: bool = True
|
|
126
126
|
) -> str:
|
|
127
|
-
result = ""
|
|
127
|
+
result, bg_kwd, color_pref = string, {"bg"}, {"br", "bright"}
|
|
128
|
+
|
|
128
129
|
if Color.is_valid_rgba(default_color, False):
|
|
129
130
|
use_default = True
|
|
130
131
|
elif Color.is_valid_hexa(default_color, False):
|
|
@@ -135,32 +136,48 @@ class FormatCodes:
|
|
|
135
136
|
string = COMPILED["*"].sub(r"[\1_|default\2]", string) # REPLACE `[…|*|…]` WITH `[…|_|default|…]`
|
|
136
137
|
string = COMPILED["*color"].sub(r"[\1default\2]", string) # REPLACE `[…|*color|…]` WITH `[…|default|…]`
|
|
137
138
|
|
|
139
|
+
def is_valid_color(color: str) -> bool:
|
|
140
|
+
return color in ANSI.color_map or Color.is_valid_rgba(color) or Color.is_valid_hexa(color)
|
|
141
|
+
|
|
138
142
|
def replace_keys(match: _re.Match) -> str:
|
|
139
|
-
|
|
140
|
-
|
|
143
|
+
formats = match.group(1)
|
|
144
|
+
escaped = match.group(2)
|
|
141
145
|
auto_reset_txt = match.group(3)
|
|
142
|
-
if
|
|
146
|
+
if auto_reset_txt and auto_reset_txt.count("[") > 0 and auto_reset_txt.count("]") > 0:
|
|
147
|
+
auto_reset_txt = FormatCodes.to_ansi(auto_reset_txt, default_color, brightness_steps, False)
|
|
148
|
+
if not formats:
|
|
143
149
|
return match.group(0)
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
150
|
+
if formats.count("[") > 0 and formats.count("]") > 0:
|
|
151
|
+
formats = FormatCodes.to_ansi(formats, default_color, brightness_steps, False)
|
|
152
|
+
format_keys = [k.strip() for k in formats.split("|") if k.strip()]
|
|
153
|
+
ansi_formats = [
|
|
154
|
+
r if (r := FormatCodes.__get_replacement(k, default_color, brightness_steps)) != k else f"[{k}]"
|
|
155
|
+
for k in format_keys
|
|
156
|
+
]
|
|
157
|
+
if auto_reset_txt and not escaped:
|
|
158
|
+
reset_keys = []
|
|
159
|
+
for k in format_keys:
|
|
160
|
+
k_lower = k.lower()
|
|
161
|
+
k_parts = k_lower.split(":")
|
|
162
|
+
k_set = set(k_parts)
|
|
163
|
+
if bg_kwd & k_set and len(k_parts) <= 3:
|
|
164
|
+
if k_set & color_pref:
|
|
165
|
+
for i in range(len(k)):
|
|
166
|
+
if is_valid_color(k[i:]):
|
|
167
|
+
reset_keys.extend(["_bg", "_color"])
|
|
168
|
+
break
|
|
169
|
+
else:
|
|
170
|
+
for i in range(len(k)):
|
|
171
|
+
if is_valid_color(k[i:]):
|
|
172
|
+
reset_keys.append("_bg")
|
|
173
|
+
break
|
|
174
|
+
elif is_valid_color(k) or any(
|
|
175
|
+
k_lower.startswith(pref_colon := f"{prefix}:") and is_valid_color(k[len(pref_colon) :])
|
|
176
|
+
for prefix in color_pref
|
|
177
|
+
):
|
|
178
|
+
reset_keys.append("_color")
|
|
179
|
+
else:
|
|
180
|
+
reset_keys.append(f"_{k}")
|
|
164
181
|
ansi_resets = [
|
|
165
182
|
r
|
|
166
183
|
for k in reset_keys
|
|
@@ -170,24 +187,27 @@ class FormatCodes:
|
|
|
170
187
|
]
|
|
171
188
|
else:
|
|
172
189
|
ansi_resets = []
|
|
173
|
-
if not
|
|
190
|
+
if not (len(ansi_formats) == 1 and ansi_formats[0].count(f"{ANSI.char}{ANSI.start}") >= 1) and not all(
|
|
191
|
+
f.startswith(f"{ANSI.char}{ANSI.start}") for f in ansi_formats
|
|
192
|
+
):
|
|
174
193
|
return match.group(0)
|
|
175
194
|
return (
|
|
176
195
|
"".join(ansi_formats)
|
|
177
196
|
+ (
|
|
178
197
|
f"({FormatCodes.to_ansi(auto_reset_txt, default_color, brightness_steps, False)})"
|
|
179
|
-
if
|
|
198
|
+
if escaped and auto_reset_txt
|
|
180
199
|
else auto_reset_txt if auto_reset_txt else ""
|
|
181
200
|
)
|
|
182
|
-
+ ("" if
|
|
201
|
+
+ ("" if escaped else "".join(ansi_resets))
|
|
183
202
|
)
|
|
184
203
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
204
|
+
result = "\n".join(COMPILED["format"].sub(replace_keys, line) for line in string.split("\n"))
|
|
205
|
+
return (FormatCodes.__get_default_ansi(default_color) if _default_start else "") + result if use_default else result
|
|
206
|
+
|
|
207
|
+
@staticmethod
|
|
208
|
+
def escape_ansi(ansi_string: str, escaped_char: str = ANSI.char_esc) -> str:
|
|
209
|
+
"""Makes the string printable with the ANSI formats visible."""
|
|
210
|
+
return ansi_string.replace(ANSI.char, escaped_char)
|
|
191
211
|
|
|
192
212
|
@staticmethod
|
|
193
213
|
@lru_cache(maxsize=64)
|
xulbux/xx_json.py
CHANGED
|
@@ -22,7 +22,7 @@ class Json:
|
|
|
22
22
|
the the section from `comment_start` to `comment_end` is ignored.<br>
|
|
23
23
|
If `return_original` is set to `True`, the original JSON is returned<br>
|
|
24
24
|
additionally. (returns: `[processed_json, original_json]`)"""
|
|
25
|
-
file_path = File.
|
|
25
|
+
file_path = File.make_path(json_file, "json", prefer_base_dir=True)
|
|
26
26
|
with open(file_path, "r") as f:
|
|
27
27
|
content = f.read()
|
|
28
28
|
try:
|
|
@@ -42,7 +42,7 @@ class Json:
|
|
|
42
42
|
compactness: int = 1,
|
|
43
43
|
force: bool = False,
|
|
44
44
|
) -> str:
|
|
45
|
-
file_path = File.
|
|
45
|
+
file_path = File.make_path(new_file, "json", prefer_base_dir=True)
|
|
46
46
|
if _os.path.exists(file_path) and not force:
|
|
47
47
|
with open(file_path, "r", encoding="utf-8") as existing_f:
|
|
48
48
|
existing_content = _json.load(existing_f)
|
xulbux/xx_regex.py
CHANGED
|
@@ -22,16 +22,14 @@ class Regex:
|
|
|
22
22
|
**`quote`** the quote type (single or double)<br>
|
|
23
23
|
**`string`** everything inside the found quote pair\n
|
|
24
24
|
------------------------------------------------------------------------------------
|
|
25
|
-
**Attention:** Requires non standard library `regex` not standard library `re`!
|
|
26
|
-
"""
|
|
25
|
+
**Attention:** Requires non standard library `regex` not standard library `re`!"""
|
|
27
26
|
return r'(?P<quote>[\'"])(?P<string>(?:\\.|(?!\g<quote>).)*?)\g<quote>'
|
|
28
27
|
|
|
29
28
|
@staticmethod
|
|
30
29
|
def brackets(bracket1: str = "(", bracket2: str = ")", is_group: bool = False) -> str:
|
|
31
30
|
"""Matches everything inside brackets, including other nested brackets.\n
|
|
32
31
|
------------------------------------------------------------------------------------
|
|
33
|
-
**Attention:** Requires non standard library `regex` not standard library `re`!
|
|
34
|
-
"""
|
|
32
|
+
**Attention:** Requires non standard library `regex` not standard library `re`!"""
|
|
35
33
|
g, b1, b2 = (
|
|
36
34
|
"" if is_group else "?:",
|
|
37
35
|
_re.escape(bracket1) if len(bracket1) == 1 else bracket1,
|
|
@@ -51,10 +49,10 @@ class Regex:
|
|
|
51
49
|
is_group: bool = False,
|
|
52
50
|
) -> str:
|
|
53
51
|
"""Matches everything except `disallowed_pattern`, unless the `disallowed_pattern` is found inside a string (`'...'` or `"..."`).\n
|
|
54
|
-
|
|
55
|
-
The `ignore_pattern` is just always ignored. For example if `disallowed_pattern` is `>` and `ignore_pattern` is `->`, the
|
|
56
|
-
If `is_group` is `True`, you will be able to reference the matched
|
|
57
|
-
"""
|
|
52
|
+
------------------------------------------------------------------------------------------------------------------------------------
|
|
53
|
+
The `ignore_pattern` is just always ignored. For example if `disallowed_pattern` is `>` and `ignore_pattern` is `->`, the `->`<br>
|
|
54
|
+
-arrows will be allowed, even though they have `>` in them. If `is_group` is `True`, you will be able to reference the matched<br>
|
|
55
|
+
content as a group (e.g. <code>match.group(<i>int</i>)</code> or <code>r'\\<i>int</i>'</code>)."""
|
|
58
56
|
return rf'({"" if is_group else "?:"}(?:(?!{ignore_pattern}).)*(?:(?!{Regex.outside_strings(disallowed_pattern)}).)*)'
|
|
59
57
|
|
|
60
58
|
@staticmethod
|
|
@@ -64,8 +62,7 @@ class Regex:
|
|
|
64
62
|
**`2`** the function's arguments\n
|
|
65
63
|
If no `func_name` is given, it will match any function call.\n
|
|
66
64
|
------------------------------------------------------------------------------------
|
|
67
|
-
**Attention:** Requires non standard library `regex` not standard library `re`!
|
|
68
|
-
"""
|
|
65
|
+
**Attention:** Requires non standard library `regex` not standard library `re`!"""
|
|
69
66
|
return r"(?<=\b)(" + (func_name if func_name else r"[\w_]+") + r")\s*" + Regex.brackets("(", ")", is_group=True)
|
|
70
67
|
|
|
71
68
|
@staticmethod
|
xulbux/xx_string.py
CHANGED
|
@@ -5,36 +5,54 @@ class String:
|
|
|
5
5
|
|
|
6
6
|
@staticmethod
|
|
7
7
|
def to_type(string: str) -> any:
|
|
8
|
-
"""Will convert a string to
|
|
9
|
-
|
|
8
|
+
"""Will convert a string to the found type."""
|
|
9
|
+
string = string.strip() # Clean up whitespace
|
|
10
|
+
# BOOLEAN
|
|
11
|
+
if _re.match(r"(?i)^(true|false)$", string):
|
|
10
12
|
return string.lower() == "true"
|
|
11
|
-
|
|
13
|
+
# NONE
|
|
14
|
+
elif _re.match(r"(?i)^(none|null|undefined)$", string):
|
|
12
15
|
return None
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
elif
|
|
18
|
-
return
|
|
19
|
-
|
|
16
|
+
# INTEGER
|
|
17
|
+
elif _re.match(r"^-?\d+$", string):
|
|
18
|
+
return int(string)
|
|
19
|
+
# FLOAT
|
|
20
|
+
elif _re.match(r"^-?\d+\.\d+$", string):
|
|
21
|
+
return float(string)
|
|
22
|
+
# COMPLEX
|
|
23
|
+
elif _re.match(r"^(-?\d+(\.\d+)?[+-]\d+(\.\d+)?j)$", string):
|
|
24
|
+
return complex(string)
|
|
25
|
+
# QUOTED STRING
|
|
26
|
+
elif _re.match(r'^["\'](.*)["\']$', string):
|
|
27
|
+
return string[1:-1]
|
|
28
|
+
# BYTES
|
|
29
|
+
elif _re.match(r"^b['\"](.*)['\"]$", string):
|
|
30
|
+
return bytes(string[2:-1], "utf-8")
|
|
31
|
+
# LIST
|
|
32
|
+
elif _re.match(r"^\[(.*)\]$", string):
|
|
33
|
+
return [
|
|
34
|
+
String.to_type(item.strip()) for item in _re.findall(r"(?:[^,\[\]]+|\[.*?\]|\(.*?\)|\{.*?\})+", string[1:-1])
|
|
35
|
+
]
|
|
36
|
+
# TUPLE
|
|
37
|
+
elif _re.match(r"^\((.*)\)$", string):
|
|
38
|
+
return tuple(
|
|
39
|
+
String.to_type(item.strip()) for item in _re.findall(r"(?:[^,\(\)]+|\[.*?\]|\(.*?\)|\{.*?\})+", string[1:-1])
|
|
40
|
+
)
|
|
41
|
+
# DICTIONARY
|
|
42
|
+
elif _re.match(r"^\{(.*)\}$", string) and ":" in string:
|
|
20
43
|
return {
|
|
21
44
|
String.to_type(k.strip()): String.to_type(v.strip())
|
|
22
|
-
for k, v in
|
|
45
|
+
for k, v in _re.findall(
|
|
46
|
+
r"((?:[^:,{}]+|\[.*?\]|\(.*?\)|\{.*?\})+)\s*:\s*((?:[^:,{}]+|\[.*?\]|\(.*?\)|\{.*?\})+)", string[1:-1]
|
|
47
|
+
)
|
|
23
48
|
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
if string.startswith(("'", '"')) and string.endswith(("'", '"')): # STRING (WITH OR WITHOUT QUOTES)
|
|
32
|
-
return string[1:-1]
|
|
33
|
-
try: # COMPLEX
|
|
34
|
-
return complex(string)
|
|
35
|
-
except ValueError:
|
|
36
|
-
pass
|
|
37
|
-
return string # IF NOTHING ELSE MATCHES, RETURN AS IS
|
|
49
|
+
# SET
|
|
50
|
+
elif _re.match(r"^\{(.*?)\}$", string):
|
|
51
|
+
return {
|
|
52
|
+
String.to_type(item.strip()) for item in _re.findall(r"(?:[^,{}]+|\[.*?\]|\(.*?\)|\{.*?\})+", string[1:-1])
|
|
53
|
+
}
|
|
54
|
+
# RETURN AS IS (str)
|
|
55
|
+
return string
|
|
38
56
|
|
|
39
57
|
@staticmethod
|
|
40
58
|
def normalize_spaces(string: str, tab_spaces: int = 4) -> str:
|
|
@@ -87,8 +105,7 @@ class String:
|
|
|
87
105
|
@staticmethod
|
|
88
106
|
def single_char_repeats(string: str, char: str) -> int | bool:
|
|
89
107
|
"""If the string consists of only the same `char`, it returns the number of times it is present.<br>
|
|
90
|
-
If the string doesn't consist of only the same character, it returns `False`.
|
|
91
|
-
"""
|
|
108
|
+
If the string doesn't consist of only the same character, it returns `False`."""
|
|
92
109
|
if len(string) == len(char) * string.count(char):
|
|
93
110
|
return string.count(char)
|
|
94
111
|
else:
|
|
@@ -97,20 +114,27 @@ class String:
|
|
|
97
114
|
@staticmethod
|
|
98
115
|
def decompose(case_string: str, seps: str = "-_", lower_all: bool = True) -> list[str]:
|
|
99
116
|
"""Will decompose the string (*any type of casing, also mixed*) into parts."""
|
|
100
|
-
return [
|
|
117
|
+
return [
|
|
118
|
+
(part.lower() if lower_all else part)
|
|
119
|
+
for part in _re.split(rf"(?<=[a-z])(?=[A-Z])|[{_re.escape(seps)}]", case_string)
|
|
120
|
+
]
|
|
101
121
|
|
|
102
122
|
@staticmethod
|
|
103
|
-
def to_camel_case(string: str) -> str:
|
|
104
|
-
"""Will convert the string of any type of casing to
|
|
105
|
-
return
|
|
123
|
+
def to_camel_case(string: str, upper: bool = True) -> str:
|
|
124
|
+
"""Will convert the string of any type of casing to UpperCamelCase or lowerCamelCase if `upper` is false."""
|
|
125
|
+
return (
|
|
126
|
+
(parts := String.decompose(string))[0].lower()
|
|
127
|
+
if upper
|
|
128
|
+
else "" + "".join(part.capitalize() for part in (parts[1:] if upper else parts))
|
|
129
|
+
)
|
|
106
130
|
|
|
107
131
|
@staticmethod
|
|
108
|
-
def
|
|
109
|
-
"""Will convert the string of any type of casing to
|
|
110
|
-
return
|
|
132
|
+
def to_delimited_case(string: str, delimiter: str = "_", screaming: bool = False) -> str:
|
|
133
|
+
"""Will convert the string of any type of casing to casing delimited by `delimiter`."""
|
|
134
|
+
return delimiter.join(part.upper() if screaming else part for part in String.decompose(string))
|
|
111
135
|
|
|
112
136
|
@staticmethod
|
|
113
|
-
def
|
|
137
|
+
def get_lines(string: str, remove_empty_lines: bool = False) -> list[str]:
|
|
114
138
|
"""Will split the string into lines."""
|
|
115
139
|
if not remove_empty_lines:
|
|
116
140
|
return string.splitlines()
|
|
@@ -128,46 +152,10 @@ class String:
|
|
|
128
152
|
----------------------------------------------------------------------------------------------
|
|
129
153
|
If `max_consecutive` is `0`, it will remove all consecutive empty lines.<br>
|
|
130
154
|
If `max_consecutive` is bigger than `0`, it will only allow `max_consecutive` consecutive<br>
|
|
131
|
-
empty lines and everything above it will be cut down to `max_consecutive` empty lines.
|
|
132
|
-
"""
|
|
155
|
+
empty lines and everything above it will be cut down to `max_consecutive` empty lines."""
|
|
133
156
|
return _re.sub(r"(\n\s*){2,}", r"\1" * (max_consecutive + 1), string)
|
|
134
157
|
|
|
135
158
|
@staticmethod
|
|
136
159
|
def split_count(string: str, count: int) -> list[str]:
|
|
137
160
|
"""Will split the string every `count` characters."""
|
|
138
161
|
return [string[i : i + count] for i in range(0, len(string), count)]
|
|
139
|
-
|
|
140
|
-
@staticmethod
|
|
141
|
-
def multi_strip(string: str, strip_chars: str = " _-") -> str:
|
|
142
|
-
"""Will remove all leading and trailing `strip_chars` from the string."""
|
|
143
|
-
for char in string:
|
|
144
|
-
if char in strip_chars:
|
|
145
|
-
string = string[1:]
|
|
146
|
-
else:
|
|
147
|
-
break
|
|
148
|
-
for char in string[::-1]:
|
|
149
|
-
if char in strip_chars:
|
|
150
|
-
string = string[:-1]
|
|
151
|
-
else:
|
|
152
|
-
break
|
|
153
|
-
return string
|
|
154
|
-
|
|
155
|
-
@staticmethod
|
|
156
|
-
def multi_lstrip(string: str, strip_chars: str = " _-") -> str:
|
|
157
|
-
"""Will remove all leading `strip_chars` from the string."""
|
|
158
|
-
for char in string:
|
|
159
|
-
if char in strip_chars:
|
|
160
|
-
string = string[1:]
|
|
161
|
-
else:
|
|
162
|
-
break
|
|
163
|
-
return string
|
|
164
|
-
|
|
165
|
-
@staticmethod
|
|
166
|
-
def multi_rstrip(string: str, strip_chars: str = " _-") -> str:
|
|
167
|
-
"""Will remove all trailing `strip_chars` from the string."""
|
|
168
|
-
for char in string[::-1]:
|
|
169
|
-
if char in strip_chars:
|
|
170
|
-
string = string[:-1]
|
|
171
|
-
else:
|
|
172
|
-
break
|
|
173
|
-
return string
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: xulbux
|
|
3
|
+
Version: 1.5.9
|
|
4
|
+
Summary: A library which includes a lot of really helpful functions.
|
|
5
|
+
Author-email: XulbuX <xulbux.real@gmail.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 XulbuX
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
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
|
|
34
|
+
Keywords: xulbux,python,library,utility,helper,functions,tools,classes,types,methods,cmd,code,color,data,structures,env,environment,file,format,json,path,regex,string,system,operations,presets
|
|
35
|
+
Classifier: Intended Audience :: Developers
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
41
|
+
Classifier: Operating System :: OS Independent
|
|
42
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
43
|
+
Requires-Python: >=3.10.0
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
License-File: LICENSE
|
|
46
|
+
Requires-Dist: keyboard>=0.13.5
|
|
47
|
+
Requires-Dist: mouse>=0.7.1
|
|
48
|
+
Requires-Dist: pyperclip>=1.9.0
|
|
49
|
+
Requires-Dist: regex>=2023.10.3
|
|
50
|
+
Provides-Extra: dev
|
|
51
|
+
Requires-Dist: pytest>=7.4.2; extra == "dev"
|
|
52
|
+
Requires-Dist: black>=23.7.0; extra == "dev"
|
|
53
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
54
|
+
Requires-Dist: flake8>=6.1.0; extra == "dev"
|
|
55
|
+
|
|
56
|
+
# **$\color{#8085FF}\Huge\textsf{XulbuX}$**
|
|
57
|
+
|
|
58
|
+
**$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
|
|
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).
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## Installation
|
|
65
|
+
|
|
66
|
+
To install the library and all its dependencies, open a console and run the command:
|
|
67
|
+
```prolog
|
|
68
|
+
pip install xulbux
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To upgrade the library to the latest available version, run the following command in your console:
|
|
72
|
+
```prolog
|
|
73
|
+
pip install --upgrade xulbux
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## Usage
|
|
78
|
+
|
|
79
|
+
Import the full library under the alias `xx`, so it's classes, types and functions are accessible with `xx.Class.method()`, `xx.type()` and `xx.function()`:
|
|
80
|
+
```python
|
|
81
|
+
import xulbux as xx
|
|
82
|
+
```
|
|
83
|
+
So you don't have to write `xx` in front of the library's types, you can import them directly:
|
|
84
|
+
```python
|
|
85
|
+
from xulbux import rgba, hsla, hexa
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
# Modules
|
|
90
|
+
|
|
91
|
+
| | |
|
|
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`</h3> | advanced working with files (*create files, rename file-extensions, ...*) |
|
|
99
|
+
| <h3>`xx_format_codes`</h3> | easy pretty printing with custom format codes (*print, inputs, custom format codes to ANSI, ...*) |
|
|
100
|
+
| <h3>`xx_json`</h3> | advanced working with json files (*read, create, update, ...*) |
|
|
101
|
+
| <h3>`xx_path`</h3> | advanced path operations (*get paths, smart-extend relative paths, delete paths, ...*) |
|
|
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, ...*) |
|
|
104
|
+
| <h3>`xx_system`</h3> | advanced system actions (*restart with message, check installed Python libs, ...*) |
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
<br>
|
|
108
|
+
|
|
109
|
+
--------------------------------------------------------------
|
|
110
|
+
[View this library on PyPI](https://pypi.org/project/XulbuX/)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
xulbux/__init__.py,sha256=1I5Hbze_27gyM9k1JJ_JZdVUV8EM-7zQrNNpbvUtToE,1658
|
|
2
|
+
xulbux/_cli_.py,sha256=U25ZrtpQgpKXtvOSTBBbh7-AJ_WTeZ95A66DQARAqzo,3558
|
|
3
|
+
xulbux/_consts_.py,sha256=2-swueg8B5retfsAQqmR8nFNc06tqAwpL__TOv3V4kw,4882
|
|
4
|
+
xulbux/xx_code.py,sha256=dAksTh2Fw6-XTIGn8eEJVUlvJOsrWbctDZJDk4cs8FQ,5137
|
|
5
|
+
xulbux/xx_color.py,sha256=AqMqPCwDQZVQwkQUM0IOO47GzKNhKapoCwDifs-ewI8,44906
|
|
6
|
+
xulbux/xx_console.py,sha256=Xzl73_LTyt9AW09KAV9tsGdEdiltxPJwJq9nZChWrUQ,15482
|
|
7
|
+
xulbux/xx_data.py,sha256=cwjJeQHwf-b9yE6UTI0DO7US-hWtgTmIdvwKH5KKtmI,25969
|
|
8
|
+
xulbux/xx_env_path.py,sha256=ITdJ4DKh1zAvZrV5kph1z0jUDBhwEtOP4u1OKW0hMts,4309
|
|
9
|
+
xulbux/xx_file.py,sha256=nO2FtxqlBaW84L-qiTcQf16Im2xD-ZKPAytJDG4RCRw,2618
|
|
10
|
+
xulbux/xx_format_codes.py,sha256=NIleZ9TrXdF0i9UMCZP7ZI_k1ChJjYlHCFAcHZHHq2c,14891
|
|
11
|
+
xulbux/xx_json.py,sha256=1xAYBmpb4o8hOS_TaMQW2E5pZdE1YqbUdSJm-53wm-s,5054
|
|
12
|
+
xulbux/xx_path.py,sha256=KB1HGYCxFB3_T97RVACajy3-QiksbviZVIW9-iQcr4s,4558
|
|
13
|
+
xulbux/xx_regex.py,sha256=-dU1x4GDhFKEg0uQPT6uw9Yyo0vo7f98TtlicG9uBJo,7872
|
|
14
|
+
xulbux/xx_string.py,sha256=SC5Wn-rp601sre5cTFCVrvKeHr6v1Y_GIkqMcLWF4b0,7128
|
|
15
|
+
xulbux/xx_system.py,sha256=yehO57ggWDRJbeFoTE1VisW4QrbkqZzAyjKoL3xHx9k,3935
|
|
16
|
+
xulbux-1.5.9.dist-info/LICENSE,sha256=6NflEcvzFEe8_JFVNCPVwZBwBhlLLd4vqQi8WiX_Xk4,1084
|
|
17
|
+
xulbux-1.5.9.dist-info/METADATA,sha256=Exj7GULPxlgsB9PlaASWXeD9JX4wPmy1pnasSp7vR3A,6836
|
|
18
|
+
xulbux-1.5.9.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
19
|
+
xulbux-1.5.9.dist-info/entry_points.txt,sha256=a3womfLIMZKnOFiyy-xnVb4g2qkZsHR5FbKKkljcGns,94
|
|
20
|
+
xulbux-1.5.9.dist-info/top_level.txt,sha256=FkK4EZajwfP36fnlrPaR98OrEvZpvdEOdW1T5zTj6og,7
|
|
21
|
+
xulbux-1.5.9.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
xulbux
|
xulbux-1.5.8.dist-info/METADATA
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.3
|
|
2
|
-
Name: xulbux
|
|
3
|
-
Version: 1.5.8
|
|
4
|
-
Summary: A library which includes a lot of really helpful functions.
|
|
5
|
-
Project-URL: Homepage, https://github.com/XulbuX-dev/PythonLibraryXulbuX
|
|
6
|
-
Project-URL: Bug Reports, https://github.com/XulbuX-dev/PythonLibraryXulbuX/issues
|
|
7
|
-
Project-URL: Documentation, https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki
|
|
8
|
-
Project-URL: Source Code, https://github.com/XulbuX-dev/PythonLibraryXulbuX/tree/main/src
|
|
9
|
-
Project-URL: Changelog, https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md
|
|
10
|
-
Author-email: XulbuX <xulbux.real@gmail.com>
|
|
11
|
-
License: MIT License
|
|
12
|
-
|
|
13
|
-
Copyright (c) 2024 XulbuX
|
|
14
|
-
|
|
15
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
-
in the Software without restriction, including without limitation the rights
|
|
18
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
-
furnished to do so, subject to the following conditions:
|
|
21
|
-
|
|
22
|
-
The above copyright notice and this permission notice shall be included in all
|
|
23
|
-
copies or substantial portions of the Software.
|
|
24
|
-
|
|
25
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
-
SOFTWARE.
|
|
32
|
-
Keywords: classes,cmd,code,color,data,env,environment,file,format,functions,helper,json,library,methods,operations,path,presets,python,regex,string,structures,system,tools,types,utility,xulbux
|
|
33
|
-
Classifier: Intended Audience :: Developers
|
|
34
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
-
Classifier: Operating System :: OS Independent
|
|
36
|
-
Classifier: Programming Language :: Python :: 3
|
|
37
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
-
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
41
|
-
Requires-Python: >=3.10.0
|
|
42
|
-
Requires-Dist: keyboard>=0.13.5
|
|
43
|
-
Requires-Dist: mouse>=0.7.1
|
|
44
|
-
Requires-Dist: pyperclip>=1.9.0
|
|
45
|
-
Requires-Dist: regex>=2023.10.3
|
|
46
|
-
Provides-Extra: dev
|
|
47
|
-
Requires-Dist: black>=23.7.0; extra == 'dev'
|
|
48
|
-
Requires-Dist: flake8>=6.1.0; extra == 'dev'
|
|
49
|
-
Requires-Dist: isort>=5.12.0; extra == 'dev'
|
|
50
|
-
Requires-Dist: pytest>=7.4.2; extra == 'dev'
|
|
51
|
-
Description-Content-Type: text/markdown
|
|
52
|
-
|
|
53
|
-
# **$\color{#8085FF}\Huge\textsf{XulbuX}$**
|
|
54
|
-
|
|
55
|
-
**$\color{#8085FF}\textsf{XulbuX}$** is a library which includes a lot of really helpful classes, types and functions.
|
|
56
|
-
|
|
57
|
-
For the libraries latest changes, see the [change log](https://github.com/XulbuX-dev/PythonLibraryXulbuX/blob/main/CHANGELOG.md).<br>
|
|
58
|
-
For precise information about the library, see the library's [Wiki page](https://github.com/XulbuX-dev/PythonLibraryXulbuX/wiki).
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## Installation
|
|
62
|
-
|
|
63
|
-
On all operating systems, run the following command:
|
|
64
|
-
```bash
|
|
65
|
-
pip install xulbux
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
## Usage
|
|
70
|
-
|
|
71
|
-
```python
|
|
72
|
-
# GENERAL LIBRARY
|
|
73
|
-
import xulbux as xx
|
|
74
|
-
# CUSTOM TYPES
|
|
75
|
-
from xulbux import rgba, hsla, hexa
|
|
76
|
-
```
|
|
77
|
-
The library **$\color{#8085FF}\textsf{XulbuX}$** (*below used as* `xx` *with above imported types*) contains the following modules:
|
|
78
|
-
```python
|
|
79
|
-
• CUSTOM TYPES:
|
|
80
|
-
• rgba(int,int,int,float)
|
|
81
|
-
• hsla(int,int,int,float)
|
|
82
|
-
• hexa(str)
|
|
83
|
-
• PATH OPERATIONS xx.Path
|
|
84
|
-
• FILE OPERATIONS xx.File
|
|
85
|
-
• JSON FILE OPERATIONS xx.Json
|
|
86
|
-
• SYSTEM ACTIONS xx.System
|
|
87
|
-
• MANAGE THE ENV PATH VAR xx.EnvPath
|
|
88
|
-
• CONSOLE LOG AND ACTIONS xx.Console
|
|
89
|
-
• EASY PRETTY PRINTING xx.FormatCodes
|
|
90
|
-
• WORKING WITH COLORS xx.Color
|
|
91
|
-
• DATA OPERATIONS xx.Data
|
|
92
|
-
• STRING OPERATIONS xx.String
|
|
93
|
-
• CODE STRING OPERATIONS xx.Code
|
|
94
|
-
• REGEX PATTERN TEMPLATES xx.Regex
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
<br>
|
|
99
|
-
|
|
100
|
-
--------------------------------------------------------------
|
|
101
|
-
[View this library on PyPI](https://pypi.org/project/XulbuX/)
|
xulbux-1.5.8.dist-info/RECORD
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
xulbux/__init__.py,sha256=yhdvShCcbcLeBfKckjurNcrkCHIj1wWEezgtQPbytGI,1672
|
|
2
|
-
xulbux/_cli_.py,sha256=zCa4dROOwJ3TPIH8ed1gezRj309ljGOAapICRqq4OKs,3464
|
|
3
|
-
xulbux/_consts_.py,sha256=HqBCzFYSk9LS2TrxPCQBQcEjEB8McLodH4ZGZ8yP3Ec,4858
|
|
4
|
-
xulbux/xx_code.py,sha256=v3fhHelqxFXtp2RI7sY7mXusRKdiyOEzy_rmrC3N-Os,5158
|
|
5
|
-
xulbux/xx_color.py,sha256=Ib_jVAYHl3uVUvWUv1jE_QHScNvIPgm9KxEl2xSJfQo,45019
|
|
6
|
-
xulbux/xx_console.py,sha256=Xzl73_LTyt9AW09KAV9tsGdEdiltxPJwJq9nZChWrUQ,15482
|
|
7
|
-
xulbux/xx_data.py,sha256=cwjJeQHwf-b9yE6UTI0DO7US-hWtgTmIdvwKH5KKtmI,25969
|
|
8
|
-
xulbux/xx_env_path.py,sha256=ITdJ4DKh1zAvZrV5kph1z0jUDBhwEtOP4u1OKW0hMts,4309
|
|
9
|
-
xulbux/xx_file.py,sha256=Zhlx7TZ0u2wcl_7khgpMCoqlrcfsbiOh03sj4nsuPaQ,2616
|
|
10
|
-
xulbux/xx_format_codes.py,sha256=hRQ4Vecw2TTa-g5pKshLP-pep_Da7iy38o879McCrOc,13547
|
|
11
|
-
xulbux/xx_json.py,sha256=Sz-UicwU2vdTud4itMV-ljqePzpNByu5WgnX4lEUVRc,5056
|
|
12
|
-
xulbux/xx_path.py,sha256=KB1HGYCxFB3_T97RVACajy3-QiksbviZVIW9-iQcr4s,4558
|
|
13
|
-
xulbux/xx_regex.py,sha256=ce-K62uk1nvayOvLAtMQSD-IwKiVu2IATj0s1C1u6pM,7956
|
|
14
|
-
xulbux/xx_string.py,sha256=cQOvektdBKKe4CuBw6VOoxTElayghk0SQPuLdMILn9A,7650
|
|
15
|
-
xulbux/xx_system.py,sha256=yehO57ggWDRJbeFoTE1VisW4QrbkqZzAyjKoL3xHx9k,3935
|
|
16
|
-
xulbux-1.5.8.dist-info/METADATA,sha256=B95tctbGYaeyy-_nvGssLk08OJNWaFUF1JeTD5_wi2A,4340
|
|
17
|
-
xulbux-1.5.8.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
18
|
-
xulbux-1.5.8.dist-info/entry_points.txt,sha256=a3womfLIMZKnOFiyy-xnVb4g2qkZsHR5FbKKkljcGns,94
|
|
19
|
-
xulbux-1.5.8.dist-info/licenses/LICENSE,sha256=6NflEcvzFEe8_JFVNCPVwZBwBhlLLd4vqQi8WiX_Xk4,1084
|
|
20
|
-
xulbux-1.5.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|