bear-utils 0.7.14__tar.gz → 0.7.16__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.7.16/.bumpversion.cfg +8 -0
- bear_utils-0.7.16/.gitignore +165 -0
- bear_utils-0.7.16/.python-version +1 -0
- bear_utils-0.7.16/AGENTS.md +11 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/PKG-INFO +18 -22
- {bear_utils-0.7.14 → bear_utils-0.7.16}/README.md +1 -1
- bear_utils-0.7.16/directory_structure.txt +118 -0
- bear_utils-0.7.16/maskfile.md +57 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/pyproject.toml +4 -3
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/__init__.py +1 -1
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/commands.py +40 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/shell/_base_command.py +5 -4
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/file_handler_factory.py +2 -0
- bear_utils-0.7.16/src/bear_utils/files/file_handlers/toml_file_handler.py +68 -0
- bear_utils-0.7.16/tests/__init__.py +0 -0
- bear_utils-0.7.16/tests/test_add_ord_suffix.py +12 -0
- bear_utils-0.7.16/tests/test_clipboard.py +50 -0
- bear_utils-0.7.16/tests/test_default_shell.py +7 -0
- bear_utils-0.7.16/tests/test_gradient.py +49 -0
- bear_utils-0.7.16/tests/test_logger.py +306 -0
- bear_utils-0.7.16/tests/test_platform_utils.py +35 -0
- bear_utils-0.7.16/uv.lock +1064 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/ai/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/ai/ai_helpers/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/ai/ai_helpers/_common.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/ai/ai_helpers/_config.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/ai/ai_helpers/_parsers.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/ai/ai_helpers/_types.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cache/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/prompt_helpers.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/shell/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/shell/_base_shell.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/cli/shell/_common.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/config/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/config/config_manager.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/config/dir_manager.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/config/settings_manager.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/constants/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/constants/_exceptions.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/constants/_lazy_typing.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/constants/date_related.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/constants/time_related.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/database/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/database/_db_manager.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/events/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/events/events_class.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/events/events_module.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/extras/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/extras/_async_helpers.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/extras/_tools.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/extras/platform_utils.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/extras/wrappers/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/extras/wrappers/add_methods.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/_base_file_handler.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/json_file_handler.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/log_file_handler.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/txt_file_handler.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/yaml_file_handler.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/ignore_parser.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/graphics/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/graphics/bear_gradient.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/graphics/image_helpers.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/_settings.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/_types.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/qt_app.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/qt_color_picker.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/qt_file_handler.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/gui/gui_tools/qt_input_dialog.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/_common.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/_console_junk.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/_styles.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_base_logger.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_base_logger.pyi +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_buffer_logger.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_console_logger.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_console_logger.pyi +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_file_logger.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_level_sin.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_logger.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_sub_logger.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/logger_manager/loggers/_sub_logger.pyi +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/logging/loggers.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/monitoring/__init__.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/monitoring/host_monitor.py +0 -0
- {bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/time/__init__.py +0 -0
@@ -0,0 +1,165 @@
|
|
1
|
+
# ---- Python ----
|
2
|
+
# Byte-compiled / optimized / DLL files
|
3
|
+
__pycache__/
|
4
|
+
*.py[cod]
|
5
|
+
*$py.class
|
6
|
+
|
7
|
+
# C extensions
|
8
|
+
*.so
|
9
|
+
|
10
|
+
# Distribution / packaging
|
11
|
+
.Python
|
12
|
+
build/
|
13
|
+
develop-eggs/
|
14
|
+
dist/
|
15
|
+
downloads/
|
16
|
+
eggs/
|
17
|
+
.eggs/
|
18
|
+
lib/
|
19
|
+
lib64/
|
20
|
+
parts/
|
21
|
+
sdist/
|
22
|
+
var/
|
23
|
+
wheels/
|
24
|
+
share/python-wheels/
|
25
|
+
*.egg-info/
|
26
|
+
.installed.cfg
|
27
|
+
*.egg
|
28
|
+
MANIFEST
|
29
|
+
|
30
|
+
# PyInstaller
|
31
|
+
# Usually these files are written by a python script from a template
|
32
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
33
|
+
*.manifest
|
34
|
+
*.spec
|
35
|
+
|
36
|
+
# Installer logs
|
37
|
+
pip-log.txt
|
38
|
+
pip-delete-this-directory.txt
|
39
|
+
|
40
|
+
# Unit test / coverage reports
|
41
|
+
htmlcov/
|
42
|
+
.tox/
|
43
|
+
.nox/
|
44
|
+
.coverage
|
45
|
+
.coverage.*
|
46
|
+
.cache
|
47
|
+
nosetests.xml
|
48
|
+
coverage.xml
|
49
|
+
*.cover
|
50
|
+
*.py,cover
|
51
|
+
.hypothesis/
|
52
|
+
.pytest_cache/
|
53
|
+
cover/
|
54
|
+
|
55
|
+
# Translations
|
56
|
+
*.mo
|
57
|
+
*.pot
|
58
|
+
|
59
|
+
# Django stuff:
|
60
|
+
*.log
|
61
|
+
local_settings.py
|
62
|
+
db.sqlite3
|
63
|
+
db.sqlite3-journal
|
64
|
+
|
65
|
+
# Flask stuff:
|
66
|
+
instance/
|
67
|
+
.webassets-cache
|
68
|
+
|
69
|
+
# Scrapy stuff:
|
70
|
+
.scrapy
|
71
|
+
|
72
|
+
# Sphinx documentation
|
73
|
+
docs/_build/
|
74
|
+
|
75
|
+
# PyBuilder
|
76
|
+
.pybuilder/
|
77
|
+
target/
|
78
|
+
|
79
|
+
# Jupyter Notebook
|
80
|
+
.ipynb_checkpoints
|
81
|
+
|
82
|
+
# IPython
|
83
|
+
profile_default/
|
84
|
+
ipython_config.py
|
85
|
+
|
86
|
+
# pyenv
|
87
|
+
# For a library or package, you might want to ignore these files since the code is
|
88
|
+
# intended to run in multiple environments; otherwise, check them in:
|
89
|
+
# .python-version
|
90
|
+
|
91
|
+
# pipenv
|
92
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
93
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
94
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
95
|
+
# install all needed dependencies.
|
96
|
+
#Pipfile.lock
|
97
|
+
|
98
|
+
# poetry
|
99
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
100
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
101
|
+
# commonly ignored for libraries.
|
102
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
103
|
+
#poetry.lock
|
104
|
+
|
105
|
+
# pdm
|
106
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
107
|
+
#pdm.lock
|
108
|
+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
109
|
+
# in version control.
|
110
|
+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
|
111
|
+
.pdm.toml
|
112
|
+
.pdm-python
|
113
|
+
.pdm-build/
|
114
|
+
|
115
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
116
|
+
__pypackages__/
|
117
|
+
|
118
|
+
# Celery stuff
|
119
|
+
celerybeat-schedule
|
120
|
+
celerybeat.pid
|
121
|
+
|
122
|
+
# SageMath parsed files
|
123
|
+
*.sage.py
|
124
|
+
|
125
|
+
# Environments
|
126
|
+
.env
|
127
|
+
.venv
|
128
|
+
env/
|
129
|
+
venv/
|
130
|
+
ENV/
|
131
|
+
env.bak/
|
132
|
+
venv.bak/
|
133
|
+
|
134
|
+
# Spyder project settings
|
135
|
+
.spyderproject
|
136
|
+
.spyproject
|
137
|
+
|
138
|
+
# Rope project settings
|
139
|
+
.ropeproject
|
140
|
+
|
141
|
+
# mkdocs documentation
|
142
|
+
/site
|
143
|
+
|
144
|
+
# mypy
|
145
|
+
.mypy_cache/
|
146
|
+
.dmypy.json
|
147
|
+
dmypy.json
|
148
|
+
|
149
|
+
# Pyre type checker
|
150
|
+
.pyre/
|
151
|
+
|
152
|
+
# pytype static type analyzer
|
153
|
+
.pytype/
|
154
|
+
|
155
|
+
# Cython debug symbols
|
156
|
+
cython_debug/
|
157
|
+
|
158
|
+
# PyCharm
|
159
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
160
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
161
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
162
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
163
|
+
#.idea/
|
164
|
+
|
165
|
+
**/.vscode
|
@@ -0,0 +1 @@
|
|
1
|
+
3.13.3
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Contributor Guide for AI Agents
|
2
|
+
|
3
|
+
## Dev Environment Guidelines
|
4
|
+
|
5
|
+
- Python Version and Typing: Assume Python 3.12 or higher is being used. Because of that we SHOULD use the latest typing features available in Python 3.12 and later. Never use `Optional`, `Union`, or `Dict, List, Tuple` from `typing` module. Instead, use the built-in types directly, e.g., `list`, `dict`, `tuple`, and use `|` for union types. This is not an exhaustive list, so be thoughtful about any potentially deprecated types you might use. If you are not sure about something, ask the user.
|
6
|
+
- Type Annotations: Use type annotations as often as possible. If a function has no return value, use `None` as the return type. If a function returns a value, use the appropriate type annotation but don't bend over backwards to make it perfect. If you are not sure about the type, use `Any` as a fallback but use this sparingly, see it as a failure and you should endeavor to avoid using `Any` as much as possible.
|
7
|
+
- Docstrings: Use docstrings for most (95%) public functions and classes. The docstring should describe the purpose of the function or class, its parameters, and its return value. Use the Google style for docstrings. Because of this it is highly preferred to not use comments in the code unless absolutely necessary. If you feel like you need to use a comment, consider if the code can be refactored to make it more readable instead.
|
8
|
+
- Imports: Use relative imports for everything (beyond the obvious imports for external packages) in this current package. Keep imports clean using `isort src tests` and `black src tests -l 120` to format the code in that order.
|
9
|
+
- Endeavor to use a TDD approach when writing new code. Write tests first, then write the code to make the tests pass and then refactor the code to make it cleaner and more readable.
|
10
|
+
- There is a `directory_structure.txt` file in the root of the repository that describes the directory structure of the project. Use this as a quick way to understand the project structure and where to place new files or modules.
|
11
|
+
- While projects might partially use Poetry, UV is generally the preferred tool for managing dependencies and virtual environments. It is taking me some time to get used to it, so please bear with me. If you are not sure about something, ask the user. If a dependency is not available, then you will need to request the user to add it to the `pyproject.toml` file.
|
@@ -1,29 +1,26 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: bear-utils
|
3
|
-
Version: 0.7.
|
3
|
+
Version: 0.7.16
|
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
|
-
Author: chaz
|
6
|
-
Author-email: bright.lid5647@fastmail.com
|
5
|
+
Author-email: chaz <bright.lid5647@fastmail.com>
|
7
6
|
Requires-Python: >=3.12
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Requires-Dist:
|
12
|
-
Requires-Dist:
|
13
|
-
Requires-Dist:
|
14
|
-
Requires-Dist:
|
15
|
-
Requires-Dist:
|
16
|
-
Requires-Dist:
|
17
|
-
Requires-Dist:
|
18
|
-
Requires-Dist:
|
19
|
-
Requires-Dist:
|
20
|
-
Requires-Dist:
|
21
|
-
Requires-Dist:
|
22
|
-
Requires-Dist: singleton-base (>=1.0.5)
|
23
|
-
Requires-Dist: sqlalchemy (>=2.0.40,<3.0.0)
|
7
|
+
Requires-Dist: bear-epoch-time>=1.0.1
|
8
|
+
Requires-Dist: diskcache<6.0.0,>=5.6.3
|
9
|
+
Requires-Dist: httpx>=0.28.1
|
10
|
+
Requires-Dist: pathspec>=0.12.1
|
11
|
+
Requires-Dist: pillow<12.0.0,>=11.2.1
|
12
|
+
Requires-Dist: prompt-toolkit<4.0.0,>=3.0.51
|
13
|
+
Requires-Dist: pydantic>=2.11.5
|
14
|
+
Requires-Dist: pyglm<3.0.0,>=2.8.2
|
15
|
+
Requires-Dist: pyqt6>=6.9.0
|
16
|
+
Requires-Dist: pyyaml>=6.0.2
|
17
|
+
Requires-Dist: rich<15.0.0,>=14.0.0
|
18
|
+
Requires-Dist: singleton-base>=1.0.5
|
19
|
+
Requires-Dist: sqlalchemy<3.0.0,>=2.0.40
|
20
|
+
Requires-Dist: toml>=0.10.2
|
24
21
|
Description-Content-Type: text/markdown
|
25
22
|
|
26
|
-
# Bear Utils v# Bear Utils v0.7.
|
23
|
+
# Bear Utils v# Bear Utils v0.7.16
|
27
24
|
|
28
25
|
Personal set of tools and utilities for Python projects, focusing on modularity and ease of use. This library includes components for caching, database management, logging, time handling, file operations, CLI prompts, image processing, clipboard interaction, gradient utilities, event systems, and async helpers.
|
29
26
|
|
@@ -257,4 +254,3 @@ def handle_function(func):
|
|
257
254
|
# Handle sync function
|
258
255
|
pass
|
259
256
|
```
|
260
|
-
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Bear Utils v# Bear Utils v0.7.
|
1
|
+
# Bear Utils v# Bear Utils v0.7.16
|
2
2
|
|
3
3
|
Personal set of tools and utilities for Python projects, focusing on modularity and ease of use. This library includes components for caching, database management, logging, time handling, file operations, CLI prompts, image processing, clipboard interaction, gradient utilities, event systems, and async helpers.
|
4
4
|
|
@@ -0,0 +1,118 @@
|
|
1
|
+
📁 bear-utils
|
2
|
+
├── ⚙️ .bumpversion.cfg (312 bytes) (12 lines)
|
3
|
+
├── 🗃️ .gitignore (3170 bytes) (165 lines)
|
4
|
+
├── 🐍 .python-version (7 bytes) (1 lines)
|
5
|
+
├── 📄 AGENTS.md (2953 bytes) (12 lines)
|
6
|
+
├── 📄 directory_structure.txt (7154 bytes) (118 lines)
|
7
|
+
├── 📄 pyproject.toml (970 bytes) (41 lines)
|
8
|
+
├── 📄 README.md (5267 bytes) (208 lines)
|
9
|
+
├── 📁 src
|
10
|
+
│ └── 📁 bear_utils
|
11
|
+
│ ├── 🐍 __init__.py (616 bytes) (13 lines)
|
12
|
+
│ ├── 📁 ai
|
13
|
+
│ │ ├── 🐍 __init__.py (26 bytes) (1 lines)
|
14
|
+
│ │ └── 📁 ai_helpers
|
15
|
+
│ │ ├── 🐍 __init__.py (3968 bytes) (130 lines)
|
16
|
+
│ │ ├── 🐍 _common.py (418 bytes) (19 lines)
|
17
|
+
│ │ ├── 🐍 _config.py (789 bytes) (25 lines)
|
18
|
+
│ │ ├── 🐍 _parsers.py (7993 bytes) (188 lines)
|
19
|
+
│ │ └── 🐍 _types.py (550 bytes) (20 lines)
|
20
|
+
│ ├── 📁 cache
|
21
|
+
│ │ └── 🐍 __init__.py (4101 bytes) (119 lines)
|
22
|
+
│ ├── 📁 cli
|
23
|
+
│ │ ├── 🐍 __init__.py (241 bytes) (4 lines)
|
24
|
+
│ │ ├── 🐍 commands.py (1768 bytes) (65 lines)
|
25
|
+
│ │ ├── 🐍 prompt_helpers.py (6094 bytes) (166 lines)
|
26
|
+
│ │ └── 📁 shell
|
27
|
+
│ │ ├── 🐍 __init__.py (0 bytes) (0 lines)
|
28
|
+
│ │ ├── 🐍 _base_command.py (2251 bytes) (74 lines)
|
29
|
+
│ │ ├── 🐍 _base_shell.py (14596 bytes) (390 lines)
|
30
|
+
│ │ └── 🐍 _common.py (669 bytes) (19 lines)
|
31
|
+
│ ├── 📁 config
|
32
|
+
│ │ ├── 🐍 __init__.py (289 bytes) (11 lines)
|
33
|
+
│ │ ├── 🐍 config_manager.py (2631 bytes) (92 lines)
|
34
|
+
│ │ ├── 🐍 dir_manager.py (1865 bytes) (64 lines)
|
35
|
+
│ │ └── 🐍 settings_manager.py (7484 bytes) (232 lines)
|
36
|
+
│ ├── 📁 constants
|
37
|
+
│ │ ├── 🐍 __init__.py (545 bytes) (16 lines)
|
38
|
+
│ │ ├── 🐍 _exceptions.py (137 bytes) (3 lines)
|
39
|
+
│ │ ├── 🐍 _lazy_typing.py (339 bytes) (15 lines)
|
40
|
+
│ │ ├── 🐍 date_related.py (935 bytes) (27 lines)
|
41
|
+
│ │ └── 🐍 time_related.py (638 bytes) (22 lines)
|
42
|
+
│ ├── 🛢️ database
|
43
|
+
│ │ ├── 🐍 __init__.py (111 bytes) (6 lines)
|
44
|
+
│ │ └── 🐍 _db_manager.py (3782 bytes) (104 lines)
|
45
|
+
│ ├── 📁 events
|
46
|
+
│ │ ├── 🐍 __init__.py (364 bytes) (16 lines)
|
47
|
+
│ │ ├── 🐍 events_class.py (1657 bytes) (52 lines)
|
48
|
+
│ │ └── 🐍 events_module.py (1852 bytes) (65 lines)
|
49
|
+
│ ├── 📁 extras
|
50
|
+
│ │ ├── 🐍 __init__.py (484 bytes) (17 lines)
|
51
|
+
│ │ ├── 🐍 _async_helpers.py (416 bytes) (15 lines)
|
52
|
+
│ │ ├── 🐍 _tools.py (5959 bytes) (174 lines)
|
53
|
+
│ │ ├── 🐍 platform_utils.py (1257 bytes) (53 lines)
|
54
|
+
│ │ └── 📁 wrappers
|
55
|
+
│ │ ├── 🐍 __init__.py (0 bytes) (0 lines)
|
56
|
+
│ │ └── 🐍 add_methods.py (4222 bytes) (98 lines)
|
57
|
+
│ ├── 📁 files
|
58
|
+
│ │ ├── 🐍 __init__.py (142 bytes) (4 lines)
|
59
|
+
│ │ ├── 🐍 ignore_parser.py (10678 bytes) (298 lines)
|
60
|
+
│ │ └── 📁 file_handlers
|
61
|
+
│ │ ├── 🐍 __init__.py (87 bytes) (3 lines)
|
62
|
+
│ │ ├── 🐍 _base_file_handler.py (3164 bytes) (93 lines)
|
63
|
+
│ │ ├── 🐍 file_handler_factory.py (9746 bytes) (278 lines)
|
64
|
+
│ │ ├── 🐍 json_file_handler.py (1482 bytes) (44 lines)
|
65
|
+
│ │ ├── 🐍 log_file_handler.py (1246 bytes) (33 lines)
|
66
|
+
│ │ ├── 🐍 txt_file_handler.py (1250 bytes) (34 lines)
|
67
|
+
│ │ └── 🐍 yaml_file_handler.py (2083 bytes) (57 lines)
|
68
|
+
│ ├── 📁 graphics
|
69
|
+
│ │ ├── 🐍 __init__.py (186 bytes) (4 lines)
|
70
|
+
│ │ ├── 🐍 bear_gradient.py (4769 bytes) (140 lines)
|
71
|
+
│ │ └── 🐍 image_helpers.py (1374 bytes) (39 lines)
|
72
|
+
│ ├── 📁 gui
|
73
|
+
│ │ ├── 🐍 __init__.py (118 bytes) (3 lines)
|
74
|
+
│ │ └── 📁 gui_tools
|
75
|
+
│ │ ├── 🐍 __init__.py (171 bytes) (5 lines)
|
76
|
+
│ │ ├── 🐍 _settings.py (1202 bytes) (37 lines)
|
77
|
+
│ │ ├── 🐍 _types.py (248 bytes) (12 lines)
|
78
|
+
│ │ ├── 🐍 qt_app.py (5520 bytes) (145 lines)
|
79
|
+
│ │ ├── 🐍 qt_color_picker.py (4437 bytes) (119 lines)
|
80
|
+
│ │ ├── 🐍 qt_file_handler.py (4325 bytes) (138 lines)
|
81
|
+
│ │ └── 🐍 qt_input_dialog.py (9224 bytes) (306 lines)
|
82
|
+
│ ├── 📁 logging
|
83
|
+
│ │ ├── 🐍 __init__.py (319 bytes) (12 lines)
|
84
|
+
│ │ ├── 🐍 loggers.py (4507 bytes) (91 lines)
|
85
|
+
│ │ └── 📁 logger_manager
|
86
|
+
│ │ ├── 🐍 __init__.py (0 bytes) (0 lines)
|
87
|
+
│ │ ├── 🐍 _common.py (1582 bytes) (47 lines)
|
88
|
+
│ │ ├── 🐍 _console_junk.py (4821 bytes) (131 lines)
|
89
|
+
│ │ ├── 🐍 _styles.py (2536 bytes) (91 lines)
|
90
|
+
│ │ └── 📁 loggers
|
91
|
+
│ │ ├── 🐍 __init__.py (0 bytes) (0 lines)
|
92
|
+
│ │ ├── 🐍 _base_logger.py (9453 bytes) (238 lines)
|
93
|
+
│ │ ├── 📄 _base_logger.pyi (2606 bytes) (50 lines)
|
94
|
+
│ │ ├── 🐍 _console_logger.py (9126 bytes) (243 lines)
|
95
|
+
│ │ ├── 📄 _console_logger.pyi (1470 bytes) (41 lines)
|
96
|
+
│ │ ├── 🐍 _file_logger.py (5365 bytes) (150 lines)
|
97
|
+
│ │ ├── 🐍 _level_sin.py (1712 bytes) (58 lines)
|
98
|
+
│ │ ├── 🐍 _logger.py (547 bytes) (18 lines)
|
99
|
+
│ │ ├── 🐍 _sub_logger.py (3471 bytes) (110 lines)
|
100
|
+
│ │ └── 📄 _sub_logger.pyi (1520 bytes) (38 lines)
|
101
|
+
│ ├── 📁 monitoring
|
102
|
+
│ │ ├── 🐍 __init__.py (168 bytes) (10 lines)
|
103
|
+
│ │ └── 🐍 host_monitor.py (12902 bytes) (350 lines)
|
104
|
+
│ └── 📁 time
|
105
|
+
│ ├── 🐍 __init__.py (398 bytes) (16 lines)
|
106
|
+
│ ├── 🐍 _helpers.py (2824 bytes) (91 lines)
|
107
|
+
│ ├── 🐍 _time_class.py (11425 bytes) (316 lines)
|
108
|
+
│ ├── 🐍 _timer.py (2463 bytes) (80 lines)
|
109
|
+
│ ├── 🐍 _tools.py (456 bytes) (17 lines)
|
110
|
+
│ └── 🐍 time_manager.py (7731 bytes) (218 lines)
|
111
|
+
└── 📁 tests
|
112
|
+
├── 🐍 __init__.py (0 bytes) (0 lines)
|
113
|
+
├── 🐍 test_add_ord_suffix.py (329 bytes) (12 lines)
|
114
|
+
├── 🐍 test_clipboard.py (1799 bytes) (50 lines)
|
115
|
+
├── 🐍 test_default_shell.py (154 bytes) (7 lines)
|
116
|
+
├── 🐍 test_logger.py (8513 bytes) (227 lines)
|
117
|
+
├── 🐍 test_platform_utils.py (922 bytes) (35 lines)
|
118
|
+
└── 🐍 test_time_parsing.py (414 bytes) (13 lines)
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Singleton Mask File
|
2
|
+
|
3
|
+
## clean
|
4
|
+
|
5
|
+
> This command cleans the build artifacts
|
6
|
+
|
7
|
+
```bash
|
8
|
+
rm -rf dist/
|
9
|
+
```
|
10
|
+
|
11
|
+
## bump (patch_version)
|
12
|
+
|
13
|
+
> Bump the version of the local project specifying the patch level: `minor`, `major`, `patch`
|
14
|
+
|
15
|
+
```bash
|
16
|
+
bump2version ${patch_version} --allow-dirty
|
17
|
+
```
|
18
|
+
|
19
|
+
## build
|
20
|
+
|
21
|
+
> This command builds the project via uv
|
22
|
+
|
23
|
+
```bash
|
24
|
+
uv build
|
25
|
+
```
|
26
|
+
|
27
|
+
## test
|
28
|
+
|
29
|
+
> This command runs the tests using pytest
|
30
|
+
|
31
|
+
```bash
|
32
|
+
pytest -s
|
33
|
+
```
|
34
|
+
|
35
|
+
## publish (publish_location)
|
36
|
+
|
37
|
+
> This command publishes the package to PyPI (or locally) officially, isn't that great?
|
38
|
+
|
39
|
+
```bash
|
40
|
+
if [ "${publish_location}" = "local" ]; then
|
41
|
+
twine upload -r local dist/* # uploads to a local repository
|
42
|
+
else
|
43
|
+
export UV_PUBLISH_TOKEN=$(op read "op://Private/PyPI Prod/api_key")
|
44
|
+
uv publish --index pypi dist/* --token $UV_PUBLISH_TOKEN
|
45
|
+
fi
|
46
|
+
```
|
47
|
+
|
48
|
+
## full (patch_version) (publish_location)
|
49
|
+
|
50
|
+
> This command runs the full build and publish process
|
51
|
+
|
52
|
+
```bash
|
53
|
+
$MASK clean
|
54
|
+
$MASK bump ${patch_version}
|
55
|
+
$MASK build
|
56
|
+
$MASK publish ${publish_location}
|
57
|
+
```
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[project]
|
2
2
|
name = "bear-utils"
|
3
|
-
version = "0.7.
|
3
|
+
version = "0.7.16"
|
4
4
|
description = "Various utilities for Bear programmers, including a rich logging utility, a disk cache, and a SQLite database wrapper amongst other things."
|
5
5
|
authors = [{ name = "chaz", email = "bright.lid5647@fastmail.com" }]
|
6
6
|
readme = "README.md"
|
@@ -19,11 +19,12 @@ dependencies = [
|
|
19
19
|
"singleton-base>=1.0.5",
|
20
20
|
"httpx>=0.28.1",
|
21
21
|
"bear-epoch-time>=1.0.1",
|
22
|
+
"toml>=0.10.2",
|
22
23
|
]
|
23
24
|
|
24
25
|
[build-system]
|
25
|
-
requires = ["
|
26
|
-
build-backend = "
|
26
|
+
requires = ["hatchling"]
|
27
|
+
build-backend = "hatchling.build"
|
27
28
|
|
28
29
|
[dependency-groups]
|
29
30
|
dev = [
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from .commands import MaskShellCommand, OPShellCommand, UVShellCommand
|
1
|
+
from .commands import GitCommand, MaskShellCommand, OPShellCommand, UVShellCommand
|
2
2
|
from .shell._base_command import BaseShellCommand
|
3
3
|
from .shell._base_shell import SimpleShellSession, shell_session
|
4
4
|
from .shell._common import DEFAULT_SHELL
|
@@ -52,8 +52,48 @@ class MaskShellCommand(BaseShellCommand):
|
|
52
52
|
return cls.sub("init", *args, **kwargs)
|
53
53
|
|
54
54
|
|
55
|
+
class GitCommand(BaseShellCommand):
|
56
|
+
"""Base class for Git commands"""
|
57
|
+
|
58
|
+
command_name = "git"
|
59
|
+
|
60
|
+
def __init__(self, *args, **kwargs):
|
61
|
+
super().__init__(*args, **kwargs)
|
62
|
+
|
63
|
+
@classmethod
|
64
|
+
def init(cls, *args, **kwargs) -> "GitCommand":
|
65
|
+
"""Initialize a new Git repository"""
|
66
|
+
return cls.sub("init", *args, **kwargs)
|
67
|
+
|
68
|
+
@classmethod
|
69
|
+
def status(cls, *args, **kwargs) -> "GitCommand":
|
70
|
+
"""Get the status of the Git repository"""
|
71
|
+
return cls.sub("status", *args, **kwargs)
|
72
|
+
|
73
|
+
@classmethod
|
74
|
+
def log(cls, *args, **kwargs) -> "GitCommand":
|
75
|
+
"""Show the commit logs"""
|
76
|
+
return cls.sub("log", *args, **kwargs)
|
77
|
+
|
78
|
+
@classmethod
|
79
|
+
def add(cls, files, *args, **kwargs) -> "GitCommand":
|
80
|
+
"""Add files to the staging area"""
|
81
|
+
return cls.sub("add", *args, **kwargs).value(files)
|
82
|
+
|
83
|
+
@classmethod
|
84
|
+
def diff(cls, *args, **kwargs) -> "GitCommand":
|
85
|
+
"""Show changes between commits, commit and working tree, etc."""
|
86
|
+
return cls.sub("diff", *args, **kwargs)
|
87
|
+
|
88
|
+
@classmethod
|
89
|
+
def commit(cls, message: str, *args, **kwargs) -> "GitCommand":
|
90
|
+
"""Commit changes with a message"""
|
91
|
+
return cls.sub("commit -m", *args, **kwargs).value(f"'{message}'")
|
92
|
+
|
93
|
+
|
55
94
|
__all__ = [
|
56
95
|
"MaskShellCommand",
|
57
96
|
"OPShellCommand",
|
58
97
|
"UVShellCommand",
|
98
|
+
"GitCommand",
|
59
99
|
]
|
@@ -1,3 +1,5 @@
|
|
1
|
+
from asyncio.subprocess import Process
|
2
|
+
from subprocess import CompletedProcess
|
1
3
|
from typing import ClassVar, Generic, Self, TypeVar
|
2
4
|
|
3
5
|
T = TypeVar("T", bound=str)
|
@@ -56,13 +58,12 @@ class BaseShellCommand(Generic[T]):
|
|
56
58
|
return f"{joined} {self.suffix}"
|
57
59
|
return joined
|
58
60
|
|
59
|
-
def do(self) -> Self:
|
61
|
+
def do(self, **kwargs) -> Self:
|
60
62
|
"""Run the command using subprocess"""
|
61
63
|
from ._base_shell import shell_session
|
62
64
|
|
63
|
-
with shell_session() as session:
|
64
|
-
session.add(
|
65
|
-
self.result = session.run()
|
65
|
+
with shell_session(**kwargs) as session:
|
66
|
+
self.result: CompletedProcess[str] | Process = session.add(self.cmd).run()
|
66
67
|
return self
|
67
68
|
|
68
69
|
def get(self) -> str:
|
{bear_utils-0.7.14 → bear_utils-0.7.16}/src/bear_utils/files/file_handlers/file_handler_factory.py
RENAMED
@@ -46,6 +46,7 @@ class FileHandlerFactory:
|
|
46
46
|
try:
|
47
47
|
from .json_file_handler import JsonFileHandler
|
48
48
|
from .log_file_handler import LogFileHandler
|
49
|
+
from .toml_file_handler import TomlFileHandler
|
49
50
|
from .txt_file_handler import TextFileHandler
|
50
51
|
from .yaml_file_handler import YamlFileHandler
|
51
52
|
|
@@ -53,6 +54,7 @@ class FileHandlerFactory:
|
|
53
54
|
self.register_handler(TextFileHandler)
|
54
55
|
self.register_handler(YamlFileHandler)
|
55
56
|
self.register_handler(LogFileHandler)
|
57
|
+
self.register_handler(TomlFileHandler)
|
56
58
|
|
57
59
|
except ImportError as e:
|
58
60
|
warnings.warn(f"Could not import all default handlers: {e}")
|
@@ -0,0 +1,68 @@
|
|
1
|
+
from dataclasses import dataclass
|
2
|
+
from pathlib import Path
|
3
|
+
from typing import Any, ClassVar
|
4
|
+
|
5
|
+
import toml
|
6
|
+
|
7
|
+
from ._base_file_handler import FileHandler
|
8
|
+
|
9
|
+
|
10
|
+
class TomlFileHandler(FileHandler):
|
11
|
+
"""Class for handling .toml files with read, write, and present methods"""
|
12
|
+
|
13
|
+
valid_extensions: ClassVar[list[str]] = ["toml"]
|
14
|
+
|
15
|
+
@FileHandler.ValidateFileType
|
16
|
+
def read_file(self, file_path: Path) -> dict:
|
17
|
+
try:
|
18
|
+
super().read_file(file_path)
|
19
|
+
|
20
|
+
return toml.load(file_path)
|
21
|
+
except Exception as e:
|
22
|
+
raise ValueError(f"Error reading file: {e}")
|
23
|
+
|
24
|
+
@FileHandler.ValidateFileType
|
25
|
+
def write_file(self, file_path: Path, data: dict[str, Any] | str, **kwargs) -> None:
|
26
|
+
try:
|
27
|
+
super().write_file(file_path, data)
|
28
|
+
|
29
|
+
with open(file_path, "w", encoding="utf-8") as file:
|
30
|
+
if isinstance(data, dict):
|
31
|
+
toml.dump(data, file, **kwargs)
|
32
|
+
else:
|
33
|
+
file.write(data)
|
34
|
+
except Exception as e:
|
35
|
+
raise ValueError(f"Error writing file: {e}")
|
36
|
+
|
37
|
+
def present_file(self, data: dict[str, Any] | str, **kwargs) -> str:
|
38
|
+
raise NotImplementedError("Presenting TOML files is not implemented. Not needed.")
|
39
|
+
|
40
|
+
|
41
|
+
@dataclass
|
42
|
+
class PyProjectToml:
|
43
|
+
"""Dataclass for handling pyproject.toml files"""
|
44
|
+
|
45
|
+
name: str
|
46
|
+
version: str
|
47
|
+
description: str | None = None
|
48
|
+
author_name: str | None = None
|
49
|
+
author_email: str | None = None
|
50
|
+
dependencies: list[str] | None = None
|
51
|
+
|
52
|
+
def __post_init__(self):
|
53
|
+
if self.dependencies:
|
54
|
+
self.dependencies = [dep.split(" ")[0] for dep in self.dependencies if isinstance(dep, str)]
|
55
|
+
self.dependencies = [dep.split(">=")[0] for dep in self.dependencies]
|
56
|
+
|
57
|
+
@classmethod
|
58
|
+
def from_dict(cls, data: dict[str, Any]) -> "PyProjectToml":
|
59
|
+
data = data.get("project", {})
|
60
|
+
authors: dict = data.get("authors", {})[0]
|
61
|
+
return cls(
|
62
|
+
name=data.get("name", ""),
|
63
|
+
version=data.get("version", ""),
|
64
|
+
description=data.get("description"),
|
65
|
+
author_name=authors.get("name") if authors else None,
|
66
|
+
author_email=authors.get("email") if authors else None,
|
67
|
+
dependencies=data.get("dependencies", []),
|
68
|
+
)
|
File without changes
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import importlib
|
2
|
+
|
3
|
+
|
4
|
+
def test_add_ord_suffix_import():
|
5
|
+
module = importlib.import_module("src.bear_utils.time")
|
6
|
+
assert hasattr(module, "add_ord_suffix")
|
7
|
+
func = module.add_ord_suffix
|
8
|
+
assert callable(func)
|
9
|
+
assert func(1) == "1st"
|
10
|
+
assert func(2) == "2nd"
|
11
|
+
assert func(3) == "3rd"
|
12
|
+
assert func(4) == "4th"
|