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 CHANGED
@@ -1,25 +1,23 @@
1
- __version__ = "1.7.3"
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 a lot of really helpful functions."
8
- __all__ = [
9
- "_consts_", "xx_code", "xx_color", "xx_console", "xx_data", "xx_env_path", "xx_file", "xx_format_codes", "xx_json",
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 ._consts_ import *
14
- from .xx_code import *
15
- from .xx_color import *
16
- from .xx_console import *
17
- from .xx_data import *
18
- from .xx_env_path import *
19
- from .xx_file import *
20
- from .xx_format_codes import *
21
- from .xx_json import *
22
- from .xx_path import *
23
- from .xx_regex import *
24
- from .xx_string import *
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
- """Color presets used in the `xulbux` library."""
12
-
13
- text = "#A5D6FF"
14
- """The default text color used in the `xulbux` library."""
15
-
16
- white = "#F1F2FF"
17
- lightgray = "#B6B7C0"
18
- gray = "#7B7C8D"
19
- darkgray = "#67686C"
20
- black = "#202125"
21
- red = "#FF606A"
22
- coral = "#FF7069"
23
- orange = "#FF876A"
24
- tangerine = "#FF9962"
25
- gold = "#FFAF60"
26
- yellow = "#FFD260"
27
- lime = "#C9F16E"
28
- green = "#7EE787"
29
- neongreen = "#4CFF85"
30
- teal = "#50EAAF"
31
- cyan = "#3EDEE6"
32
- ice = "#77DBEF"
33
- lightblue = "#60AAFF"
34
- blue = "#8085FF"
35
- lavender = "#9B7DFF"
36
- purple = "#AD68FF"
37
- magenta = "#C860FF"
38
- pink = "#F162EF"
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
- all = _AllTextCharacters
40
+ class _AllTextChars:
41
+ pass
42
+
43
+ ALL = _AllTextChars
51
44
  """Code to signal that all characters are allowed."""
52
45
 
53
- digits: str = "0123456789"
46
+ DIGITS = "0123456789"
54
47
  """Digits: `0`-`9`"""
55
- float_digits: str = digits + "."
48
+ FLOAT_DIGITS = DIGITS + "."
56
49
  """Digits: `0`-`9` with decimal point `.`"""
57
- hex_digits: str = digits + "#abcdefABCDEF"
50
+ HEX_DIGITS = DIGITS + "#abcdefABCDEF"
58
51
  """Digits: `0`-`9` Letters: `a`-`f` `A`-`F` and a hashtag `#`"""
59
52
 
60
- lowercase: str = "abcdefghijklmnopqrstuvwxyz"
53
+ LOWERCASE = "abcdefghijklmnopqrstuvwxyz"
61
54
  """Lowercase letters `a`-`z`"""
62
- lowercase_extended: str = lowercase + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
55
+ LOWERCASE_EXTENDED = LOWERCASE + "äëïöüÿàèìòùáéíóúýâêîôûãñõåæç"
63
56
  """Lowercase letters `a`-`z` with all lowercase diacritic letters."""
64
- uppercase: str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
57
+ UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
65
58
  """Uppercase letters `A`-`Z`"""
66
- uppercase_extended: str = uppercase + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
59
+ UPPERCASE_EXTENDED = UPPERCASE + "ÄËÏÖÜÀÈÌÒÙÁÉÍÓÚÝÂÊÎÔÛÃÑÕÅÆÇß"
67
60
  """Uppercase letters `A`-`Z` with all uppercase diacritic letters."""
68
61
 
69
- letters: str = lowercase + uppercase
62
+ LETTERS = LOWERCASE + UPPERCASE
70
63
  """Lowercase and uppercase letters `a`-`z` and `A`-`Z`"""
71
- letters_extended: str = lowercase_extended + uppercase_extended
64
+ LETTERS_EXTENDED = LOWERCASE_EXTENDED + UPPERCASE_EXTENDED
72
65
  """Lowercase and uppercase letters `a`-`z` `A`-`Z` and all diacritic letters."""
73
66
 
74
- special_ascii: str = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
67
+ SPECIAL_ASCII = " !\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~"
75
68
  """All ASCII special characters."""
76
- special_ascii_extended: str = special_ascii + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡­±‗¾¶§÷¸°¨·¹³²■ "
69
+ SPECIAL_ASCII_EXTENDED = SPECIAL_ASCII + "ø£Ø×ƒªº¿®¬½¼¡«»░▒▓│┤©╣║╗╝¢¥┐└┴┬├─┼╚╔╩╦╠═╬¤ðÐı┘┌█▄¦▀µþÞ¯´≡­±‗¾¶§÷¸°¨·¹³²■ "
77
70
  """All ASCII special characters with the extended ASCII special characters."""
78
- standard_ascii: str = special_ascii + digits + letters
71
+ STANDARD_ASCII = SPECIAL_ASCII + DIGITS + LETTERS
79
72
  """All standard ASCII characters."""
80
- full_ascii: str = special_ascii_extended + digits + letters_extended
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 class-methods for use of ANSI escape codes."""
78
+ """Constants and methods for use of ANSI escape codes"""
86
79
 
87
- escaped_char: str = "\\x1b"
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
- seq_color: FormattableString = CHAR + START + "38" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
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
- seq_bg_color: FormattableString = CHAR + START + "48" + SEP + "2" + SEP + "{}" + SEP + "{}" + SEP + "{}" + END
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
- color_map: tuple[str, ...] = (
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
- codes_map: dict[str | tuple[str, ...], int] = {
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")
@@ -1,6 +1,6 @@
1
- from .xx_string import String
2
- from .xx_regex import Regex
3
- from .xx_data import Data
1
+ from .string import String
2
+ from .regex import Regex
3
+ from .data import Data
4
4
 
5
5
  import regex as _rx
6
6
 
@@ -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 .xx_regex import Regex
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