xulbux 1.8.1__tar.gz → 1.8.3__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 (39) hide show
  1. {xulbux-1.8.1 → xulbux-1.8.3}/PKG-INFO +2 -2
  2. {xulbux-1.8.1 → xulbux-1.8.3}/pyproject.toml +4 -2
  3. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/__init__.py +17 -2
  4. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/cli/help.py +30 -2
  5. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/color.py +12 -0
  6. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/console.py +475 -45
  7. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/data.py +9 -6
  8. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/format_codes.py +15 -8
  9. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/json.py +1 -1
  10. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/path.py +1 -1
  11. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/system.py +37 -12
  12. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux.egg-info/PKG-INFO +2 -2
  13. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux.egg-info/SOURCES.txt +3 -1
  14. xulbux-1.8.3/tests/test_console.py +1033 -0
  15. xulbux-1.8.3/tests/test_regex.py +306 -0
  16. xulbux-1.8.3/tests/test_system.py +89 -0
  17. xulbux-1.8.1/tests/test_console.py +0 -263
  18. {xulbux-1.8.1 → xulbux-1.8.3}/README.md +0 -0
  19. {xulbux-1.8.1 → xulbux-1.8.3}/setup.cfg +0 -0
  20. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/base/consts.py +0 -0
  21. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/code.py +0 -0
  22. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/env_path.py +0 -0
  23. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/file.py +0 -0
  24. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/regex.py +0 -0
  25. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux/string.py +0 -0
  26. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux.egg-info/dependency_links.txt +0 -0
  27. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux.egg-info/entry_points.txt +0 -0
  28. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux.egg-info/requires.txt +0 -0
  29. {xulbux-1.8.1 → xulbux-1.8.3}/src/xulbux.egg-info/top_level.txt +0 -0
  30. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_code.py +0 -0
  31. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_color.py +0 -0
  32. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_color_types.py +0 -0
  33. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_data.py +0 -0
  34. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_env_path.py +0 -0
  35. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_file.py +0 -0
  36. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_format_codes.py +0 -0
  37. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_json.py +0 -0
  38. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_path.py +0 -0
  39. {xulbux-1.8.1 → xulbux-1.8.3}/tests/test_string.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xulbux
3
- Version: 1.8.1
4
- Summary: A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler.
3
+ Version: 1.8.3
4
+ Summary: A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler.
5
5
  Author-email: XulbuX <xulbux.real@gmail.com>
6
6
  Maintainer-email: XulbuX <xulbux.real@gmail.com>
7
7
  License-Expression: MIT
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "xulbux"
7
- version = "1.8.1"
7
+ version = "1.8.3"
8
8
  authors = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
9
9
  maintainers = [{ name = "XulbuX", email = "xulbux.real@gmail.com" }]
10
- description = "A Python library which includes lots of helpful classes, types and functions aiming to make common programming tasks simpler."
10
+ description = "A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler."
11
11
  readme = "README.md"
12
12
  license = "MIT"
13
13
  license-files = ["LICEN[CS]E.*"]
@@ -163,5 +163,7 @@ testpaths = [
163
163
  "tests/test_format_codes.py",
164
164
  "tests/test_json.py",
165
165
  "tests/test_path.py",
166
+ "tests/test_regex.py",
166
167
  "tests/test_string.py",
168
+ "tests/test_system.py",
167
169
  ]
@@ -1,4 +1,4 @@
1
- __version__ = "1.8.1"
1
+ __version__ = "1.8.3"
2
2
 
3
3
  __author__ = "XulbuX"
4
4
  __email__ = "xulbux.real@gmail.com"
@@ -7,11 +7,26 @@ __copyright__ = "Copyright (c) 2024 XulbuX"
7
7
  __url__ = "https://github.com/XulbuX/PythonLibraryXulbuX"
8
8
  __description__ = "A Python library which includes lots of helpful classes, types, and functions aiming to make common programming tasks simpler."
9
9
 
10
- __all__ = ["Code", "Color", "Console", "Data", "EnvPath", "File", "FormatCodes", "Json", "Path", "Regex", "String", "System"]
10
+ __all__ = [
11
+ "Code",
12
+ "Color",
13
+ "Console",
14
+ "Data",
15
+ "EnvPath",
16
+ "File",
17
+ "FormatCodes",
18
+ "Json",
19
+ "Path",
20
+ "ProgressBar",
21
+ "Regex",
22
+ "String",
23
+ "System",
24
+ ]
11
25
 
12
26
  from .code import Code
13
27
  from .color import Color
14
28
  from .console import Console
29
+ from .console import ProgressBar
15
30
  from .data import Data
16
31
  from .env_path import EnvPath
17
32
  from .file import File
@@ -3,22 +3,50 @@ from ..base.consts import COLOR
3
3
  from ..format_codes import FormatCodes
4
4
  from ..console import Console
5
5
 
6
+ from urllib.error import HTTPError
7
+ from typing import Optional
8
+ import urllib.request as _request
9
+ import json as _json
6
10
 
11
+
12
+ def get_latest_version() -> Optional[str]:
13
+ with _request.urlopen(URL) as response:
14
+ if response.status == 200:
15
+ data = _json.load(response)
16
+ return data["info"]["version"]
17
+ else:
18
+ raise HTTPError(URL, response.status, "Failed to fetch latest version info", response.headers, None)
19
+
20
+
21
+ def is_latest_version() -> Optional[bool]:
22
+ try:
23
+ if (latest := get_latest_version()) in ("", None):
24
+ return None
25
+ latest_v_parts = tuple(int(part) for part in latest.lower().lstrip("v").split('.'))
26
+ installed_v_parts = tuple(int(part) for part in __version__.lower().lstrip("v").split('.'))
27
+ return latest_v_parts <= installed_v_parts
28
+ except Exception:
29
+ return None
30
+
31
+
32
+ URL = "https://pypi.org/pypi/xulbux/json"
33
+ IS_LATEST_VERSION = is_latest_version()
7
34
  CLR = {
8
35
  "class": COLOR.TANGERINE,
36
+ "code_border": COLOR.GRAY,
9
37
  "const": COLOR.RED,
10
38
  "func": COLOR.CYAN,
11
39
  "import": COLOR.NEON_GREEN,
12
40
  "lib": COLOR.ORANGE,
41
+ "notice": COLOR.YELLOW,
13
42
  "punctuators": COLOR.DARK_GRAY,
14
- "code_border": COLOR.GRAY,
15
43
  }
16
44
  HELP = FormatCodes.to_ansi(
17
45
  rf""" [_|b|#7075FF] __ __
18
46
  [b|#7075FF] _ __ __ __/ / / /_ __ ___ __
19
47
  [b|#7075FF] | |/ // / / / / / __ \/ / / | |/ /
20
48
  [b|#7075FF] > , </ /_/ / /_/ /_/ / /_/ /> , <
21
- [b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{COLOR.GRAY}|#000] v[b]{__version__} [*]
49
+ [b|#7075FF]/_/|_|\____/\__/\____/\____//_/|_| [*|BG:{COLOR.GRAY}|#000] v[b]{__version__} [*|dim|{CLR['notice']}]({'' if IS_LATEST_VERSION else ' (newer available)'})[*]
22
50
 
23
51
  [i|{COLOR.CORAL}]A TON OF COOL FUNCTIONS, YOU NEED![*]
24
52
 
@@ -92,9 +92,13 @@ class rgba:
92
92
 
93
93
  def __init__(self, r: int, g: int, b: int, a: Optional[float] = None, _validate: bool = True):
94
94
  self.r: int
95
+ """The red channel (`0`–`255`)"""
95
96
  self.g: int
97
+ """The green channel (`0`–`255`)"""
96
98
  self.b: int
99
+ """The blue channel (`0`–`255`)"""
97
100
  self.a: Optional[float]
101
+ """The alpha channel (`0.0`–`1.0`) or `None` if not set"""
98
102
  if not _validate:
99
103
  self.r, self.g, self.b, self.a = r, g, b, a
100
104
  return
@@ -291,9 +295,13 @@ class hsla:
291
295
 
292
296
  def __init__(self, h: int, s: int, l: int, a: Optional[float] = None, _validate: bool = True):
293
297
  self.h: int
298
+ """The hue channel (`0`–`360`)"""
294
299
  self.s: int
300
+ """The saturation channel (`0`–`100`)"""
295
301
  self.l: int
302
+ """The lightness channel (`0`–`100`)"""
296
303
  self.a: Optional[float]
304
+ """The alpha channel (`0.0`–`1.0`) or `None` if not set"""
297
305
  if not _validate:
298
306
  self.h, self.s, self.l, self.a = h, s, l, a
299
307
  return
@@ -496,9 +504,13 @@ class hexa:
496
504
  _a: Optional[float] = None,
497
505
  ):
498
506
  self.r: int
507
+ """The red channel (`0`–`255`)"""
499
508
  self.g: int
509
+ """The green channel (`0`–`255`)"""
500
510
  self.b: int
511
+ """The blue channel (`0`–`255`)"""
501
512
  self.a: Optional[float]
513
+ """The alpha channel (`0.0`–`1.0`) or `None` if not set"""
502
514
  if all(x is not None for x in (_r, _g, _b)):
503
515
  self.r, self.g, self.b, self.a = cast(int, _r), cast(int, _g), cast(int, _b), _a
504
516
  return