xulbux 1.5.5__py3-none-any.whl → 1.5.7__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 +20 -10
- xulbux/{__help__.py → _cli_.py} +15 -37
- xulbux/_consts_.py +108 -111
- xulbux/xx_cmd.py +245 -104
- xulbux/xx_code.py +28 -25
- xulbux/xx_color.py +330 -182
- xulbux/xx_data.py +214 -90
- xulbux/xx_env_vars.py +36 -23
- xulbux/xx_file.py +20 -14
- xulbux/xx_format_codes.py +154 -88
- xulbux/xx_json.py +36 -16
- xulbux/xx_path.py +38 -23
- xulbux/xx_regex.py +44 -27
- xulbux/xx_string.py +75 -47
- xulbux/xx_system.py +37 -26
- {xulbux-1.5.5.dist-info → xulbux-1.5.7.dist-info}/METADATA +14 -10
- xulbux-1.5.7.dist-info/RECORD +20 -0
- {xulbux-1.5.5.dist-info → xulbux-1.5.7.dist-info}/WHEEL +1 -1
- xulbux-1.5.7.dist-info/entry_points.txt +3 -0
- xulbux-1.5.5.dist-info/RECORD +0 -20
- xulbux-1.5.5.dist-info/entry_points.txt +0 -2
- {xulbux-1.5.5.dist-info → xulbux-1.5.7.dist-info}/licenses/LICENSE +0 -0
xulbux/__init__.py
CHANGED
|
@@ -19,19 +19,29 @@
|
|
|
19
19
|
• REGEX PATTERN TEMPLATES xx.Regex
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
__version__ =
|
|
23
|
-
__author__ =
|
|
24
|
-
__email__ =
|
|
25
|
-
__license__ =
|
|
26
|
-
__copyright__ =
|
|
27
|
-
__url__ =
|
|
28
|
-
__description__ =
|
|
22
|
+
__version__ = "1.5.7"
|
|
23
|
+
__author__ = "XulbuX"
|
|
24
|
+
__email__ = "xulbux.real@gmail.com"
|
|
25
|
+
__license__ = "MIT"
|
|
26
|
+
__copyright__ = "Copyright (c) 2024 XulbuX"
|
|
27
|
+
__url__ = "https://github.com/XulbuX-dev/Python/tree/main/Libraries/XulbuX"
|
|
28
|
+
__description__ = "A library which includes a lot of really helpful functions."
|
|
29
29
|
__all__ = [
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
"_consts_",
|
|
31
|
+
"xx_cmd",
|
|
32
|
+
"xx_code",
|
|
33
|
+
"xx_color",
|
|
34
|
+
"xx_data",
|
|
35
|
+
"xx_env_vars",
|
|
36
|
+
"xx_file",
|
|
37
|
+
"xx_format_codes",
|
|
38
|
+
"xx_json",
|
|
39
|
+
"xx_path",
|
|
40
|
+
"xx_regex",
|
|
41
|
+
"xx_string",
|
|
42
|
+
"xx_system",
|
|
32
43
|
]
|
|
33
44
|
|
|
34
|
-
from .__help__ import help
|
|
35
45
|
from ._consts_ import *
|
|
36
46
|
from .xx_cmd import *
|
|
37
47
|
from .xx_code import *
|
xulbux/{__help__.py → _cli_.py}
RENAMED
|
@@ -1,42 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
try: from .xx_cmd import *
|
|
6
|
-
except: from xx_cmd import *
|
|
1
|
+
from . import __version__
|
|
2
|
+
from ._consts_ import DEFAULT
|
|
3
|
+
from .xx_format_codes import *
|
|
4
|
+
from .xx_cmd import *
|
|
7
5
|
|
|
8
|
-
import os as _os
|
|
9
6
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def get_version(file:str = '__init__.py', var:str = '__version__') -> str:
|
|
14
|
-
try:
|
|
15
|
-
from . import var
|
|
16
|
-
return var
|
|
17
|
-
except ImportError:
|
|
18
|
-
init_path = _os.path.join(_os.path.dirname(__file__), file)
|
|
19
|
-
if _os.path.isfile(init_path):
|
|
20
|
-
with open(init_path, encoding='utf-8') as f:
|
|
21
|
-
for line in f:
|
|
22
|
-
if line.startswith(var): return line.split('=')[-1].strip().strip('\'"')
|
|
23
|
-
return 'unknown'
|
|
24
|
-
|
|
25
|
-
def help():
|
|
7
|
+
def help_command():
|
|
26
8
|
"""Show some info about the library, with a brief explanation of how to use it."""
|
|
27
9
|
color = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
10
|
+
"lib": DEFAULT.color["ice"],
|
|
11
|
+
"import": DEFAULT.color["red"],
|
|
12
|
+
"class": DEFAULT.color["lavender"],
|
|
13
|
+
"types": DEFAULT.color["lightblue"],
|
|
14
|
+
"punctuators": DEFAULT.color["darkgray"],
|
|
33
15
|
}
|
|
34
16
|
FormatCodes.print(
|
|
35
|
-
|
|
17
|
+
rf""" [_|b|#7075FF] __ __
|
|
36
18
|
[b|#7075FF] _ __ __ __/ / / /_ __ ___ __
|
|
37
19
|
[b|#7075FF] | |/ // / / / / / __ \/ / / | |/ /
|
|
38
|
-
[b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
|
|
39
|
-
[b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{DEFAULT.color['gray']}|#000] v[b]{
|
|
20
|
+
[b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
|
|
21
|
+
[b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{DEFAULT.color['gray']}|#000] v[b]{__version__} [*]
|
|
40
22
|
|
|
41
23
|
[i|{DEFAULT.color['coral']}]A TON OF COOL FUNCTIONS, YOU NEED![*]
|
|
42
24
|
|
|
@@ -65,10 +47,6 @@ def help():
|
|
|
65
47
|
[dim](•) REGEX PATTERN TEMPLATES [{color['lib']}]xx[{color['punctuators']}].[{color['class']}]Regex[*]
|
|
66
48
|
[_]
|
|
67
49
|
[dim](Press any key to exit...)
|
|
68
|
-
|
|
50
|
+
"""
|
|
51
|
+
)
|
|
69
52
|
Cmd.pause_exit(pause=True)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if __name__ == '__main__':
|
|
74
|
-
help()
|
xulbux/_consts_.py
CHANGED
|
@@ -1,147 +1,144 @@
|
|
|
1
1
|
class DEFAULT:
|
|
2
2
|
|
|
3
|
-
text_color:str =
|
|
4
|
-
color:dict[str,str] = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
3
|
+
text_color: str = "#95B5FF"
|
|
4
|
+
color: dict[str, str] = {
|
|
5
|
+
"white": "#F1F2FF",
|
|
6
|
+
"lightgray": "#B6B7C0",
|
|
7
|
+
"gray": "#7B7C8D",
|
|
8
|
+
"darkgray": "#67686C",
|
|
9
|
+
"black": "#202125",
|
|
10
|
+
"red": "#FF606A",
|
|
11
|
+
"coral": "#FF7069",
|
|
12
|
+
"orange": "#FF876A",
|
|
13
|
+
"tangerine": "#FF9962",
|
|
14
|
+
"gold": "#FFAF60",
|
|
15
|
+
"yellow": "#FFD260",
|
|
16
|
+
"green": "#7EE787",
|
|
17
|
+
"teal": "#50EAAF",
|
|
18
|
+
"cyan": "#3EE6DE",
|
|
19
|
+
"ice": "#77EFEF",
|
|
20
|
+
"lightblue": "#60AAFF",
|
|
21
|
+
"blue": "#8085FF",
|
|
22
|
+
"lavender": "#9B7DFF",
|
|
23
|
+
"purple": "#AD68FF",
|
|
24
|
+
"magenta": "#C860FF",
|
|
25
|
+
"pink": "#EE60BB",
|
|
26
|
+
"rose": "#FF6090",
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
|
|
32
30
|
class CHARS:
|
|
33
31
|
|
|
34
32
|
# CODE TO SIGNAL, ALL CHARACTERS ARE ALLOWED
|
|
35
|
-
all =
|
|
33
|
+
all = "<*allowed>"
|
|
36
34
|
|
|
37
35
|
# DIGIT SETS
|
|
38
|
-
digits =
|
|
39
|
-
float_digits =
|
|
40
|
-
hex_digits =
|
|
36
|
+
digits = "0123456789"
|
|
37
|
+
float_digits = digits + "."
|
|
38
|
+
hex_digits = digits + "#abcdefABCDEF"
|
|
41
39
|
|
|
42
40
|
# LETTER CATEGORIES
|
|
43
|
-
lowercase =
|
|
44
|
-
lowercase_extended =
|
|
45
|
-
uppercase =
|
|
46
|
-
uppercase_extended =
|
|
41
|
+
lowercase = "abcdefghijklmnopqrstuvwxyz"
|
|
42
|
+
lowercase_extended = lowercase + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
|
|
43
|
+
uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
44
|
+
uppercase_extended = uppercase + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
|
|
47
45
|
|
|
48
46
|
# COMBINED LETTER SETS
|
|
49
|
-
letters =
|
|
50
|
-
letters_extended =
|
|
47
|
+
letters = lowercase + uppercase
|
|
48
|
+
letters_extended = lowercase_extended + uppercase_extended
|
|
51
49
|
|
|
52
50
|
# ASCII sets
|
|
53
|
-
special_ascii =
|
|
54
|
-
special_ascii_extended =
|
|
55
|
-
standard_ascii =
|
|
56
|
-
full_ascii =
|
|
57
|
-
|
|
58
|
-
|
|
51
|
+
special_ascii = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
|
52
|
+
special_ascii_extended = special_ascii + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡±‗¾¶§÷¸°¨·¹³²■ "
|
|
53
|
+
standard_ascii = special_ascii + digits + letters
|
|
54
|
+
full_ascii = special_ascii_extended + digits + letters_extended
|
|
59
55
|
|
|
60
56
|
|
|
61
57
|
class ANSI:
|
|
62
58
|
|
|
63
59
|
global CHAR, START, SEP, END
|
|
64
60
|
|
|
65
|
-
CHAR
|
|
66
|
-
START = start =
|
|
67
|
-
SEP
|
|
68
|
-
END
|
|
61
|
+
CHAR = char = "\x1b"
|
|
62
|
+
START = start = "["
|
|
63
|
+
SEP = sep = ";"
|
|
64
|
+
END = end = "m"
|
|
65
|
+
modifier = {"lighten": "+l", "darken": "-d"}
|
|
69
66
|
|
|
70
|
-
def seq(parts:int = 1) -> str:
|
|
67
|
+
def seq(parts: int = 1) -> str:
|
|
71
68
|
"""Generate an ANSI sequence with `parts` amount of placeholders."""
|
|
72
|
-
return CHAR + START + SEP.join([
|
|
69
|
+
return CHAR + START + SEP.join(["{}" for _ in range(parts)]) + END
|
|
73
70
|
|
|
74
|
-
seq_color:str = CHAR + START +
|
|
75
|
-
seq_bg_color:str = CHAR + START +
|
|
71
|
+
seq_color: str = CHAR + START + "38" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
72
|
+
seq_bg_color: str = CHAR + START + "48" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
76
73
|
|
|
77
|
-
color_map:list[str] = [
|
|
74
|
+
color_map: list[str] = [
|
|
78
75
|
########### DEFAULT CONSOLE COLOR NAMES ############
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
76
|
+
"black",
|
|
77
|
+
"red",
|
|
78
|
+
"green",
|
|
79
|
+
"yellow",
|
|
80
|
+
"blue",
|
|
81
|
+
"magenta",
|
|
82
|
+
"cyan",
|
|
83
|
+
"white",
|
|
87
84
|
]
|
|
88
85
|
|
|
89
|
-
codes_map:dict[str|tuple[str], int] = {
|
|
86
|
+
codes_map: dict[str | tuple[str], int] = {
|
|
90
87
|
###################### RESETS ######################
|
|
91
|
-
|
|
92
|
-
(
|
|
93
|
-
(
|
|
94
|
-
(
|
|
95
|
-
(
|
|
96
|
-
(
|
|
97
|
-
(
|
|
98
|
-
(
|
|
99
|
-
(
|
|
100
|
-
(
|
|
101
|
-
(
|
|
88
|
+
"_": 0,
|
|
89
|
+
("_bold", "_b"): 22,
|
|
90
|
+
("_dim", "_d"): 22,
|
|
91
|
+
("_italic", "_i"): 23,
|
|
92
|
+
("_underline", "_u"): 24,
|
|
93
|
+
("_double-underline", "_du"): 24,
|
|
94
|
+
("_inverse", "_invert", "_in"): 27,
|
|
95
|
+
("_hidden", "_hide", "_h"): 28,
|
|
96
|
+
("_strikethrough", "_s"): 29,
|
|
97
|
+
("_color", "_c"): 39,
|
|
98
|
+
("_background", "_bg"): 49,
|
|
102
99
|
################### TEXT FORMATS ###################
|
|
103
|
-
(
|
|
104
|
-
(
|
|
105
|
-
(
|
|
106
|
-
(
|
|
107
|
-
(
|
|
108
|
-
(
|
|
109
|
-
(
|
|
110
|
-
(
|
|
100
|
+
("bold", "b"): 1,
|
|
101
|
+
("dim", "d"): 2,
|
|
102
|
+
("italic", "i"): 3,
|
|
103
|
+
("underline", "u"): 4,
|
|
104
|
+
("inverse", "invert", "in"): 7,
|
|
105
|
+
("hidden", "hide", "h"): 8,
|
|
106
|
+
("strikethrough", "s"): 9,
|
|
107
|
+
("double-underline", "du"): 21,
|
|
111
108
|
############## DEFAULT CONSOLE COLORS ##############
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
109
|
+
"black": 30,
|
|
110
|
+
"red": 31,
|
|
111
|
+
"green": 32,
|
|
112
|
+
"yellow": 33,
|
|
113
|
+
"blue": 34,
|
|
114
|
+
"magenta": 35,
|
|
115
|
+
"cyan": 36,
|
|
116
|
+
"white": 37,
|
|
120
117
|
########## BRIGHT DEFAULT CONSOLE COLORS ###########
|
|
121
|
-
(
|
|
122
|
-
(
|
|
123
|
-
(
|
|
124
|
-
(
|
|
125
|
-
(
|
|
126
|
-
(
|
|
127
|
-
(
|
|
128
|
-
(
|
|
118
|
+
("bright:black", "br:black"): 90,
|
|
119
|
+
("bright:red", "br:red"): 91,
|
|
120
|
+
("bright:green", "br:green"): 92,
|
|
121
|
+
("bright:yellow", "br:yellow"): 93,
|
|
122
|
+
("bright:blue", "br:blue"): 94,
|
|
123
|
+
("bright:magenta", "br:magenta"): 95,
|
|
124
|
+
("bright:cyan", "br:cyan"): 96,
|
|
125
|
+
("bright:white", "br:white"): 97,
|
|
129
126
|
######## DEFAULT CONSOLE BACKGROUND COLORS #########
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
127
|
+
"bg:black": 40,
|
|
128
|
+
"bg:red": 41,
|
|
129
|
+
"bg:green": 42,
|
|
130
|
+
"bg:yellow": 43,
|
|
131
|
+
"bg:blue": 44,
|
|
132
|
+
"bg:magenta": 45,
|
|
133
|
+
"bg:cyan": 46,
|
|
134
|
+
"bg:white": 47,
|
|
138
135
|
##### BRIGHT DEFAULT CONSOLE BACKGROUND COLORS #####
|
|
139
|
-
(
|
|
140
|
-
(
|
|
141
|
-
(
|
|
142
|
-
(
|
|
143
|
-
(
|
|
144
|
-
(
|
|
145
|
-
(
|
|
146
|
-
(
|
|
136
|
+
("bg:bright:black", "bg:br:black"): 100,
|
|
137
|
+
("bg:bright:red", "bg:br:red"): 101,
|
|
138
|
+
("bg:bright:green", "bg:br:green"): 102,
|
|
139
|
+
("bg:bright:yellow", "bg:br:yellow"): 103,
|
|
140
|
+
("bg:bright:blue", "bg:br:blue"): 104,
|
|
141
|
+
("bg:bright:magenta", "bg:br:magenta"): 105,
|
|
142
|
+
("bg:bright:cyan", "bg:br:cyan"): 106,
|
|
143
|
+
("bg:bright:white", "bg:br:white"): 107,
|
|
147
144
|
}
|