bear-utils 0.9.4__tar.gz → 0.9.5__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.
Files changed (132) hide show
  1. {bear_utils-0.9.4 → bear_utils-0.9.5}/PKG-INFO +1 -1
  2. bear_utils-0.9.5/src/bear_utils/_internal/_version.py +1 -0
  3. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/_internal/cli.py +5 -5
  4. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/font/__init__.py +3 -0
  5. bear_utils-0.9.5/src/bear_utils/graphics/font/_theme.py +31 -0
  6. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/font/_utils.py +71 -36
  7. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/font/block_font.py +12 -31
  8. bear_utils-0.9.4/src/bear_utils/_internal/_version.py +0 -1
  9. bear_utils-0.9.4/src/bear_utils/graphics/font/_theme.py +0 -11
  10. {bear_utils-0.9.4 → bear_utils-0.9.5}/.gitignore +0 -0
  11. {bear_utils-0.9.4 → bear_utils-0.9.5}/.python-version +0 -0
  12. {bear_utils-0.9.4 → bear_utils-0.9.5}/AGENTS.md +0 -0
  13. {bear_utils-0.9.4 → bear_utils-0.9.5}/README.md +0 -0
  14. {bear_utils-0.9.4 → bear_utils-0.9.5}/config/coverage.ini +0 -0
  15. {bear_utils-0.9.4 → bear_utils-0.9.5}/config/default.toml +0 -0
  16. {bear_utils-0.9.4 → bear_utils-0.9.5}/config/git-changelog.toml +0 -0
  17. {bear_utils-0.9.4 → bear_utils-0.9.5}/config/pytest.ini +0 -0
  18. {bear_utils-0.9.4 → bear_utils-0.9.5}/config/ruff.toml +0 -0
  19. {bear_utils-0.9.4 → bear_utils-0.9.5}/directory_structure.txt +0 -0
  20. {bear_utils-0.9.4 → bear_utils-0.9.5}/directory_structure.xml +0 -0
  21. {bear_utils-0.9.4 → bear_utils-0.9.5}/maskfile.md +0 -0
  22. {bear_utils-0.9.4 → bear_utils-0.9.5}/noxfile.py +0 -0
  23. {bear_utils-0.9.4 → bear_utils-0.9.5}/pyproject.toml +0 -0
  24. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/__init__.py +0 -0
  25. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/__main__.py +0 -0
  26. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/_internal/__init__.py +0 -0
  27. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/_internal/debug.py +0 -0
  28. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/ai/__init__.py +0 -0
  29. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/ai/ai_helpers/__init__.py +0 -0
  30. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/ai/ai_helpers/_common.py +0 -0
  31. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/ai/ai_helpers/_config.py +0 -0
  32. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/ai/ai_helpers/_parsers.py +0 -0
  33. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/ai/ai_helpers/_types.py +0 -0
  34. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cache/__init__.py +0 -0
  35. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/__init__.py +0 -0
  36. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/_args.py +0 -0
  37. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/_get_version.py +0 -0
  38. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/commands.py +0 -0
  39. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/prompt_helpers.py +0 -0
  40. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/shell/__init__.py +0 -0
  41. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/shell/_base_command.py +0 -0
  42. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/shell/_base_shell.py +0 -0
  43. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/shell/_common.py +0 -0
  44. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/cli/typer_bridge.py +0 -0
  45. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/config/__init__.py +0 -0
  46. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/config/config_manager.py +0 -0
  47. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/config/dir_manager.py +0 -0
  48. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/config/settings_manager.py +0 -0
  49. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/__init__.py +0 -0
  50. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/_exceptions.py +0 -0
  51. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/_exit_code.py +0 -0
  52. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/_http_status_code.py +0 -0
  53. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/_lazy_typing.py +0 -0
  54. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/_meta.py +0 -0
  55. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/date_related.py +0 -0
  56. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/constants/time_related.py +0 -0
  57. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/database/__init__.py +0 -0
  58. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/database/_db_manager.py +0 -0
  59. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/events/__init__.py +0 -0
  60. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/events/events_class.py +0 -0
  61. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/events/events_module.py +0 -0
  62. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/__init__.py +0 -0
  63. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/_async_helpers.py +0 -0
  64. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/_tools.py +0 -0
  65. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/_zapper.py +0 -0
  66. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/platform_utils.py +0 -0
  67. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/responses/__init__.py +0 -0
  68. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/responses/function_response.py +0 -0
  69. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/wrappers/__init__.py +0 -0
  70. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/wrappers/add_methods.py +0 -0
  71. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/extras/wrappers/string_io.py +0 -0
  72. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/__init__.py +0 -0
  73. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/__init__.py +0 -0
  74. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/_base_file_handler.py +0 -0
  75. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/file_handler_factory.py +0 -0
  76. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/json_file_handler.py +0 -0
  77. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/log_file_handler.py +0 -0
  78. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/toml_file_handler.py +0 -0
  79. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/txt_file_handler.py +0 -0
  80. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/file_handlers/yaml_file_handler.py +0 -0
  81. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/files/ignore_parser.py +0 -0
  82. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/__init__.py +0 -0
  83. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/bear_gradient.py +0 -0
  84. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/font/_raw_block_letters.py +0 -0
  85. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/font/glitch_font.py +0 -0
  86. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/graphics/image_helpers.py +0 -0
  87. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/__init__.py +0 -0
  88. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/__init__.py +0 -0
  89. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/_settings.py +0 -0
  90. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/_types.py +0 -0
  91. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/qt_app.py +0 -0
  92. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/qt_color_picker.py +0 -0
  93. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/qt_file_handler.py +0 -0
  94. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/gui/gui_tools/qt_input_dialog.py +0 -0
  95. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/__init__.py +0 -0
  96. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/_common.py +0 -0
  97. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/_console_junk.py +0 -0
  98. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/_log_level.py +0 -0
  99. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/_styles.py +0 -0
  100. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/logger_protocol.py +0 -0
  101. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/__init__.py +0 -0
  102. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/_console.py +0 -0
  103. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/_level_sin.py +0 -0
  104. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/_logger.py +0 -0
  105. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/base_logger.py +0 -0
  106. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/base_logger.pyi +0 -0
  107. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/basic_logger/__init__.py +0 -0
  108. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/basic_logger/logger.py +0 -0
  109. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/basic_logger/logger.pyi +0 -0
  110. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/buffer_logger.py +0 -0
  111. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/console_logger.py +0 -0
  112. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/console_logger.pyi +0 -0
  113. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/fastapi_logger.py +0 -0
  114. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/file_logger.py +0 -0
  115. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/simple_logger.py +0 -0
  116. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/sub_logger.py +0 -0
  117. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/logger_manager/loggers/sub_logger.pyi +0 -0
  118. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/monitoring/__init__.py +0 -0
  119. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/monitoring/_common.py +0 -0
  120. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/monitoring/host_monitor.py +0 -0
  121. {bear_utils-0.9.4 → bear_utils-0.9.5}/src/bear_utils/time/__init__.py +0 -0
  122. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/__init__.py +0 -0
  123. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_add_ord_suffix.py +0 -0
  124. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_clipboard.py +0 -0
  125. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_database_manager.py +0 -0
  126. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_default_shell.py +0 -0
  127. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_font_utils.py +0 -0
  128. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_function_response.py +0 -0
  129. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_gradient.py +0 -0
  130. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_logger.py +0 -0
  131. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_platform_utils.py +0 -0
  132. {bear_utils-0.9.4 → bear_utils-0.9.5}/tests/test_prompt_helpers.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bear-utils
3
- Version: 0.9.4
3
+ Version: 0.9.5
4
4
  Summary: Various utilities for Bear programmers, including a rich logging utility, a disk cache, and a SQLite database wrapper amongst other things.
5
5
  Author-email: chaz <bright.lid5647@fastmail.com>
6
6
  Requires-Python: >=3.12
@@ -0,0 +1 @@
1
+ version = "0.9.5"
@@ -17,7 +17,7 @@ from typing import Any
17
17
  from bear_utils._internal import debug
18
18
  from bear_utils._internal._version import version as _version
19
19
  from bear_utils.cli._get_version import VALID_BUMP_TYPES, cli_bump
20
- from bear_utils.constants import ExitCode
20
+ from bear_utils.constants import STDERR, ExitCode
21
21
 
22
22
 
23
23
  class _DebugInfo(Action):
@@ -97,7 +97,7 @@ def main(args: list[str] | None = None) -> ExitCode:
97
97
  try:
98
98
  parser: ArgumentParser = get_parser()
99
99
  opts: Namespace = parser.parse_args(args)
100
- command = opts.command
100
+ command: str | None = opts.command
101
101
  if command is None:
102
102
  parser.print_help()
103
103
  return ExitCode.SUCCESS
@@ -105,12 +105,12 @@ def main(args: list[str] | None = None) -> ExitCode:
105
105
  return get_version()
106
106
  if command == "bump-version":
107
107
  if not hasattr(opts, "bump_type"):
108
- print("Error: 'bump-version' command requires a 'bump_type' argument.", file=sys.stderr)
108
+ print("Error: 'bump-version' command requires a 'bump_type' argument.", STDERR)
109
109
  return ExitCode.FAILURE
110
- bump_type = opts.bump_type
110
+ bump_type: str = opts.bump_type
111
111
  return bump_version([bump_type])
112
112
  except Exception as e:
113
- print(f"Error initializing CLI: {e}", file=sys.stderr)
113
+ print(f"Error initializing CLI: {e}", STDERR)
114
114
  return ExitCode.FAILURE
115
115
  return ExitCode.SUCCESS
116
116
 
@@ -1,9 +1,12 @@
1
1
  """A set of command-line interface (CLI) utilities for creating font outputs."""
2
2
 
3
+ from ._theme import CyberTheme, FontStyle
3
4
  from .block_font import BLOCK_LETTERS, char_to_block, print_block_font, word_to_block
4
5
 
5
6
  __all__ = [
6
7
  "BLOCK_LETTERS",
8
+ "CyberTheme",
9
+ "FontStyle",
7
10
  "char_to_block",
8
11
  "print_block_font",
9
12
  "word_to_block",
@@ -0,0 +1,31 @@
1
+ from bear_utils.constants._meta import RichStrEnum, StrValue as Value
2
+
3
+
4
+ class CyberTheme(RichStrEnum):
5
+ """Namespace for cyberpunk color theme constants."""
6
+
7
+ primary = Value("bright_magenta", "Primary color")
8
+ neon_green = Value("bright_green", "Neon green color")
9
+ neon_cyan = Value("bright_cyan", "Neon cyan color")
10
+ warning = Value("bright_yellow", "Warning color")
11
+ error = Value("bright_red", "Error color")
12
+ credits = Value("bright_yellow", "Credits color")
13
+ data = Value("bright_blue", "Data color")
14
+ system = Value("dim white", "System color")
15
+
16
+
17
+ class FontStyle(RichStrEnum):
18
+ """Enumeration for block font styles."""
19
+
20
+ SOLID = Value("solid", "█")
21
+ HOLLOW = Value("hollow", "░")
22
+ PIPES = Value("pipes", "|")
23
+ OUTLINE = Value("outline", "■")
24
+ DASHED = Value("dashed", "─")
25
+ DOTTED = Value("dotted", "·")
26
+ ZIGZAG = Value("zigzag", "╱") # noqa: RUF001
27
+ CROSSED = Value("crossed", "╳") # noqa: RUF001
28
+ FANCY = Value("fancy", "◆")
29
+ RIGHT_ARROWS = Value("right_arrows", "▶")
30
+ LEFT_ARROWS = Value("left_arrows", "◀")
31
+ STARS = Value("stars", "★")
@@ -2,16 +2,32 @@ from __future__ import annotations
2
2
 
3
3
  from dataclasses import dataclass
4
4
  from io import StringIO
5
+ import os
5
6
 
7
+ from pyfiglet import figlet_format
6
8
  from rich.align import Align
7
9
  from rich.panel import Panel
8
10
  from rich.text import Text
9
11
 
10
- from bear_utils.graphics.font._theme import CyberTheme
11
- from bear_utils.graphics.font.block_font import Style
12
+ from bear_utils.constants._meta import RichStrEnum, StrValue as Value
13
+ from bear_utils.graphics import ColorGradient
14
+ from bear_utils.graphics.font.block_font import FontStyle
12
15
  from bear_utils.logger_manager import LogConsole as Console
13
16
 
14
17
 
18
+ def random_num(rng: int = 100) -> int:
19
+ """Generate a random number between 0 and the specified range."""
20
+ random_bytes: bytes = os.urandom(1)
21
+ random_index: int = int.from_bytes(random_bytes, "big") % rng
22
+ return random_index
23
+
24
+
25
+ def random_style() -> str:
26
+ rnd_index: int = random_num(100)
27
+ gradient = ColorGradient()
28
+ return gradient.map_to_rgb(0, 100, rnd_index)
29
+
30
+
15
31
  @dataclass
16
32
  class HeaderConfig:
17
33
  """Configuration for header styling."""
@@ -25,9 +41,10 @@ class HeaderConfig:
25
41
  border_style: str = "bold blue" # s2 - top/bottom lines
26
42
  separator_style: str = "bold green" # s3 - left/right separators
27
43
  overall_style: str = "bold yellow" # s4
44
+ border_enabled: bool = True
28
45
  center_align: bool = True
29
46
  return_txt: bool = False
30
- use_panel: bool = False # New option!
47
+ use_panel: bool = False
31
48
 
32
49
 
33
50
  class TextHelper:
@@ -83,7 +100,7 @@ class TextHelper:
83
100
  **kwargs: Override any config values (top_sep, left_sep, etc.)
84
101
  """
85
102
  local_console = Console()
86
- cfg = config or HeaderConfig()
103
+ cfg: HeaderConfig = config or HeaderConfig()
87
104
  for key, value in kwargs.items():
88
105
  if hasattr(cfg, key):
89
106
  setattr(cfg, key, value)
@@ -95,7 +112,7 @@ class TextHelper:
95
112
  if not cfg.return_txt:
96
113
  local_console.print(output, style=cfg.overall_style)
97
114
 
98
- temp_console = Console(file=StringIO(), width=cfg.length)
115
+ temp_console: Console[StringIO] = Console(file=StringIO(), width=cfg.length)
99
116
  temp_console.print(output, style=cfg.overall_style)
100
117
  return temp_console.file.getvalue()
101
118
 
@@ -105,10 +122,8 @@ class TextHelper:
105
122
  header_lines = [Align.center(line) for line in header_lines]
106
123
 
107
124
  if not cfg.return_txt:
108
- local_console.print() # Leading newline
109
125
  for line in header_lines:
110
126
  local_console.print(line, style=cfg.overall_style)
111
- local_console.print() # Trailing newline
112
127
  output_lines: list[str] = [str(line) for line in header_lines]
113
128
  return "\n" + "\n".join(output_lines) + "\n"
114
129
 
@@ -116,10 +131,10 @@ class TextHelper:
116
131
  """Quick header with predefined styles."""
117
132
  styles = {
118
133
  "cyberpunk": HeaderConfig(
119
- top_sep=str(Style.SOLID),
120
- left_sep=str(Style.RIGHT_ARROWS),
121
- right_sep=str(Style.LEFT_ARROWS),
122
- bottom_sep=str(Style.SOLID),
134
+ top_sep=str(FontStyle.SOLID),
135
+ left_sep=str(FontStyle.RIGHT_ARROWS),
136
+ right_sep=str(FontStyle.LEFT_ARROWS),
137
+ bottom_sep=str(FontStyle.SOLID),
123
138
  title_style="bold bright_magenta",
124
139
  border_style="bright_cyan",
125
140
  separator_style="bright_green",
@@ -150,36 +165,56 @@ def ascii_header(title: str, print_out: bool = True, **kwargs) -> str:
150
165
 
151
166
 
152
167
  if __name__ == "__main__":
153
- top = Style.SOLID.text
154
- bottom = Style.SOLID.text
155
- left = Style.RIGHT_ARROWS.text
156
- right = Style.LEFT_ARROWS.text
168
+ top: str = ""
169
+ bottom: str = ""
170
+ left: str = FontStyle.HOLLOW.text
171
+ right: str = FontStyle.HOLLOW.text
157
172
  ascii_header(
158
- "Welcome to Bear Utils",
173
+ "CYBERDYNE BANKING SYSTEM",
159
174
  top_sep=top,
160
175
  bottom_sep=bottom,
161
176
  left_sep=left,
162
177
  right_sep=right,
163
- title_style=CyberTheme.primary,
164
- separator_style=CyberTheme.system,
165
- border_style=CyberTheme.neon_cyan,
178
+ title_style="red",
179
+ separator_style="black",
180
+ border_style="black",
166
181
  print_out=True,
167
182
  )
168
183
 
169
- from pyfiglet import figlet_format
170
-
171
- ANSI_SHADOW = "ansi_shadow"
172
- BLOODY = "bloody"
173
- BANNER_3_D = "banner3-D"
174
- POISON = "poison"
175
- ALPHA = "alpha"
176
- DOOM = "doom"
177
- DOT_MATRIX = "dotmatrix"
178
- JAZMINE = "jazmine"
179
- RAMMSTEIN = "rammstein"
180
- REVERSE = "reverse"
181
- DIAGONAL_3D = "3d_diagonal"
182
- GHOST = "ghost"
183
-
184
- text = figlet_format("BANKER", font="computer")
185
- print(text)
184
+ class FigletFonts(RichStrEnum):
185
+ """Namespace for Figlet font constants."""
186
+
187
+ COMPUTER = Value("computer", "Computer font")
188
+ SLANT = Value("slant", "Slant font")
189
+ STANDARD = Value("standard", "Standard font")
190
+ SMALL = Value("small", "Small font")
191
+ BIG = Value("big", "Big font")
192
+ BLOCK = Value("block", "Block font")
193
+ STAR_WARS = Value("starwars", "Star Wars font")
194
+ CYBER_MEDIUM = Value("cybermedium", "Cyber Medium font")
195
+ CYBER_LARGE = Value("cyberlarge", "Cyber Large font")
196
+ CYBER_SMALL = Value("cybersmall", "Cyber Small font")
197
+ ANSI_SHADOW = Value("ansi_shadow", "ANSI Shadow font")
198
+ BLOODY = Value("bloody", "Bloody font")
199
+ BANNER_3_D = Value("banner3-D", "Banner 3-D font")
200
+ POISON = Value("poison", "Poison font")
201
+ ALPHA = Value("alpha", "Alpha font")
202
+ DOOM = Value("doom", "Doom font")
203
+ DOT_MATRIX = Value("dotmatrix", "Dot Matrix font")
204
+ JAZMINE = Value("jazmine", "Jazmine font")
205
+ RAMMSTEIN = Value("rammstein", "Rammstein font")
206
+ GHOST = Value("ghost", "Ghost font")
207
+ DIAGONAL_3D = Value("3d_diagonal", "Diagonal 3D font")
208
+
209
+ WORD = "BRAINS"
210
+ text = ""
211
+ console = Console()
212
+ for font in FigletFonts:
213
+ try:
214
+ text = figlet_format(WORD, font=font.value)
215
+ except Exception as e:
216
+ console.print(f"Error generating font '{font.value}': {e}")
217
+ continue
218
+ # console.print(f"\nFont: {font.value}", style="dim white")
219
+ # console.print(text, style=random_style())
220
+ # text = ""
@@ -3,7 +3,7 @@
3
3
  from rich.align import Align
4
4
  from rich.console import Console
5
5
 
6
- from bear_utils.constants import RichStrEnum, StrValue
6
+ from bear_utils.graphics.font import FontStyle
7
7
  from bear_utils.graphics.font._raw_block_letters import (
8
8
  ASTERISK,
9
9
  AT,
@@ -58,6 +58,7 @@ from bear_utils.graphics.font._raw_block_letters import (
58
58
  Z,
59
59
  )
60
60
  from bear_utils.graphics.font._theme import CyberTheme as Theme
61
+ from bear_utils.graphics.font._utils import random_style
61
62
 
62
63
  BLOCK_LETTERS: dict[str, list[str]] = {
63
64
  "A": A,
@@ -113,40 +114,19 @@ BLOCK_LETTERS: dict[str, list[str]] = {
113
114
  "$": DOLLAR,
114
115
  }
115
116
 
116
-
117
- class Style(RichStrEnum):
118
- """Enumeration for block font styles."""
119
-
120
- SOLID = StrValue("solid", "█")
121
- HOLLOW = StrValue("hollow", "░")
122
- PIPES = StrValue("pipes", "|")
123
- OUTLINE = StrValue("outline", "■")
124
- DASHED = StrValue("dashed", "─")
125
- DOTTED = StrValue("dotted", "·")
126
- ZIGZAG = StrValue("zigzag", "╱") # noqa: RUF001
127
- CROSSED = StrValue("crossed", "╳") # noqa: RUF001
128
- FANCY = StrValue("fancy", "◆")
129
- RIGHT_ARROWS = StrValue("right_arrows", "▶")
130
- LEFT_ARROWS = StrValue("left_arrows", "◀")
131
- STARS = StrValue("stars", "★")
132
-
133
-
134
- OG_CHAR = Style.SOLID
117
+ console = Console()
135
118
 
136
119
 
137
120
  def apply_block_style(block_rows: list[str], style: str = "solid") -> list[str]:
138
121
  """Replace block characters with different symbols."""
139
122
  try:
140
- new_char: Style = Style.get(value=style, default=OG_CHAR)
141
- return [row.replace(OG_CHAR.text, new_char.text) for row in block_rows]
123
+ new_char: FontStyle = FontStyle.get(value=style, default=FontStyle.SOLID)
124
+ return [row.replace(FontStyle.SOLID.text, new_char.text) for row in block_rows]
142
125
  except (KeyError, AttributeError) as e:
143
- available = ", ".join(Style._value2member_map_.keys())
126
+ available = ", ".join(FontStyle.keys())
144
127
  raise ValueError(f"Invalid style: {style}. Available styles: {available}") from e
145
128
 
146
129
 
147
- console = Console()
148
-
149
-
150
130
  def char_to_block(char: str) -> list[str]:
151
131
  """Convert a single character to its block font representation."""
152
132
  return BLOCK_LETTERS.get(char.upper(), [" "] * 5)
@@ -190,15 +170,16 @@ def print_block_font(text: str, color: str = Theme.neon_green) -> None:
190
170
  console.print(Align.center(f"[{color}]{row}[/{color}]"))
191
171
 
192
172
 
193
- def show_off_styles(word: str, style: str = Theme.primary) -> None:
173
+ def show_off_styles(word: str, style: str | None = None) -> None:
194
174
  """Display all block styles by using an example word"""
195
175
  console.print("Available block styles:")
196
176
 
197
- for symbol in Style:
198
- styled_word = word_to_block(word, font=symbol.name.lower())
177
+ for symbol in FontStyle:
178
+ styled_word = word_to_block(word, font=symbol)
179
+ style = random_style()
199
180
 
200
181
  console.print()
201
- console.print(Align.center(f"[{Theme.system}]{symbol.name.title()} Style:[/]"))
182
+ console.print(Align.center(f"[{Theme.system}]{symbol.title()} Style:[/]"))
202
183
  console.print(Align.center(f"[{style}]{styled_word}[/]"))
203
184
  console.print()
204
185
 
@@ -207,5 +188,5 @@ __all__ = ["BLOCK_LETTERS", "char_to_block", "word_to_block"]
207
188
  # fmt: on
208
189
 
209
190
  if __name__ == "__main__":
210
- WORD = "CLAUDE"
191
+ WORD = "CLAIRE"
211
192
  show_off_styles(WORD)
@@ -1 +0,0 @@
1
- version = "0.9.4"
@@ -1,11 +0,0 @@
1
- class CyberTheme:
2
- """Namespace for cyberpunk color theme constants."""
3
-
4
- primary: str = "bright_magenta"
5
- neon_green: str = "bright_green"
6
- neon_cyan: str = "bright_cyan"
7
- warning: str = "bright_yellow"
8
- error: str = "bright_red"
9
- credits: str = "bright_yellow"
10
- data: str = "bright_blue"
11
- system: str = "dim white"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes