bear-utils 0.9.4__tar.gz → 0.9.6__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.
- {bear_utils-0.9.4 → bear_utils-0.9.6}/PKG-INFO +1 -1
- {bear_utils-0.9.4 → bear_utils-0.9.6}/pyproject.toml +1 -1
- bear_utils-0.9.6/src/bear_utils/_internal/_version.py +1 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/_internal/cli.py +8 -8
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/_internal/debug.py +4 -4
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/font/__init__.py +3 -0
- bear_utils-0.9.6/src/bear_utils/graphics/font/_theme.py +31 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/font/_utils.py +71 -36
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/font/block_font.py +12 -31
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/_console.py +27 -8
- bear_utils-0.9.4/src/bear_utils/_internal/_version.py +0 -1
- bear_utils-0.9.4/src/bear_utils/graphics/font/_theme.py +0 -11
- {bear_utils-0.9.4 → bear_utils-0.9.6}/.gitignore +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/.python-version +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/AGENTS.md +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/README.md +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/config/coverage.ini +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/config/default.toml +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/config/git-changelog.toml +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/config/pytest.ini +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/config/ruff.toml +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/directory_structure.txt +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/directory_structure.xml +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/maskfile.md +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/noxfile.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/__main__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/_internal/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/ai/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/ai/ai_helpers/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/ai/ai_helpers/_common.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/ai/ai_helpers/_config.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/ai/ai_helpers/_parsers.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/ai/ai_helpers/_types.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cache/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/_args.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/_get_version.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/commands.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/prompt_helpers.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/shell/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/shell/_base_command.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/shell/_base_shell.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/shell/_common.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/cli/typer_bridge.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/config/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/config/config_manager.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/config/dir_manager.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/config/settings_manager.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/_exceptions.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/_exit_code.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/_http_status_code.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/_lazy_typing.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/_meta.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/date_related.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/constants/time_related.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/database/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/database/_db_manager.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/events/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/events/events_class.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/events/events_module.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/_async_helpers.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/_tools.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/_zapper.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/platform_utils.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/responses/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/responses/function_response.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/wrappers/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/wrappers/add_methods.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/extras/wrappers/string_io.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/_base_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/file_handler_factory.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/json_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/log_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/toml_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/txt_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/yaml_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/ignore_parser.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/bear_gradient.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/font/_raw_block_letters.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/font/glitch_font.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/graphics/image_helpers.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/_settings.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/_types.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/qt_app.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/qt_color_picker.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/qt_file_handler.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/gui/gui_tools/qt_input_dialog.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/_common.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/_console_junk.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/_log_level.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/_styles.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/logger_protocol.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/_level_sin.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/base_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/base_logger.pyi +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/basic_logger/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/basic_logger/logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/basic_logger/logger.pyi +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/buffer_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/console_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/console_logger.pyi +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/fastapi_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/file_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/simple_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/sub_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/sub_logger.pyi +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/monitoring/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/monitoring/_common.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/monitoring/host_monitor.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/time/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/__init__.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_add_ord_suffix.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_clipboard.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_database_manager.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_default_shell.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_font_utils.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_function_response.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_gradient.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_logger.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/tests/test_platform_utils.py +0 -0
- {bear_utils-0.9.4 → bear_utils-0.9.6}/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.
|
3
|
+
Version: 0.9.6
|
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.6"
|
@@ -15,9 +15,9 @@ import sys
|
|
15
15
|
from typing import Any
|
16
16
|
|
17
17
|
from bear_utils._internal import debug
|
18
|
-
from bear_utils._internal._version import
|
18
|
+
from bear_utils._internal._version import __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):
|
@@ -50,7 +50,7 @@ class _Version(Action):
|
|
50
50
|
|
51
51
|
def get_version() -> ExitCode:
|
52
52
|
"""CLI command to get the version of the package."""
|
53
|
-
print(
|
53
|
+
print(__version__)
|
54
54
|
return ExitCode.SUCCESS
|
55
55
|
|
56
56
|
|
@@ -64,7 +64,7 @@ def bump_version(args: list[str] | None = None) -> ExitCode:
|
|
64
64
|
help=f"Type of version bump: {', '.join(VALID_BUMP_TYPES)}",
|
65
65
|
)
|
66
66
|
_args: Namespace = parser.parse_args(args or sys.argv[1:])
|
67
|
-
return cli_bump([_args.bump_type, debug.__PACKAGE_NAME__,
|
67
|
+
return cli_bump([_args.bump_type, debug.__PACKAGE_NAME__, __version__])
|
68
68
|
|
69
69
|
|
70
70
|
def get_parser() -> ArgumentParser:
|
@@ -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.",
|
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}",
|
113
|
+
print(f"Error initializing CLI: {e}", STDERR)
|
114
114
|
return ExitCode.FAILURE
|
115
115
|
return ExitCode.SUCCESS
|
116
116
|
|
@@ -7,7 +7,7 @@ import os
|
|
7
7
|
import platform
|
8
8
|
import sys
|
9
9
|
|
10
|
-
from bear_utils._internal._version import
|
10
|
+
from bear_utils._internal._version import __version__
|
11
11
|
from bear_utils.cli._get_version import Version
|
12
12
|
|
13
13
|
__PACKAGE_NAME__ = "bear-utils"
|
@@ -19,9 +19,9 @@ class _Package:
|
|
19
19
|
|
20
20
|
name: str = __PACKAGE_NAME__
|
21
21
|
"""Package name."""
|
22
|
-
version: str =
|
22
|
+
version: str = __version__
|
23
23
|
"""Package version."""
|
24
|
-
_version: Version = field(default_factory=lambda: Version.from_string(
|
24
|
+
_version: Version = field(default_factory=lambda: Version.from_string(__version__))
|
25
25
|
description: str = "No description available."
|
26
26
|
"""Package description."""
|
27
27
|
|
@@ -83,7 +83,7 @@ def _get_package_info(dist: str = __PACKAGE_NAME__) -> _Package:
|
|
83
83
|
try:
|
84
84
|
return _Package(
|
85
85
|
name=dist,
|
86
|
-
version=
|
86
|
+
version=__version__ or version(dist),
|
87
87
|
description=metadata(dist)["Summary"],
|
88
88
|
)
|
89
89
|
except PackageNotFoundError:
|
@@ -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.
|
11
|
-
from bear_utils.graphics
|
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
|
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(
|
120
|
-
left_sep=str(
|
121
|
-
right_sep=str(
|
122
|
-
bottom_sep=str(
|
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 =
|
154
|
-
bottom =
|
155
|
-
left =
|
156
|
-
right =
|
168
|
+
top: str = ""
|
169
|
+
bottom: str = ""
|
170
|
+
left: str = FontStyle.HOLLOW.text
|
171
|
+
right: str = FontStyle.HOLLOW.text
|
157
172
|
ascii_header(
|
158
|
-
"
|
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=
|
164
|
-
separator_style=
|
165
|
-
border_style=
|
178
|
+
title_style="red",
|
179
|
+
separator_style="black",
|
180
|
+
border_style="black",
|
166
181
|
print_out=True,
|
167
182
|
)
|
168
183
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
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.
|
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:
|
141
|
-
return [row.replace(
|
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(
|
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 =
|
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
|
198
|
-
styled_word = word_to_block(word, font=symbol
|
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.
|
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 = "
|
191
|
+
WORD = "CLAIRE"
|
211
192
|
show_off_styles(WORD)
|
@@ -15,6 +15,8 @@ from rich.text import Text
|
|
15
15
|
from rich.theme import Theme, ThemeStack
|
16
16
|
from rich.themes import DEFAULT
|
17
17
|
|
18
|
+
from bear_utils.logger_manager._log_level import LogLevel
|
19
|
+
|
18
20
|
if TYPE_CHECKING:
|
19
21
|
from rich.color import ColorSystem
|
20
22
|
from rich.live import Live
|
@@ -62,6 +64,7 @@ class LogConsole[T: TextIO](Console):
|
|
62
64
|
get_datetime: Callable[[], datetime] | None = None,
|
63
65
|
get_time: Callable[[], float] | None = None,
|
64
66
|
_environ: Mapping[str, str] | None = None,
|
67
|
+
level: str | int | LogLevel = LogLevel.INFO,
|
65
68
|
):
|
66
69
|
# Copy of os.environ allows us to replace it for testing
|
67
70
|
if _environ is not None:
|
@@ -144,6 +147,7 @@ class LogConsole[T: TextIO](Console):
|
|
144
147
|
self._render_hooks: list[RenderHook] = []
|
145
148
|
self._live: Live | None = None
|
146
149
|
self._is_alt_screen = False
|
150
|
+
self.level: LogLevel = LogLevel.get(level, default=LogLevel.INFO)
|
147
151
|
|
148
152
|
@property
|
149
153
|
def file(self) -> T:
|
@@ -159,37 +163,52 @@ class LogConsole[T: TextIO](Console):
|
|
159
163
|
"""Set a new file object."""
|
160
164
|
self._file = new_file
|
161
165
|
|
166
|
+
def _log(self, level: LogLevel, msg: object, *args, **kwargs) -> None:
|
167
|
+
"""Log a message at the specified level.
|
168
|
+
|
169
|
+
Args:
|
170
|
+
level (LogLevel): The log level for the message. We aren't using this parameter in the current implementation,
|
171
|
+
msg (object): The message to log.
|
172
|
+
*args: Additional positional arguments.
|
173
|
+
**kwargs: Additional keyword arguments.
|
174
|
+
"""
|
175
|
+
if level.value >= self.level.value:
|
176
|
+
"""Log a message at the specified level."""
|
177
|
+
with self._lock:
|
178
|
+
if not self.quiet:
|
179
|
+
self.log(msg, *args, **kwargs)
|
180
|
+
|
162
181
|
def info(self, msg: object, *args, **kwargs) -> None:
|
163
182
|
"""Log an informational message to the console."""
|
164
|
-
self.
|
183
|
+
self._log(LogLevel.INFO, msg, *args, **kwargs)
|
165
184
|
|
166
185
|
def warning(self, msg: object, *args, **kwargs) -> None:
|
167
186
|
"""Log a warning message to the console."""
|
168
|
-
self.
|
187
|
+
self._log(LogLevel.WARNING, msg, *args, **kwargs)
|
169
188
|
|
170
189
|
def error(self, msg: object, *args, **kwargs) -> None:
|
171
190
|
"""Log an error message to the console."""
|
172
|
-
self.
|
191
|
+
self._log(LogLevel.ERROR, msg, *args, **kwargs)
|
173
192
|
|
174
193
|
def debug(self, msg: object, *args, **kwargs) -> None:
|
175
194
|
"""Log a debug message to the console."""
|
176
|
-
self.
|
195
|
+
self._log(LogLevel.DEBUG, msg, *args, **kwargs)
|
177
196
|
|
178
197
|
def verbose(self, msg: object, *args, **kwargs) -> None:
|
179
198
|
"""Log a verbose message to the console."""
|
180
|
-
self.
|
199
|
+
self._log(LogLevel.VERBOSE, msg, *args, **kwargs)
|
181
200
|
|
182
201
|
def success(self, msg: object, *args, **kwargs) -> None:
|
183
202
|
"""Log a success message to the console."""
|
184
|
-
self.
|
203
|
+
self._log(LogLevel.SUCCESS, msg, *args, **kwargs)
|
185
204
|
|
186
205
|
def failure(self, msg: object, *args, **kwargs) -> None:
|
187
206
|
"""Log a failure message to the console."""
|
188
|
-
self.
|
207
|
+
self._log(LogLevel.FAILURE, msg, *args, **kwargs)
|
189
208
|
|
190
209
|
def exception(self, msg: object, *args, **kwargs) -> None:
|
191
210
|
"""Log an exception message to the console."""
|
192
|
-
self.
|
211
|
+
self._log(LogLevel.ERROR, msg, *args, **kwargs)
|
193
212
|
|
194
213
|
|
195
214
|
if __name__ == "__main__":
|
@@ -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
|
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
|
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
|
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
|
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
|
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
|
File without changes
|
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/_base_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/file_handler_factory.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/json_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/log_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/toml_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/txt_file_handler.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/files/file_handlers/yaml_file_handler.py
RENAMED
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/basic_logger/__init__.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/basic_logger/logger.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/basic_logger/logger.pyi
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/buffer_logger.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/console_logger.py
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/console_logger.pyi
RENAMED
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/fastapi_logger.py
RENAMED
File without changes
|
File without changes
|
{bear_utils-0.9.4 → bear_utils-0.9.6}/src/bear_utils/logger_manager/loggers/simple_logger.py
RENAMED
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|