xulbux 1.7.3__py3-none-any.whl → 1.8.1__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 +17 -19
- xulbux/{_consts_.py → base/consts.py} +51 -58
- xulbux/cli/help.py +45 -0
- xulbux/{xx_code.py → code.py} +3 -3
- xulbux/{xx_color.py → color.py} +1 -1
- xulbux/{xx_console.py → console.py} +358 -200
- xulbux/{xx_data.py → data.py} +14 -14
- xulbux/{xx_env_path.py → env_path.py} +1 -1
- xulbux/{xx_file.py → file.py} +1 -1
- xulbux/{xx_format_codes.py → format_codes.py} +21 -21
- xulbux/{xx_json.py → json.py} +3 -3
- xulbux/{xx_system.py → system.py} +11 -11
- xulbux-1.8.1.dist-info/METADATA +190 -0
- xulbux-1.8.1.dist-info/RECORD +20 -0
- xulbux-1.8.1.dist-info/entry_points.txt +2 -0
- xulbux/_cli_.py +0 -46
- xulbux-1.7.3.dist-info/METADATA +0 -173
- xulbux-1.7.3.dist-info/RECORD +0 -21
- xulbux-1.7.3.dist-info/entry_points.txt +0 -3
- xulbux-1.7.3.dist-info/licenses/LICENSE +0 -21
- /xulbux/{xx_path.py → path.py} +0 -0
- /xulbux/{xx_regex.py → regex.py} +0 -0
- /xulbux/{xx_string.py → string.py} +0 -0
- {xulbux-1.7.3.dist-info → xulbux-1.8.1.dist-info}/WHEEL +0 -0
- {xulbux-1.7.3.dist-info → xulbux-1.8.1.dist-info}/top_level.txt +0 -0
xulbux/__init__.py
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
|
-
__version__ = "1.
|
|
1
|
+
__version__ = "1.8.1"
|
|
2
|
+
|
|
2
3
|
__author__ = "XulbuX"
|
|
3
4
|
__email__ = "xulbux.real@gmail.com"
|
|
4
5
|
__license__ = "MIT"
|
|
5
6
|
__copyright__ = "Copyright (c) 2024 XulbuX"
|
|
6
7
|
__url__ = "https://github.com/XulbuX/PythonLibraryXulbuX"
|
|
7
|
-
__description__ = "A library which includes
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
"xx_path", "xx_regex", "xx_string", "xx_system"
|
|
11
|
-
]
|
|
8
|
+
__description__ = "A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler."
|
|
9
|
+
|
|
10
|
+
__all__ = ["Code", "Color", "Console", "Data", "EnvPath", "File", "FormatCodes", "Json", "Path", "Regex", "String", "System"]
|
|
12
11
|
|
|
13
|
-
from .
|
|
14
|
-
from .
|
|
15
|
-
from .
|
|
16
|
-
from .
|
|
17
|
-
from .
|
|
18
|
-
from .
|
|
19
|
-
from .
|
|
20
|
-
from .
|
|
21
|
-
from .
|
|
22
|
-
from .
|
|
23
|
-
from .
|
|
24
|
-
from .
|
|
25
|
-
from .xx_system import *
|
|
12
|
+
from .code import Code
|
|
13
|
+
from .color import Color
|
|
14
|
+
from .console import Console
|
|
15
|
+
from .data import Data
|
|
16
|
+
from .env_path import EnvPath
|
|
17
|
+
from .file import File
|
|
18
|
+
from .format_codes import FormatCodes
|
|
19
|
+
from .json import Json
|
|
20
|
+
from .path import Path
|
|
21
|
+
from .regex import Regex
|
|
22
|
+
from .string import String
|
|
23
|
+
from .system import System
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
1
|
from typing import TypeAlias
|
|
3
2
|
|
|
4
3
|
|
|
@@ -6,85 +5,79 @@ FormattableString: TypeAlias = str
|
|
|
6
5
|
"""A `str` object that is made to be formatted with the `.format()` method."""
|
|
7
6
|
|
|
8
7
|
|
|
9
|
-
@dataclass
|
|
10
8
|
class COLOR:
|
|
11
|
-
"""
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
rose = "#FF609F"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
class _AllTextCharacters:
|
|
43
|
-
pass
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@dataclass
|
|
9
|
+
"""Hexa color presets."""
|
|
10
|
+
|
|
11
|
+
WHITE = "#F1F2FF"
|
|
12
|
+
LIGHT_GRAY = "#B6B7C0"
|
|
13
|
+
GRAY = "#7B7C8D"
|
|
14
|
+
DARK_GRAY = "#67686C"
|
|
15
|
+
BLACK = "#202125"
|
|
16
|
+
RED = "#FF606A"
|
|
17
|
+
CORAL = "#FF7069"
|
|
18
|
+
ORANGE = "#FF876A"
|
|
19
|
+
TANGERINE = "#FF9962"
|
|
20
|
+
GOLD = "#FFAF60"
|
|
21
|
+
YELLOW = "#FFD260"
|
|
22
|
+
LIME = "#C9F16E"
|
|
23
|
+
GREEN = "#7EE787"
|
|
24
|
+
NEON_GREEN = "#4CFF85"
|
|
25
|
+
TEAL = "#50EAAF"
|
|
26
|
+
CYAN = "#3EDEE6"
|
|
27
|
+
ICE = "#77DBEF"
|
|
28
|
+
LIGHT_BLUE = "#60AAFF"
|
|
29
|
+
BLUE = "#8085FF"
|
|
30
|
+
LAVENDER = "#9B7DFF"
|
|
31
|
+
PURPLE = "#AD68FF"
|
|
32
|
+
MAGENTA = "#C860FF"
|
|
33
|
+
PINK = "#F162EF"
|
|
34
|
+
ROSE = "#FF609F"
|
|
35
|
+
|
|
36
|
+
|
|
47
37
|
class CHARS:
|
|
48
38
|
"""Text character sets."""
|
|
49
39
|
|
|
50
|
-
|
|
40
|
+
class _AllTextChars:
|
|
41
|
+
pass
|
|
42
|
+
|
|
43
|
+
ALL = _AllTextChars
|
|
51
44
|
"""Code to signal that all characters are allowed."""
|
|
52
45
|
|
|
53
|
-
|
|
46
|
+
DIGITS = "0123456789"
|
|
54
47
|
"""Digits: `0`-`9`"""
|
|
55
|
-
|
|
48
|
+
FLOAT_DIGITS = DIGITS + "."
|
|
56
49
|
"""Digits: `0`-`9` with decimal point `.`"""
|
|
57
|
-
|
|
50
|
+
HEX_DIGITS = DIGITS + "#abcdefABCDEF"
|
|
58
51
|
"""Digits: `0`-`9` Letters: `a`-`f` `A`-`F` and a hashtag `#`"""
|
|
59
52
|
|
|
60
|
-
|
|
53
|
+
LOWERCASE = "abcdefghijklmnopqrstuvwxyz"
|
|
61
54
|
"""Lowercase letters `a`-`z`"""
|
|
62
|
-
|
|
55
|
+
LOWERCASE_EXTENDED = LOWERCASE + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
|
|
63
56
|
"""Lowercase letters `a`-`z` with all lowercase diacritic letters."""
|
|
64
|
-
|
|
57
|
+
UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
65
58
|
"""Uppercase letters `A`-`Z`"""
|
|
66
|
-
|
|
59
|
+
UPPERCASE_EXTENDED = UPPERCASE + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
|
|
67
60
|
"""Uppercase letters `A`-`Z` with all uppercase diacritic letters."""
|
|
68
61
|
|
|
69
|
-
|
|
62
|
+
LETTERS = LOWERCASE + UPPERCASE
|
|
70
63
|
"""Lowercase and uppercase letters `a`-`z` and `A`-`Z`"""
|
|
71
|
-
|
|
64
|
+
LETTERS_EXTENDED = LOWERCASE_EXTENDED + UPPERCASE_EXTENDED
|
|
72
65
|
"""Lowercase and uppercase letters `a`-`z` `A`-`Z` and all diacritic letters."""
|
|
73
66
|
|
|
74
|
-
|
|
67
|
+
SPECIAL_ASCII = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
|
|
75
68
|
"""All ASCII special characters."""
|
|
76
|
-
|
|
69
|
+
SPECIAL_ASCII_EXTENDED = SPECIAL_ASCII + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡±‗¾¶§÷¸°¨·¹³²■ "
|
|
77
70
|
"""All ASCII special characters with the extended ASCII special characters."""
|
|
78
|
-
|
|
71
|
+
STANDARD_ASCII = SPECIAL_ASCII + DIGITS + LETTERS
|
|
79
72
|
"""All standard ASCII characters."""
|
|
80
|
-
|
|
73
|
+
FULL_ASCII = SPECIAL_ASCII_EXTENDED + DIGITS + LETTERS_EXTENDED
|
|
81
74
|
"""All characters in the ASCII table."""
|
|
82
75
|
|
|
83
76
|
|
|
84
77
|
class ANSI:
|
|
85
|
-
"""Constants and
|
|
78
|
+
"""Constants and methods for use of ANSI escape codes"""
|
|
86
79
|
|
|
87
|
-
|
|
80
|
+
ESCAPED_CHAR = "\\x1b"
|
|
88
81
|
"""The printable ANSI escape character."""
|
|
89
82
|
CHAR = char = "\x1b"
|
|
90
83
|
"""The ANSI escape character."""
|
|
@@ -100,12 +93,12 @@ class ANSI:
|
|
|
100
93
|
"""Generate an ANSI sequence with `parts` amount of placeholders."""
|
|
101
94
|
return cls.CHAR + cls.START + cls.SEP.join(["{}" for _ in range(parts)]) + cls.END
|
|
102
95
|
|
|
103
|
-
|
|
96
|
+
SEQ_COLOR: FormattableString = CHAR + START + "38" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
104
97
|
"""The ANSI escape sequence for setting the text RGB color."""
|
|
105
|
-
|
|
98
|
+
SEQ_BG_COLOR: FormattableString = CHAR + START + "48" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
|
|
106
99
|
"""The ANSI escape sequence for setting the background RGB color."""
|
|
107
100
|
|
|
108
|
-
|
|
101
|
+
COLOR_MAP: tuple[str, ...] = (
|
|
109
102
|
########### DEFAULT CONSOLE COLOR NAMES ############
|
|
110
103
|
"black",
|
|
111
104
|
"red",
|
|
@@ -118,7 +111,7 @@ class ANSI:
|
|
|
118
111
|
)
|
|
119
112
|
"""The console default color names."""
|
|
120
113
|
|
|
121
|
-
|
|
114
|
+
CODES_MAP: dict[str | tuple[str, ...], int] = {
|
|
122
115
|
################# SPECIFIC RESETS ##################
|
|
123
116
|
"_": 0,
|
|
124
117
|
("_bold", "_b"): 22,
|
xulbux/cli/help.py
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
from .. import __version__
|
|
2
|
+
from ..base.consts import COLOR
|
|
3
|
+
from ..format_codes import FormatCodes
|
|
4
|
+
from ..console import Console
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
CLR = {
|
|
8
|
+
"class": COLOR.TANGERINE,
|
|
9
|
+
"const": COLOR.RED,
|
|
10
|
+
"func": COLOR.CYAN,
|
|
11
|
+
"import": COLOR.NEON_GREEN,
|
|
12
|
+
"lib": COLOR.ORANGE,
|
|
13
|
+
"punctuators": COLOR.DARK_GRAY,
|
|
14
|
+
"code_border": COLOR.GRAY,
|
|
15
|
+
}
|
|
16
|
+
HELP = FormatCodes.to_ansi(
|
|
17
|
+
rf""" [_|b|#7075FF] __ __
|
|
18
|
+
[b|#7075FF] _ __ __ __/ / / /_ __ ___ __
|
|
19
|
+
[b|#7075FF] | |/ // / / / / / __ \/ / / | |/ /
|
|
20
|
+
[b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
|
|
21
|
+
[b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{COLOR.GRAY}|#000] v[b]{__version__} [*]
|
|
22
|
+
|
|
23
|
+
[i|{COLOR.CORAL}]A TON OF COOL FUNCTIONS, YOU NEED![*]
|
|
24
|
+
|
|
25
|
+
[b|#FCFCFF]Usage:[*]
|
|
26
|
+
[dim|{CLR['code_border']}](╭────────────────────────────────────────────────────╮)
|
|
27
|
+
[dim|{CLR['code_border']}](│) [{CLR['punctuators']}]# LIBRARY CONSTANTS[*] [dim|{CLR['code_border']}](│)
|
|
28
|
+
[dim|{CLR['code_border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux[{CLR['punctuators']}].[{CLR['lib']}]base[{CLR['punctuators']}].[{CLR['lib']}]consts [{CLR['import']}]import [{CLR['const']}]COLOR[{CLR['punctuators']}], [{CLR['const']}]CHARS[{CLR['punctuators']}], [{CLR['const']}]ANSI[*] [dim|{CLR['code_border']}](│)
|
|
29
|
+
[dim|{CLR['code_border']}](│) [{CLR['punctuators']}]# Main Classes[*] [dim|{CLR['code_border']}](│)
|
|
30
|
+
[dim|{CLR['code_border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux [{CLR['import']}]import [{CLR['class']}]Code[{CLR['punctuators']}], [{CLR['class']}]Color[{CLR['punctuators']}], [{CLR['class']}]Console[{CLR['punctuators']}], ...[*] [dim|{CLR['code_border']}](│)
|
|
31
|
+
[dim|{CLR['code_border']}](│) [{CLR['punctuators']}]# module specific imports[*] [dim|{CLR['code_border']}](│)
|
|
32
|
+
[dim|{CLR['code_border']}](│) [{CLR['import']}]from [{CLR['lib']}]xulbux[{CLR['punctuators']}].[{CLR['lib']}]color [{CLR['import']}]import [{CLR['func']}]rgba[{CLR['punctuators']}], [{CLR['func']}]hsla[{CLR['punctuators']}], [{CLR['func']}]hexa[*] [dim|{CLR['code_border']}](│)
|
|
33
|
+
[dim|{CLR['code_border']}](╰────────────────────────────────────────────────────╯)
|
|
34
|
+
[b|#FCFCFF]Documentation:[*]
|
|
35
|
+
[dim|{CLR['code_border']}](╭────────────────────────────────────────────────────╮)
|
|
36
|
+
[dim|{CLR['code_border']}](│) [#DADADD]For more information see the GitHub page. [dim|{CLR['code_border']}](│)
|
|
37
|
+
[dim|{CLR['code_border']}](│) [u|#8085FF](https://github.com/XulbuX/PythonLibraryXulbuX/wiki) [dim|{CLR['code_border']}](│)
|
|
38
|
+
[dim|{CLR['code_border']}](╰────────────────────────────────────────────────────╯)
|
|
39
|
+
[_]"""
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def show_help() -> None:
|
|
44
|
+
print(HELP)
|
|
45
|
+
Console.pause_exit(pause=True, prompt=" [dim](Press any key to exit...)\n\n")
|
xulbux/{xx_code.py → code.py}
RENAMED
xulbux/{xx_color.py → color.py}
RENAMED
|
@@ -31,7 +31,7 @@ The `Color` class, which contains all sorts of different color-related methods:
|
|
|
31
31
|
- saturation
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
|
-
from .
|
|
34
|
+
from .regex import Regex
|
|
35
35
|
|
|
36
36
|
from typing import Annotated, TypeAlias, Iterator, Optional, Literal, Union, Any, cast
|
|
37
37
|
import re as _re
|