xulbux 1.7.2__py3-none-any.whl → 1.7.3__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,4 +1,4 @@
1
- __version__ = "1.7.2"
1
+ __version__ = "1.7.3"
2
2
  __author__ = "XulbuX"
3
3
  __email__ = "xulbux.real@gmail.com"
4
4
  __license__ = "MIT"
xulbux/xx_console.py CHANGED
@@ -353,7 +353,6 @@ class Console:
353
353
  format_linebreaks: bool = True,
354
354
  start: str = "",
355
355
  end: str = "\n",
356
- title_bg_color: Optional[Rgba | Hexa] = COLOR.yellow,
357
356
  default_color: Optional[Rgba | Hexa] = COLOR.text,
358
357
  pause: bool = False,
359
358
  exit: bool = False,
@@ -362,7 +361,7 @@ class Console:
362
361
  at the message and exit the program after the message was printed.
363
362
  If `active` is false, no debug message will be printed."""
364
363
  if active:
365
- Console.log("DEBUG", prompt, format_linebreaks, start, end, title_bg_color, default_color)
364
+ Console.log("DEBUG", prompt, format_linebreaks, start, end, COLOR.yellow, default_color)
366
365
  Console.pause_exit(pause, exit)
367
366
 
368
367
  @staticmethod
@@ -371,14 +370,13 @@ class Console:
371
370
  format_linebreaks: bool = True,
372
371
  start: str = "",
373
372
  end: str = "\n",
374
- title_bg_color: Optional[Rgba | Hexa] = COLOR.blue,
375
373
  default_color: Optional[Rgba | Hexa] = COLOR.text,
376
374
  pause: bool = False,
377
375
  exit: bool = False,
378
376
  ) -> None:
379
377
  """A preset for `log()`: `INFO` log message with the options to pause
380
378
  at the message and exit the program after the message was printed."""
381
- Console.log("INFO", prompt, format_linebreaks, start, end, title_bg_color, default_color)
379
+ Console.log("INFO", prompt, format_linebreaks, start, end, COLOR.blue, default_color)
382
380
  Console.pause_exit(pause, exit)
383
381
 
384
382
  @staticmethod
@@ -387,14 +385,13 @@ class Console:
387
385
  format_linebreaks: bool = True,
388
386
  start: str = "",
389
387
  end: str = "\n",
390
- title_bg_color: Optional[Rgba | Hexa] = COLOR.teal,
391
388
  default_color: Optional[Rgba | Hexa] = COLOR.text,
392
389
  pause: bool = False,
393
390
  exit: bool = False,
394
391
  ) -> None:
395
392
  """A preset for `log()`: `DONE` log message with the options to pause
396
393
  at the message and exit the program after the message was printed."""
397
- Console.log("DONE", prompt, format_linebreaks, start, end, title_bg_color, default_color)
394
+ Console.log("DONE", prompt, format_linebreaks, start, end, COLOR.teal, default_color)
398
395
  Console.pause_exit(pause, exit)
399
396
 
400
397
  @staticmethod
@@ -403,14 +400,13 @@ class Console:
403
400
  format_linebreaks: bool = True,
404
401
  start: str = "",
405
402
  end: str = "\n",
406
- title_bg_color: Optional[Rgba | Hexa] = COLOR.orange,
407
403
  default_color: Optional[Rgba | Hexa] = COLOR.text,
408
404
  pause: bool = False,
409
405
  exit: bool = False,
410
406
  ) -> None:
411
407
  """A preset for `log()`: `WARN` log message with the options to pause
412
408
  at the message and exit the program after the message was printed."""
413
- Console.log("WARN", prompt, format_linebreaks, start, end, title_bg_color, default_color)
409
+ Console.log("WARN", prompt, format_linebreaks, start, end, COLOR.orange, default_color)
414
410
  Console.pause_exit(pause, exit)
415
411
 
416
412
  @staticmethod
@@ -419,7 +415,6 @@ class Console:
419
415
  format_linebreaks: bool = True,
420
416
  start: str = "",
421
417
  end: str = "\n",
422
- title_bg_color: Optional[Rgba | Hexa] = COLOR.red,
423
418
  default_color: Optional[Rgba | Hexa] = COLOR.text,
424
419
  pause: bool = False,
425
420
  exit: bool = True,
@@ -427,7 +422,7 @@ class Console:
427
422
  ) -> None:
428
423
  """A preset for `log()`: `FAIL` log message with the options to pause
429
424
  at the message and exit the program after the message was printed."""
430
- Console.log("FAIL", prompt, format_linebreaks, start, end, title_bg_color, default_color)
425
+ Console.log("FAIL", prompt, format_linebreaks, start, end, COLOR.red, default_color)
431
426
  Console.pause_exit(pause, exit, reset_ansi=reset_ansi)
432
427
 
433
428
  @staticmethod
@@ -436,7 +431,6 @@ class Console:
436
431
  format_linebreaks: bool = True,
437
432
  start: str = "",
438
433
  end: str = "\n",
439
- title_bg_color: Optional[Rgba | Hexa] = COLOR.magenta,
440
434
  default_color: Optional[Rgba | Hexa] = COLOR.text,
441
435
  pause: bool = False,
442
436
  exit: bool = True,
@@ -444,7 +438,7 @@ class Console:
444
438
  ) -> None:
445
439
  """A preset for `log()`: `EXIT` log message with the options to pause
446
440
  at the message and exit the program after the message was printed."""
447
- Console.log("EXIT", prompt, format_linebreaks, start, end, title_bg_color, default_color)
441
+ Console.log("EXIT", prompt, format_linebreaks, start, end, COLOR.magenta, default_color)
448
442
  Console.pause_exit(pause, exit, reset_ansi=reset_ansi)
449
443
 
450
444
  @staticmethod
@@ -456,6 +450,7 @@ class Console:
456
450
  default_color: Optional[Rgba | Hexa] = None,
457
451
  w_padding: int = 2,
458
452
  w_full: bool = False,
453
+ indent: int = 0,
459
454
  ) -> None:
460
455
  """Will print a box with a colored background, containing a formatted log message:
461
456
  - `*values` -⠀the box content (each value is on a new line)
@@ -464,7 +459,8 @@ class Console:
464
459
  - `box_bg_color` -⠀the background color of the box
465
460
  - `default_color` -⠀the default text color of the `*values`
466
461
  - `w_padding` -⠀the horizontal padding (in chars) to the box content
467
- - `w_full` -⠀whether to make the box be the full console width or not\n
462
+ - `w_full` -⠀whether to make the box be the full console width or not
463
+ - `indent` -⠀the indentation of the box (in chars)\n
468
464
  -----------------------------------------------------------------------------------
469
465
  The box content can be formatted with special formatting codes. For more detailed
470
466
  information about formatting codes, see `xx_format_codes` module documentation."""
@@ -472,15 +468,16 @@ class Console:
472
468
  pad_w_full = (Console.w - (max_line_len + (2 * w_padding))) if w_full else 0
473
469
  if box_bg_color is not None and Color.is_valid(box_bg_color):
474
470
  box_bg_color = Color.to_hexa(box_bg_color)
471
+ spaces_l = " " * indent
475
472
  lines = [
476
- f"[bg:{box_bg_color}]{' ' * w_padding}{line}" + " " *
477
- ((w_padding + max_line_len - len(unfmt)) + pad_w_full) + "[*]" for line, unfmt in zip(lines, unfmt_lines)
473
+ f"{spaces_l}[bg:{box_bg_color}]{' ' * w_padding}"
474
+ + _COMPILED["formatting"].sub(lambda m: f"{m.group(0)}[bg:{box_bg_color}]", line) +
475
+ (" " * ((w_padding + max_line_len - len(unfmt)) + pad_w_full)) + "[*]" for line, unfmt in zip(lines, unfmt_lines)
478
476
  ]
479
477
  pady = " " * (Console.w if w_full else max_line_len + (2 * w_padding))
480
478
  FormatCodes.print(
481
- f"{start}[bg:{box_bg_color}]{pady}[*]\n"
482
- + _COMPILED["formatting"].sub(lambda m: f"{m.group(0)}[bg:{box_bg_color}]", "\n".join(lines))
483
- + f"\n[bg:{box_bg_color}]{pady}[_]",
479
+ f"{start}{spaces_l}[bg:{box_bg_color}]{pady}[*]\n" + "\n".join(lines)
480
+ + f"\n{spaces_l}[bg:{box_bg_color}]{pady}[_]",
484
481
  default_color=default_color or "#000",
485
482
  sep="\n",
486
483
  end=end,
@@ -496,6 +493,7 @@ class Console:
496
493
  default_color: Optional[Rgba | Hexa] = None,
497
494
  w_padding: int = 1,
498
495
  w_full: bool = False,
496
+ indent: int = 0,
499
497
  _border_chars: Optional[tuple[str, str, str, str, str, str, str, str]] = None,
500
498
  ) -> None:
501
499
  """Will print a bordered box, containing a formatted log message:
@@ -507,6 +505,7 @@ class Console:
507
505
  - `default_color` -⠀the default text color of the `*values`
508
506
  - `w_padding` -⠀the horizontal padding (in chars) to the box content
509
507
  - `w_full` -⠀whether to make the box be the full console width or not
508
+ - `indent` -⠀the indentation of the box (in chars)
510
509
  - `_border_chars` -⠀define your own border characters set (overwrites `border_type`)\n
511
510
  ---------------------------------------------------------------------------------------
512
511
  The box content can be formatted with special formatting codes. For more detailed
@@ -534,18 +533,18 @@ class Console:
534
533
  }
535
534
  border_chars = borders.get(border_type, borders["standard"]) if _border_chars is None else _border_chars
536
535
  lines, unfmt_lines, max_line_len = Console.__prepare_log_box(values, default_color)
537
- print(unfmt_lines)
538
536
  pad_w_full = (Console.w - (max_line_len + (2 * w_padding)) - (len(border_chars[1] * 2))) if w_full else 0
539
537
  if border_style is not None and Color.is_valid(border_style):
540
538
  border_style = Color.to_hexa(border_style)
539
+ spaces_l = " " * indent
541
540
  border_l = f"[{border_style}]{border_chars[7]}[*]"
542
541
  border_r = f"[{border_style}]{border_chars[3]}[_]"
543
542
  lines = [
544
- f"{border_l}{' ' * w_padding}{line}[_]" + " " * ((w_padding + max_line_len - len(unfmt)) + pad_w_full) + border_r
545
- for line, unfmt in zip(lines, unfmt_lines)
543
+ f"{spaces_l}{border_l}{' ' * w_padding}{line}[_]" + " " *
544
+ ((w_padding + max_line_len - len(unfmt)) + pad_w_full) + border_r for line, unfmt in zip(lines, unfmt_lines)
546
545
  ]
547
- border_t = f"[{border_style}]{border_chars[0]}{border_chars[1] * (Console.w - (len(border_chars[1] * 2)) if w_full else max_line_len + (2 * w_padding))}{border_chars[2]}[_]"
548
- border_b = f"[{border_style}]{border_chars[6]}{border_chars[5] * (Console.w - (len(border_chars[1] * 2)) if w_full else max_line_len + (2 * w_padding))}{border_chars[4]}[_]"
546
+ border_t = f"{spaces_l}[{border_style}]{border_chars[0]}{border_chars[1] * (Console.w - (len(border_chars[1] * 2)) if w_full else max_line_len + (2 * w_padding))}{border_chars[2]}[_]"
547
+ border_b = f"{spaces_l}[{border_style}]{border_chars[6]}{border_chars[5] * (Console.w - (len(border_chars[1] * 2)) if w_full else max_line_len + (2 * w_padding))}{border_chars[4]}[_]"
549
548
  FormatCodes.print(
550
549
  f"{start}{border_t}[_]\n" + "\n".join(lines) + f"\n{border_b}[_]",
551
550
  default_color=default_color,
xulbux/xx_format_codes.py CHANGED
@@ -56,11 +56,13 @@ the formatting code:
56
56
  - `[(255, 0, 136)]`
57
57
  - `[255, 0, 136]`
58
58
  - HEX colors:
59
- Change the text color directly with a HEX color inside the square brackets. (If `RGB` or `RRGGBB` formatting code is used,
59
+ Change the text color directly with a HEX color inside the square brackets. (Whether the `RGB` or `RRGGBB` HEX format is used,
60
60
  and if there's a `#` or `0x` prefix, doesn't matter.)
61
61
  Examples:
62
+ - `[0x7788FF]`
62
63
  - `[#7788FF]`
63
64
  - `[7788FF]`
65
+ - `[0x78F]`
64
66
  - `[#78F]`
65
67
  - `[78F]`
66
68
  - background RGB / HEX colors:
@@ -1,22 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xulbux
3
- Version: 1.7.2
3
+ Version: 1.7.3
4
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
  License-Expression: MIT
7
- Project-URL: Bug Reports, https://github.com/XulbuX/PythonLibraryXulbuX/issues
8
- Project-URL: Changelog, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md
9
- Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
10
7
  Project-URL: Homepage, https://github.com/XulbuX/PythonLibraryXulbuX
11
- Project-URL: License, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE
8
+ Project-URL: Documentation, https://github.com/XulbuX/PythonLibraryXulbuX/wiki
12
9
  Project-URL: Source Code, https://github.com/XulbuX/PythonLibraryXulbuX/tree/main/src
13
- Keywords: args,arguments,attributes,classes,cmd,client,code,codes,color,commands,console,consts,constants,convert,conversion,data,debug,easier,env,environment,error,file,format,formatting,functions,helper,hex,hexa,hsl,hsla,info,input,json,library,log,logging,methods,nice,operations,path,presets,pretty,printing,properties,python,re,regex,rgb,rgba,string,structures,system,tools,types,utility,warn,warning,xulbux
14
- Classifier: Intended Audience :: Developers
10
+ Project-URL: Changelog, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md
11
+ Project-URL: Bug Reports, https://github.com/XulbuX/PythonLibraryXulbuX/issues
12
+ Project-URL: License, https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/LICENSE
13
+ Keywords: args,arguments,attributes,classes,client,cmd,code,codes,color,commands,console,constants,consts,conversion,convert,data,debug,easier,env,environment,error,file,format,formatting,functions,helper,hex,hexa,hsl,hsla,info,input,json,library,log,logging,methods,nice,operations,path,presets,pretty,printing,properties,python,re,regex,rgb,rgba,string,structures,system,tools,types,utility,warn,warning,xulbux
15
14
  Classifier: Programming Language :: Python :: 3
16
- Classifier: Programming Language :: Python :: 3.10
17
- Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.13
18
16
  Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Operating System :: OS Independent
20
+ Classifier: Intended Audience :: Developers
20
21
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
21
22
  Requires-Python: >=3.10.0
22
23
  Description-Content-Type: text/markdown
@@ -27,20 +28,22 @@ Requires-Dist: prompt_toolkit>=3.0.41
27
28
  Requires-Dist: pyperclip>=1.9.0
28
29
  Requires-Dist: regex>=2023.10.3
29
30
  Provides-Extra: dev
30
- Requires-Dist: pytest>=7.4.2; extra == "dev"
31
31
  Requires-Dist: black>=23.7.0; extra == "dev"
32
- Requires-Dist: isort>=5.12.0; extra == "dev"
33
- Requires-Dist: flake8>=6.1.0; extra == "dev"
34
32
  Requires-Dist: flake8-pyproject>=1.2.3; extra == "dev"
33
+ Requires-Dist: flake8>=6.1.0; extra == "dev"
34
+ Requires-Dist: isort>=5.12.0; extra == "dev"
35
+ Requires-Dist: pytest>=7.4.2; extra == "dev"
35
36
  Dynamic: license-file
36
37
 
37
- # **$\Huge\textsf{XulbuX}$**
38
+ # **XulbuX**
39
+
40
+ ![](https://img.shields.io/pypi/v/xulbux?labelColor=404560&color=7075FF) ![](https://img.shields.io/pypi/dm/xulbux?labelColor=405555&color=70FFEE) ![](https://img.shields.io/github/license/XulbuX/PythonLibraryXulbuX?labelColor=405555&color=70FFEE) ![](https://img.shields.io/github/last-commit/XulbuX/PythonLibraryXulbuX?labelColor=554045&color=FF6065) ![](https://img.shields.io/github/issues/XulbuX/PythonLibraryXulbuX?labelColor=554045&color=FF6065)
38
41
 
39
42
  **XulbuX** is library that contains many useful classes, types, and functions,
40
43
  ranging from console logging and working with colors to file management and system operations.
41
44
  The library is designed to simplify common programming tasks and improve code readability through its collection of tools.
42
45
 
43
- For precise information about the library, see the library's [**wiki page**](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
46
+ For precise information about the library, see the library's [**documentation**](https://github.com/XulbuX/PythonLibraryXulbuX/wiki).<br>
44
47
  For the libraries latest changes and updates, see the [**change log**](https://github.com/XulbuX/PythonLibraryXulbuX/blob/main/CHANGELOG.md).
45
48
 
46
49
  <br>
@@ -1,21 +1,21 @@
1
- xulbux/__init__.py,sha256=vd8y5L0AwqnxqXm_IAJ5grbfm8ZkcSHJx36n1KUQTlc,815
1
+ xulbux/__init__.py,sha256=DLQ3YFjd9sCUw5ZyEiSkkLXs7a-lfbyTrwP4oCaZkDA,815
2
2
  xulbux/_cli_.py,sha256=J4vfJHLJEYxCZzA_VJUB46w2WGShfdYFoetsLG5PfKo,3428
3
3
  xulbux/_consts_.py,sha256=4CLJE-YH3si2YQ-IHcjsT5PW0D7vGvm8ZH13rUoG5cE,6166
4
4
  xulbux/xx_code.py,sha256=b8MJId-BmZOsBH38z-h055op7qIICdsTT3rFJ7SWkiE,6111
5
5
  xulbux/xx_color.py,sha256=Thj7fFTc8x-VmYyULI3HQW0uCk9dIihwrGUwuXGn83s,49744
6
- xulbux/xx_console.py,sha256=c61EXVGQo_OL_MUWb4oXbIr6EKesm1v-FwxBIe47ZTg,34866
6
+ xulbux/xx_console.py,sha256=cYlgiyL7oVSPj3TwQXYLhVGVr8yA9vIFsT4uNcE7qNA,34753
7
7
  xulbux/xx_data.py,sha256=nEfVwK6-ILaL3K-bLezKpG1G7117CY5ZgC3BGwANrUE,30886
8
8
  xulbux/xx_env_path.py,sha256=x56mKK4lSvU5yMCAs8k0RVIqXWUJcpcHYz5HoZ_RklM,4160
9
9
  xulbux/xx_file.py,sha256=KerXOvKS93zIoAt36YTYuZboSmxVFVf2WcOrDcdwXfE,2627
10
- xulbux/xx_format_codes.py,sha256=-tSsgy1tRelmU5x5ZS7ujaiXntyRqk1sm759tyvVIyU,24698
10
+ xulbux/xx_format_codes.py,sha256=2xYX7Gno49KlalwBhMZYBy9rTZbdsPIcIBnSuYyRGas,24735
11
11
  xulbux/xx_json.py,sha256=V7vdfpvSe9wpktR_c8zG_Meix7x9IRmn66k5nB3HUyo,7457
12
12
  xulbux/xx_path.py,sha256=lLAEVZrW0TAwCewlONFVQcQ_8tVn9LTJZVOZpeGvE5s,7673
13
13
  xulbux/xx_regex.py,sha256=_BtMHRDNcD9zF4SL87dQuUVZcYGfZx9H5YNSDiEtzm8,8059
14
14
  xulbux/xx_string.py,sha256=QaTo0TQ9m_2USNgQNaVw5ivQt-A1E-e5x8OpIB3xIlY,5561
15
15
  xulbux/xx_system.py,sha256=Tsx4wgztUg46KloqcGeiFkarDoM3EgJLXw3XNxgHBmU,6460
16
- xulbux-1.7.2.dist-info/licenses/LICENSE,sha256=6NflEcvzFEe8_JFVNCPVwZBwBhlLLd4vqQi8WiX_Xk4,1084
17
- xulbux-1.7.2.dist-info/METADATA,sha256=vlIkVkj97ZLjiFajkGrSZ5O0GDrzuIunJ1E1iqY-QTA,9209
18
- xulbux-1.7.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- xulbux-1.7.2.dist-info/entry_points.txt,sha256=a3womfLIMZKnOFiyy-xnVb4g2qkZsHR5FbKKkljcGns,94
20
- xulbux-1.7.2.dist-info/top_level.txt,sha256=FkK4EZajwfP36fnlrPaR98OrEvZpvdEOdW1T5zTj6og,7
21
- xulbux-1.7.2.dist-info/RECORD,,
16
+ xulbux-1.7.3.dist-info/licenses/LICENSE,sha256=6NflEcvzFEe8_JFVNCPVwZBwBhlLLd4vqQi8WiX_Xk4,1084
17
+ xulbux-1.7.3.dist-info/METADATA,sha256=PBIoTtX3wCvw-w0GOKO32rzvT_BQGB6AdNgNVmQewGw,9705
18
+ xulbux-1.7.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ xulbux-1.7.3.dist-info/entry_points.txt,sha256=a3womfLIMZKnOFiyy-xnVb4g2qkZsHR5FbKKkljcGns,94
20
+ xulbux-1.7.3.dist-info/top_level.txt,sha256=FkK4EZajwfP36fnlrPaR98OrEvZpvdEOdW1T5zTj6og,7
21
+ xulbux-1.7.3.dist-info/RECORD,,
File without changes