bear-utils 0.0.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.
Files changed (107) hide show
  1. bear_utils/__init__.py +51 -0
  2. bear_utils/__main__.py +14 -0
  3. bear_utils/_internal/__init__.py +0 -0
  4. bear_utils/_internal/_version.py +1 -0
  5. bear_utils/_internal/cli.py +119 -0
  6. bear_utils/_internal/debug.py +174 -0
  7. bear_utils/ai/__init__.py +30 -0
  8. bear_utils/ai/ai_helpers/__init__.py +136 -0
  9. bear_utils/ai/ai_helpers/_common.py +19 -0
  10. bear_utils/ai/ai_helpers/_config.py +24 -0
  11. bear_utils/ai/ai_helpers/_parsers.py +194 -0
  12. bear_utils/ai/ai_helpers/_types.py +15 -0
  13. bear_utils/cache/__init__.py +131 -0
  14. bear_utils/cli/__init__.py +22 -0
  15. bear_utils/cli/_args.py +12 -0
  16. bear_utils/cli/_get_version.py +207 -0
  17. bear_utils/cli/commands.py +105 -0
  18. bear_utils/cli/prompt_helpers.py +186 -0
  19. bear_utils/cli/shell/__init__.py +1 -0
  20. bear_utils/cli/shell/_base_command.py +81 -0
  21. bear_utils/cli/shell/_base_shell.py +430 -0
  22. bear_utils/cli/shell/_common.py +19 -0
  23. bear_utils/cli/typer_bridge.py +90 -0
  24. bear_utils/config/__init__.py +13 -0
  25. bear_utils/config/config_manager.py +229 -0
  26. bear_utils/config/dir_manager.py +69 -0
  27. bear_utils/config/settings_manager.py +179 -0
  28. bear_utils/constants/__init__.py +90 -0
  29. bear_utils/constants/_exceptions.py +8 -0
  30. bear_utils/constants/_exit_code.py +60 -0
  31. bear_utils/constants/_http_status_code.py +37 -0
  32. bear_utils/constants/_lazy_typing.py +15 -0
  33. bear_utils/constants/_meta.py +196 -0
  34. bear_utils/constants/date_related.py +25 -0
  35. bear_utils/constants/time_related.py +24 -0
  36. bear_utils/database/__init__.py +8 -0
  37. bear_utils/database/_db_manager.py +98 -0
  38. bear_utils/events/__init__.py +18 -0
  39. bear_utils/events/events_class.py +52 -0
  40. bear_utils/events/events_module.py +74 -0
  41. bear_utils/extras/__init__.py +28 -0
  42. bear_utils/extras/_async_helpers.py +67 -0
  43. bear_utils/extras/_tools.py +185 -0
  44. bear_utils/extras/_zapper.py +399 -0
  45. bear_utils/extras/platform_utils.py +57 -0
  46. bear_utils/extras/responses/__init__.py +5 -0
  47. bear_utils/extras/responses/function_response.py +451 -0
  48. bear_utils/extras/wrappers/__init__.py +1 -0
  49. bear_utils/extras/wrappers/add_methods.py +100 -0
  50. bear_utils/extras/wrappers/string_io.py +46 -0
  51. bear_utils/files/__init__.py +6 -0
  52. bear_utils/files/file_handlers/__init__.py +5 -0
  53. bear_utils/files/file_handlers/_base_file_handler.py +107 -0
  54. bear_utils/files/file_handlers/file_handler_factory.py +280 -0
  55. bear_utils/files/file_handlers/json_file_handler.py +71 -0
  56. bear_utils/files/file_handlers/log_file_handler.py +40 -0
  57. bear_utils/files/file_handlers/toml_file_handler.py +76 -0
  58. bear_utils/files/file_handlers/txt_file_handler.py +76 -0
  59. bear_utils/files/file_handlers/yaml_file_handler.py +64 -0
  60. bear_utils/files/ignore_parser.py +293 -0
  61. bear_utils/graphics/__init__.py +6 -0
  62. bear_utils/graphics/bear_gradient.py +145 -0
  63. bear_utils/graphics/font/__init__.py +13 -0
  64. bear_utils/graphics/font/_raw_block_letters.py +463 -0
  65. bear_utils/graphics/font/_theme.py +31 -0
  66. bear_utils/graphics/font/_utils.py +220 -0
  67. bear_utils/graphics/font/block_font.py +192 -0
  68. bear_utils/graphics/font/glitch_font.py +63 -0
  69. bear_utils/graphics/image_helpers.py +45 -0
  70. bear_utils/gui/__init__.py +8 -0
  71. bear_utils/gui/gui_tools/__init__.py +10 -0
  72. bear_utils/gui/gui_tools/_settings.py +36 -0
  73. bear_utils/gui/gui_tools/_types.py +12 -0
  74. bear_utils/gui/gui_tools/qt_app.py +150 -0
  75. bear_utils/gui/gui_tools/qt_color_picker.py +130 -0
  76. bear_utils/gui/gui_tools/qt_file_handler.py +130 -0
  77. bear_utils/gui/gui_tools/qt_input_dialog.py +303 -0
  78. bear_utils/logger_manager/__init__.py +109 -0
  79. bear_utils/logger_manager/_common.py +63 -0
  80. bear_utils/logger_manager/_console_junk.py +135 -0
  81. bear_utils/logger_manager/_log_level.py +50 -0
  82. bear_utils/logger_manager/_styles.py +95 -0
  83. bear_utils/logger_manager/logger_protocol.py +42 -0
  84. bear_utils/logger_manager/loggers/__init__.py +1 -0
  85. bear_utils/logger_manager/loggers/_console.py +223 -0
  86. bear_utils/logger_manager/loggers/_level_sin.py +61 -0
  87. bear_utils/logger_manager/loggers/_logger.py +19 -0
  88. bear_utils/logger_manager/loggers/base_logger.py +244 -0
  89. bear_utils/logger_manager/loggers/base_logger.pyi +51 -0
  90. bear_utils/logger_manager/loggers/basic_logger/__init__.py +5 -0
  91. bear_utils/logger_manager/loggers/basic_logger/logger.py +80 -0
  92. bear_utils/logger_manager/loggers/basic_logger/logger.pyi +19 -0
  93. bear_utils/logger_manager/loggers/buffer_logger.py +57 -0
  94. bear_utils/logger_manager/loggers/console_logger.py +278 -0
  95. bear_utils/logger_manager/loggers/console_logger.pyi +50 -0
  96. bear_utils/logger_manager/loggers/fastapi_logger.py +333 -0
  97. bear_utils/logger_manager/loggers/file_logger.py +151 -0
  98. bear_utils/logger_manager/loggers/simple_logger.py +98 -0
  99. bear_utils/logger_manager/loggers/sub_logger.py +105 -0
  100. bear_utils/logger_manager/loggers/sub_logger.pyi +23 -0
  101. bear_utils/monitoring/__init__.py +13 -0
  102. bear_utils/monitoring/_common.py +28 -0
  103. bear_utils/monitoring/host_monitor.py +346 -0
  104. bear_utils/time/__init__.py +59 -0
  105. bear_utils-0.0.1.dist-info/METADATA +305 -0
  106. bear_utils-0.0.1.dist-info/RECORD +107 -0
  107. bear_utils-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,463 @@
1
+ # ruff: noqa: E741
2
+ # fmt: off
3
+ A = [
4
+ " █████ ",
5
+ "██ ██ ",
6
+ "███████ ",
7
+ "██ ██ ",
8
+ "██ ██ "
9
+ ]
10
+
11
+ B = [
12
+ "██████ ",
13
+ "██ ██ ",
14
+ "██████ ",
15
+ "██ ██ ",
16
+ "██████ "
17
+ ]
18
+
19
+ C = [
20
+ " ██████ ",
21
+ "██ ",
22
+ "██ ",
23
+ "██ ",
24
+ " ██████ "
25
+ ]
26
+
27
+ D = [
28
+ "██████ ",
29
+ "██ ██ ",
30
+ "██ ██ ",
31
+ "██ ██ ",
32
+ "██████ "
33
+ ]
34
+
35
+ E = [
36
+ "███████ ",
37
+ "██ ",
38
+ "█████ ",
39
+ "██ ",
40
+ "███████ "
41
+ ]
42
+
43
+ F = [
44
+ "███████ ",
45
+ "██ ",
46
+ "█████ ",
47
+ "██ ",
48
+ "██ "
49
+ ]
50
+
51
+ G = [
52
+ " ██████ ",
53
+ "██ ",
54
+ "██ ███ ",
55
+ "██ ██ ",
56
+ " ██████ "
57
+ ]
58
+
59
+ H = [
60
+ "██ ██ ",
61
+ "██ ██ ",
62
+ "███████ ",
63
+ "██ ██ ",
64
+ "██ ██ "
65
+ ]
66
+
67
+ I = [
68
+ "███████ ",
69
+ " ██ ",
70
+ " ██ ",
71
+ " ██ ",
72
+ "███████ "
73
+ ]
74
+
75
+ J = [
76
+ "███████ ",
77
+ " ██ ",
78
+ " ██ ",
79
+ "██ ██ ",
80
+ " ██████ "
81
+ ]
82
+
83
+ K = [
84
+ "██ ██ ",
85
+ "██ ██ ",
86
+ "█████ ",
87
+ "██ ██ ",
88
+ "██ ██ "
89
+ ]
90
+
91
+ L = [
92
+ "██ ",
93
+ "██ ",
94
+ "██ ",
95
+ "██ ",
96
+ "███████ "
97
+ ]
98
+
99
+ M = [
100
+ "██ ██ ",
101
+ "███ ███ ",
102
+ "██ █ ██ ",
103
+ "██ ██ ",
104
+ "██ ██ "
105
+ ]
106
+
107
+ N = [
108
+ "██ ██ ",
109
+ "███ ██ ",
110
+ "██ █ ██ ",
111
+ "██ ███ ",
112
+ "██ ██ "
113
+ ]
114
+
115
+ O = [
116
+ " ██████ ",
117
+ "██ ██",
118
+ "██ ██",
119
+ "██ ██",
120
+ " ██████ "
121
+ ]
122
+
123
+ P = [
124
+ "██████ ",
125
+ "██ ██ ",
126
+ "██████ ",
127
+ "██ ",
128
+ "██ "
129
+ ]
130
+
131
+ Q = [
132
+ " ██████ ",
133
+ "██ ██",
134
+ "██ █ ██",
135
+ "██ ██ ",
136
+ " ██████ "
137
+ ]
138
+
139
+ R = [
140
+ "██████ ",
141
+ "██ ██ ",
142
+ "██████ ",
143
+ "██ ██ ",
144
+ "██ ██ "
145
+ ]
146
+
147
+ S = [
148
+ " ██████ ",
149
+ "██ ",
150
+ " ██████ ",
151
+ " ██",
152
+ " ██████ "
153
+ ]
154
+
155
+ T = [
156
+ "███████ ",
157
+ " ██ ",
158
+ " ██ ",
159
+ " ██ ",
160
+ " ██ "
161
+ ]
162
+
163
+ U = [
164
+ "██ ██ ",
165
+ "██ ██ ",
166
+ "██ ██ ",
167
+ "██ ██ ",
168
+ " ██████ "
169
+ ]
170
+
171
+ V = [
172
+ "██ ██ ",
173
+ "██ ██ ",
174
+ "██ ██ ",
175
+ " █ █ █ ",
176
+ " █ █ "
177
+ ]
178
+
179
+ W = [
180
+ "██ ██ ",
181
+ "██ ██ ",
182
+ "██ █ ██ ",
183
+ "███████ ",
184
+ "██ ██ "
185
+ ]
186
+
187
+ X = [
188
+ "██ ██ ",
189
+ " █ █ █ ",
190
+ " █ █ ",
191
+ " █ █ █ ",
192
+ "██ ██ "
193
+ ]
194
+
195
+ Y = [
196
+ "██ ██ ",
197
+ " █ █ █ ",
198
+ " █ █ ",
199
+ " ██ ",
200
+ " ██ "
201
+ ]
202
+
203
+ Z = [
204
+ "███████ ",
205
+ " ██ ",
206
+ " ██ ",
207
+ " ██ ",
208
+ "███████ "
209
+ ]
210
+
211
+ ZERO = [
212
+ " ██████ ",
213
+ "██ ██",
214
+ "██ █ ██",
215
+ "██ ██ ",
216
+ " ██████ "
217
+ ]
218
+
219
+ ONE = [
220
+ " ██ ",
221
+ " ███ ",
222
+ " ██ ",
223
+ " ██ ",
224
+ "███████ "
225
+ ]
226
+
227
+ TWO = [
228
+ " ██████ ",
229
+ "██ ██",
230
+ " ██ ",
231
+ " ██ ",
232
+ "███████ "
233
+ ]
234
+
235
+ THREE = [
236
+ " ██████ ",
237
+ "██ ██",
238
+ " ██ ",
239
+ "██ ██",
240
+ " ██████ "
241
+ ]
242
+
243
+ FOUR = [
244
+ "██ ██ ",
245
+ "██ ██ ",
246
+ "███████ ",
247
+ " ██ ",
248
+ " ██ "
249
+ ]
250
+
251
+ FIVE = [
252
+ "███████ ",
253
+ "██ ",
254
+ "██████ ",
255
+ " ██ ",
256
+ " ██████ "
257
+ ]
258
+
259
+ SIX = [
260
+ " ██████ ",
261
+ "██ ",
262
+ "██████ ",
263
+ "██ ██",
264
+ " ██████ "
265
+ ]
266
+
267
+ SEVEN = [
268
+ "███████ ",
269
+ " ██ ",
270
+ " ██ ",
271
+ " ██ ",
272
+ " ██ "
273
+ ]
274
+
275
+ EIGHT = [
276
+ " ██████ ",
277
+ "██ ██",
278
+ " ██████ ",
279
+ "██ ██",
280
+ " ██████ "
281
+ ]
282
+
283
+ NINE = [
284
+ " ██████ ",
285
+ "██ ██",
286
+ " ██████ ",
287
+ " ██ ",
288
+ " ██████ "
289
+ ]
290
+
291
+ SPACE = [
292
+ " ",
293
+ " ",
294
+ " ",
295
+ " ",
296
+ " "
297
+ ]
298
+
299
+ EXCLAMATION = [
300
+ " ██ ",
301
+ " ██ ",
302
+ " ██ ",
303
+ " ",
304
+ " ██ "
305
+ ]
306
+
307
+ QUESTION = [
308
+ " ██████ ",
309
+ "██ ██",
310
+ " ██ ",
311
+ " ██ ",
312
+ " ██ "
313
+ ]
314
+
315
+ DOT = [
316
+ " ",
317
+ " ",
318
+ " ██ ",
319
+ " ██ ",
320
+ " ██ "
321
+ ]
322
+
323
+ COMMA = [
324
+ " ",
325
+ " ",
326
+ " ██ ",
327
+ " ██ ",
328
+ " ██ "
329
+ ]
330
+
331
+ DASH = [
332
+ " ",
333
+ " ",
334
+ "███████ ",
335
+ " ",
336
+ " "
337
+ ]
338
+
339
+ UNDERSCORE = [
340
+ " ",
341
+ " ",
342
+ " ",
343
+ " ",
344
+ "███████ "
345
+ ]
346
+
347
+ EQUALS = [
348
+ " ",
349
+ "███████ ",
350
+ " ",
351
+ "███████ ",
352
+ " "
353
+ ]
354
+
355
+ PLUS = [
356
+ " ",
357
+ " ██ ",
358
+ "███████ ",
359
+ " ██ ",
360
+ " "
361
+ ]
362
+
363
+ ASTERISK = [
364
+ " ██ ",
365
+ " ██████ ",
366
+ "████████",
367
+ " ██████ ",
368
+ " ██ "
369
+ ]
370
+
371
+ FORWARD_SLASH = [
372
+ " ██ ",
373
+ " ██ ",
374
+ " ██ ",
375
+ " ██ ",
376
+ " ██ "
377
+ ]
378
+
379
+ BACKWARD_SLASH = [
380
+ " ██ ",
381
+ " ██ ",
382
+ " ██ ",
383
+ " ██ ",
384
+ " ██ "
385
+ ]
386
+
387
+ AT = [
388
+ " ██████ ",
389
+ "██ ██",
390
+ "██ ███ ██",
391
+ "██ ██ ",
392
+ " ██████ "
393
+ ]
394
+
395
+ HASH = [
396
+ " ██ ",
397
+ "███████ ",
398
+ " ██ ",
399
+ "███████ ",
400
+ " ██ "
401
+ ]
402
+
403
+ DOLLAR = [
404
+ " ██████ ",
405
+ " ██ ██",
406
+ " ██ ███ ██",
407
+ " ██ ██ ",
408
+ " ██████ "
409
+ ]
410
+
411
+ __all__ = [
412
+ "ASTERISK",
413
+ "AT",
414
+ "BACKWARD_SLASH",
415
+ "COMMA",
416
+ "DASH",
417
+ "DOLLAR",
418
+ "DOT",
419
+ "EIGHT",
420
+ "EQUALS",
421
+ "EXCLAMATION",
422
+ "FIVE",
423
+ "FORWARD_SLASH",
424
+ "FOUR",
425
+ "HASH",
426
+ "NINE",
427
+ "ONE",
428
+ "PLUS",
429
+ "QUESTION",
430
+ "SEVEN",
431
+ "SIX",
432
+ "SPACE",
433
+ "THREE",
434
+ "TWO",
435
+ "UNDERSCORE",
436
+ "ZERO",
437
+ "A",
438
+ "B",
439
+ "C",
440
+ "D",
441
+ "E",
442
+ "F",
443
+ "G",
444
+ "H",
445
+ "I",
446
+ "J",
447
+ "K",
448
+ "L",
449
+ "M",
450
+ "N",
451
+ "O",
452
+ "P",
453
+ "Q",
454
+ "R",
455
+ "S",
456
+ "T",
457
+ "U",
458
+ "V",
459
+ "W",
460
+ "X",
461
+ "Y",
462
+ "Z",
463
+ ]
@@ -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", "★")
@@ -0,0 +1,220 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from io import StringIO
5
+ import os
6
+
7
+ from pyfiglet import figlet_format
8
+ from rich.align import Align
9
+ from rich.panel import Panel
10
+ from rich.text import Text
11
+
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
15
+ from bear_utils.logger_manager import LogConsole as Console
16
+
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
+
31
+ @dataclass
32
+ class HeaderConfig:
33
+ """Configuration for header styling."""
34
+
35
+ top_sep: str = "#"
36
+ left_sep: str = ">"
37
+ right_sep: str = "<"
38
+ bottom_sep: str = "#"
39
+ length: int = 60
40
+ title_style: str = "bold red" # s1
41
+ border_style: str = "bold blue" # s2 - top/bottom lines
42
+ separator_style: str = "bold green" # s3 - left/right separators
43
+ overall_style: str = "bold yellow" # s4
44
+ border_enabled: bool = True
45
+ center_align: bool = True
46
+ return_txt: bool = False
47
+ use_panel: bool = False
48
+
49
+
50
+ class TextHelper:
51
+ def _create_separator_line(self, char: str, length: int, style: str) -> Text:
52
+ """Create a styled separator line."""
53
+ return Text(char * length, style=style)
54
+
55
+ def _create_title_line_manual(self, title: str, cfg: HeaderConfig) -> Text:
56
+ """Create title line with manual separator padding."""
57
+ title_with_spaces = f" {title} "
58
+ title_length = len(title_with_spaces)
59
+ remaining_space = cfg.length - title_length
60
+ left_padding = remaining_space // 2
61
+ right_padding = remaining_space - left_padding
62
+ title_line = Text()
63
+ title_line.append(cfg.left_sep * left_padding, style=cfg.separator_style)
64
+ title_line.append(f" {title} ", style=cfg.title_style)
65
+ title_line.append(cfg.right_sep * right_padding, style=cfg.separator_style)
66
+ return title_line
67
+
68
+ def _create_title_line_rich(self, title: str, cfg: HeaderConfig) -> Text:
69
+ """Create title line using Rich's alignment."""
70
+ styled_title = Text(f" {title} ", style=cfg.title_style)
71
+ title_line = Text()
72
+ title_line.append(cfg.left_sep, style=cfg.separator_style)
73
+ title_line.append(styled_title)
74
+ title_line.append(cfg.right_sep, style=cfg.separator_style)
75
+ return Text.from_markup(str(Align.center(title_line, width=cfg.length)))
76
+
77
+ def _create_panel_header(self, title: str, cfg: HeaderConfig) -> Panel:
78
+ """Create header using Rich Panel."""
79
+ return Panel(
80
+ f"[{cfg.title_style}]{title}[/{cfg.title_style}]",
81
+ width=cfg.length,
82
+ border_style=cfg.border_style,
83
+ expand=False,
84
+ )
85
+
86
+ def _create_manual_header(self, title: str, cfg: HeaderConfig) -> list[Text]:
87
+ """Create header using manual separator lines."""
88
+ top_line = self._create_separator_line(cfg.top_sep, cfg.length, cfg.border_style)
89
+ bottom_line = self._create_separator_line(cfg.bottom_sep, cfg.length, cfg.border_style)
90
+ title_line = self._create_title_line_manual(title, cfg)
91
+
92
+ return [top_line, title_line, bottom_line]
93
+
94
+ def print_header(self, title: str, config: HeaderConfig | None = None, **kwargs) -> str:
95
+ """Generate a header string with customizable separators and styling.
96
+
97
+ Args:
98
+ title: The title text to display
99
+ config: HeaderConfig object, or None to use defaults
100
+ **kwargs: Override any config values (top_sep, left_sep, etc.)
101
+ """
102
+ local_console = Console()
103
+ cfg: HeaderConfig = config or HeaderConfig()
104
+ for key, value in kwargs.items():
105
+ if hasattr(cfg, key):
106
+ setattr(cfg, key, value)
107
+
108
+ if cfg.use_panel:
109
+ panel: Panel = self._create_panel_header(title, cfg)
110
+ output: Align | Panel = Align.center(panel) if cfg.center_align else panel
111
+
112
+ if not cfg.return_txt:
113
+ local_console.print(output, style=cfg.overall_style)
114
+
115
+ temp_console: Console[StringIO] = Console(file=StringIO(), width=cfg.length)
116
+ temp_console.print(output, style=cfg.overall_style)
117
+ return temp_console.file.getvalue()
118
+
119
+ header_lines = self._create_manual_header(title, cfg)
120
+
121
+ if cfg.center_align:
122
+ header_lines = [Align.center(line) for line in header_lines]
123
+
124
+ if not cfg.return_txt:
125
+ for line in header_lines:
126
+ local_console.print(line, style=cfg.overall_style)
127
+ output_lines: list[str] = [str(line) for line in header_lines]
128
+ return "\n" + "\n".join(output_lines) + "\n"
129
+
130
+ def quick_header(self, title: str, style: str = "cyberpunk") -> str:
131
+ """Quick header with predefined styles."""
132
+ styles = {
133
+ "cyberpunk": HeaderConfig(
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),
138
+ title_style="bold bright_magenta",
139
+ border_style="bright_cyan",
140
+ separator_style="bright_green",
141
+ overall_style="",
142
+ use_panel=False,
143
+ ),
144
+ "panel": HeaderConfig(title_style="bold bright_magenta", border_style="bright_cyan", use_panel=True),
145
+ "classic": HeaderConfig(), # Uses defaults
146
+ "minimal": HeaderConfig(top_sep="─", left_sep="", right_sep="", bottom_sep="─", separator_style="dim"),
147
+ }
148
+
149
+ config = styles.get(style, HeaderConfig())
150
+ return self.print_header(title, config)
151
+
152
+
153
+ def ascii_header(title: str, print_out: bool = True, **kwargs) -> str:
154
+ """Generate a header string for visual tests.
155
+
156
+ Args:
157
+ title: The title to display
158
+ print_out: Whether to print or return the header
159
+ **kwargs: Any HeaderConfig parameters (top_sep, length, etc.)
160
+ """
161
+ config = HeaderConfig(return_txt=not print_out, **kwargs)
162
+ text_helper = TextHelper()
163
+ result = text_helper.print_header(title, config)
164
+ return "" if print_out else result
165
+
166
+
167
+ if __name__ == "__main__":
168
+ top: str = ""
169
+ bottom: str = ""
170
+ left: str = FontStyle.HOLLOW.text
171
+ right: str = FontStyle.HOLLOW.text
172
+ ascii_header(
173
+ "CYBERDYNE BANKING SYSTEM",
174
+ top_sep=top,
175
+ bottom_sep=bottom,
176
+ left_sep=left,
177
+ right_sep=right,
178
+ title_style="red",
179
+ separator_style="black",
180
+ border_style="black",
181
+ print_out=True,
182
+ )
183
+
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 = ""