fmtr.tools 1.3.27__tar.gz → 1.3.29__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.
Potentially problematic release.
This version of fmtr.tools might be problematic. Click here for more details.
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/PKG-INFO +41 -41
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/__init__.py +1 -0
- fmtr_tools-1.3.29/fmtr/tools/context_tools.py +23 -0
- fmtr_tools-1.3.29/fmtr/tools/function_tools.py +91 -0
- fmtr_tools-1.3.29/fmtr/tools/inherit_tools.py +27 -0
- fmtr_tools-1.3.29/fmtr/tools/version +1 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr.tools.egg-info/PKG-INFO +41 -41
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr.tools.egg-info/SOURCES.txt +4 -0
- fmtr_tools-1.3.27/fmtr/tools/function_tools.py +0 -33
- fmtr_tools-1.3.27/fmtr/tools/version +0 -1
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/LICENSE +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/README.md +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/ai_tools/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/ai_tools/agentic_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/ai_tools/inference_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/api_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/async_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/augmentation_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/caching_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/constants.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/data_modelling_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/dataclass_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/datatype_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/debugging_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/dns_tools/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/dns_tools/client.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/dns_tools/dm.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/dns_tools/proxy.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/dns_tools/server.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/docker_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/entrypoints/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/entrypoints/cache_hfh.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/entrypoints/ep_test.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/entrypoints/install_yamlscript.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/entrypoints/remote_debug_test.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/entrypoints/shell_debug.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/environment_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/google_api_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/hash_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/hfh_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/html_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/http_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/import_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/inspection_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/interface_tools/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/interface_tools/controls.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/interface_tools/interface_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/iterator_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/json_fix_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/json_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/logging_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/merging_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/metric_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/name_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/netrc_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/openai_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/packaging_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/parallel_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/path_tools/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/path_tools/app_path_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/path_tools/path_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/path_tools/type_path_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/pattern_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/pdf_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/platform_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/process_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/profiling_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/random_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/semantic_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/settings_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/setup_tools/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/setup_tools/setup_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/spaces_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/string_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tabular_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/conftest.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/helpers.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/test_datatype.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/test_environment.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/test_json.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/test_path.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tests/test_yaml.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tokenization_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/unicode_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/version_tools/__init__.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/version_tools/version_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr/tools/yaml_tools.py +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr.tools.egg-info/dependency_links.txt +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr.tools.egg-info/entry_points.txt +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr.tools.egg-info/requires.txt +40 -40
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/fmtr.tools.egg-info/top_level.txt +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/pyproject.toml +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/setup.cfg +0 -0
- {fmtr_tools-1.3.27 → fmtr_tools-1.3.29}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmtr.tools
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.29
|
|
4
4
|
Summary: Collection of high-level tools to simplify everyday development tasks, with a focus on AI/ML
|
|
5
5
|
Home-page: https://github.com/fmtr/fmtr.tools
|
|
6
6
|
Author: Frontmatter
|
|
@@ -126,61 +126,61 @@ Requires-Dist: logfire[httpx]; extra == "http"
|
|
|
126
126
|
Provides-Extra: setup
|
|
127
127
|
Requires-Dist: setuptools; extra == "setup"
|
|
128
128
|
Provides-Extra: all
|
|
129
|
-
Requires-Dist:
|
|
129
|
+
Requires-Dist: tinynetrc; extra == "all"
|
|
130
|
+
Requires-Dist: filetype; extra == "all"
|
|
131
|
+
Requires-Dist: dnspython[doh]; extra == "all"
|
|
132
|
+
Requires-Dist: json_repair; extra == "all"
|
|
133
|
+
Requires-Dist: ollama; extra == "all"
|
|
134
|
+
Requires-Dist: google-auth; extra == "all"
|
|
135
|
+
Requires-Dist: pydantic-settings; extra == "all"
|
|
130
136
|
Requires-Dist: semver; extra == "all"
|
|
131
|
-
Requires-Dist:
|
|
137
|
+
Requires-Dist: openai; extra == "all"
|
|
138
|
+
Requires-Dist: distributed; extra == "all"
|
|
132
139
|
Requires-Dist: yamlscript; extra == "all"
|
|
133
|
-
Requires-Dist: pyyaml; extra == "all"
|
|
134
140
|
Requires-Dist: dask[bag]; extra == "all"
|
|
141
|
+
Requires-Dist: pyyaml; extra == "all"
|
|
142
|
+
Requires-Dist: tabulate; extra == "all"
|
|
143
|
+
Requires-Dist: flet-webview; extra == "all"
|
|
144
|
+
Requires-Dist: flet-video; extra == "all"
|
|
145
|
+
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
146
|
+
Requires-Dist: torchaudio; extra == "all"
|
|
147
|
+
Requires-Dist: pymupdf; extra == "all"
|
|
148
|
+
Requires-Dist: pandas; extra == "all"
|
|
149
|
+
Requires-Dist: regex; extra == "all"
|
|
135
150
|
Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
|
|
136
|
-
Requires-Dist: google-auth; extra == "all"
|
|
137
|
-
Requires-Dist: google-
|
|
151
|
+
Requires-Dist: google-auth-oauthlib; extra == "all"
|
|
152
|
+
Requires-Dist: google-auth-httplib2; extra == "all"
|
|
138
153
|
Requires-Dist: docker; extra == "all"
|
|
139
|
-
Requires-Dist:
|
|
140
|
-
Requires-Dist:
|
|
141
|
-
Requires-Dist: deepmerge; extra == "all"
|
|
142
|
-
Requires-Dist: regex; extra == "all"
|
|
143
|
-
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
144
|
-
Requires-Dist: openai; extra == "all"
|
|
145
|
-
Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
|
|
154
|
+
Requires-Dist: sentence_transformers; extra == "all"
|
|
155
|
+
Requires-Dist: httpx_retries; extra == "all"
|
|
146
156
|
Requires-Dist: torchvision; extra == "all"
|
|
147
|
-
Requires-Dist:
|
|
157
|
+
Requires-Dist: uvicorn[standard]; extra == "all"
|
|
158
|
+
Requires-Dist: faker; extra == "all"
|
|
159
|
+
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
160
|
+
Requires-Dist: setuptools; extra == "all"
|
|
148
161
|
Requires-Dist: bokeh; extra == "all"
|
|
162
|
+
Requires-Dist: contexttimer; extra == "all"
|
|
149
163
|
Requires-Dist: fastapi; extra == "all"
|
|
164
|
+
Requires-Dist: tokenizers; extra == "all"
|
|
165
|
+
Requires-Dist: diskcache; extra == "all"
|
|
150
166
|
Requires-Dist: cachetools; extra == "all"
|
|
151
|
-
Requires-Dist:
|
|
152
|
-
Requires-Dist: peft; extra == "all"
|
|
153
|
-
Requires-Dist: pydantic-settings; extra == "all"
|
|
167
|
+
Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
|
|
154
168
|
Requires-Dist: openpyxl; extra == "all"
|
|
155
|
-
Requires-Dist: google-auth-httplib2; extra == "all"
|
|
156
|
-
Requires-Dist: torchaudio; extra == "all"
|
|
157
|
-
Requires-Dist: pydantic; extra == "all"
|
|
158
|
-
Requires-Dist: sre_yield; extra == "all"
|
|
159
169
|
Requires-Dist: appdirs; extra == "all"
|
|
160
170
|
Requires-Dist: huggingface_hub; extra == "all"
|
|
161
|
-
Requires-Dist:
|
|
162
|
-
Requires-Dist:
|
|
163
|
-
Requires-Dist:
|
|
164
|
-
Requires-Dist:
|
|
165
|
-
Requires-Dist:
|
|
171
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
172
|
+
Requires-Dist: sre_yield; extra == "all"
|
|
173
|
+
Requires-Dist: flet[all]; extra == "all"
|
|
174
|
+
Requires-Dist: html2text; extra == "all"
|
|
175
|
+
Requires-Dist: google-api-python-client; extra == "all"
|
|
176
|
+
Requires-Dist: pydantic; extra == "all"
|
|
177
|
+
Requires-Dist: Unidecode; extra == "all"
|
|
178
|
+
Requires-Dist: peft; extra == "all"
|
|
166
179
|
Requires-Dist: pymupdf4llm; extra == "all"
|
|
180
|
+
Requires-Dist: httpx; extra == "all"
|
|
181
|
+
Requires-Dist: deepmerge; extra == "all"
|
|
167
182
|
Requires-Dist: logfire; extra == "all"
|
|
168
|
-
Requires-Dist: google-auth-oauthlib; extra == "all"
|
|
169
|
-
Requires-Dist: tokenizers; extra == "all"
|
|
170
|
-
Requires-Dist: ollama; extra == "all"
|
|
171
|
-
Requires-Dist: diskcache; extra == "all"
|
|
172
|
-
Requires-Dist: faker; extra == "all"
|
|
173
|
-
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
174
|
-
Requires-Dist: setuptools; extra == "all"
|
|
175
183
|
Requires-Dist: logfire[httpx]; extra == "all"
|
|
176
|
-
Requires-Dist: tabulate; extra == "all"
|
|
177
|
-
Requires-Dist: sentence_transformers; extra == "all"
|
|
178
|
-
Requires-Dist: html2text; extra == "all"
|
|
179
|
-
Requires-Dist: flet-video; extra == "all"
|
|
180
|
-
Requires-Dist: json_repair; extra == "all"
|
|
181
|
-
Requires-Dist: httpx; extra == "all"
|
|
182
|
-
Requires-Dist: Unidecode; extra == "all"
|
|
183
|
-
Requires-Dist: uvicorn[standard]; extra == "all"
|
|
184
184
|
Dynamic: author
|
|
185
185
|
Dynamic: author-email
|
|
186
186
|
Dynamic: description
|
|
@@ -6,6 +6,7 @@ import fmtr.tools.environment_tools as environment
|
|
|
6
6
|
import fmtr.tools.function_tools as function
|
|
7
7
|
import fmtr.tools.hash_tools as hash
|
|
8
8
|
import fmtr.tools.import_tools as import_
|
|
9
|
+
import fmtr.tools.inherit_tools as inherit
|
|
9
10
|
import fmtr.tools.iterator_tools as iterator
|
|
10
11
|
import fmtr.tools.json_tools as json
|
|
11
12
|
import fmtr.tools.logging_tools as logging
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from contextlib import contextmanager, ExitStack
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@contextmanager
|
|
5
|
+
def null():
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
Null context manager.
|
|
9
|
+
|
|
10
|
+
"""
|
|
11
|
+
yield
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@contextmanager
|
|
15
|
+
def contexts(*contexts):
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
Tee context managers.
|
|
19
|
+
|
|
20
|
+
"""
|
|
21
|
+
with ExitStack() as stack:
|
|
22
|
+
resources = [stack.enter_context(context) for context in contexts]
|
|
23
|
+
yield resources
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import functools
|
|
2
|
+
import inspect
|
|
3
|
+
from typing import Tuple
|
|
4
|
+
|
|
5
|
+
from fmtr.tools import context_tools
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def combine_args_kwargs(args: dict=None, kwargs: dict=None) -> dict:
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
Combines arguments and keyword arguments into a single dictionary.
|
|
12
|
+
|
|
13
|
+
"""
|
|
14
|
+
args = args or []
|
|
15
|
+
kwargs = kwargs or {}
|
|
16
|
+
args = {i: arg for i, arg in enumerate(args)}
|
|
17
|
+
args.update(kwargs)
|
|
18
|
+
if all(isinstance(key, int) for key in args.keys()):
|
|
19
|
+
args = list(args.values())
|
|
20
|
+
return args
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def split_args_kwargs(args_kwargs: dict) -> Tuple[list, dict]:
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
Splits arguments and keyword arguments into a list and a dictionary.
|
|
27
|
+
|
|
28
|
+
"""
|
|
29
|
+
if isinstance(args_kwargs, list):
|
|
30
|
+
args, kwargs = args_kwargs, {}
|
|
31
|
+
else:
|
|
32
|
+
args = [arg for key, arg in args_kwargs.items() if isinstance(key, int)]
|
|
33
|
+
kwargs = {key: arg for key, arg in args_kwargs.items() if not isinstance(key, int)}
|
|
34
|
+
|
|
35
|
+
return args, kwargs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class BoundDecorator:
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
Bound method decorator with overridable start/stop and context manager
|
|
42
|
+
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
def __init__(self, func):
|
|
46
|
+
self.func = func
|
|
47
|
+
self.context_null = context_tools.null()
|
|
48
|
+
functools.update_wrapper(self, func)
|
|
49
|
+
|
|
50
|
+
def get_context(self, instance):
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
By default use a null context.
|
|
54
|
+
|
|
55
|
+
"""
|
|
56
|
+
return self.context_null
|
|
57
|
+
|
|
58
|
+
def __get__(self, instance, owner):
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
Wrap at runtime, call start/stop within context.
|
|
62
|
+
|
|
63
|
+
"""
|
|
64
|
+
if instance is None:
|
|
65
|
+
return self.func
|
|
66
|
+
|
|
67
|
+
if inspect.iscoroutinefunction(self.func):
|
|
68
|
+
async def async_wrapper(*args, **kwargs):
|
|
69
|
+
with self.get_context(instance):
|
|
70
|
+
self.start(instance)
|
|
71
|
+
result = await self.func(instance, *args, **kwargs)
|
|
72
|
+
self.stop(instance)
|
|
73
|
+
return result
|
|
74
|
+
|
|
75
|
+
return functools.update_wrapper(async_wrapper, self.func)
|
|
76
|
+
|
|
77
|
+
else:
|
|
78
|
+
def sync_wrapper(*args, **kwargs):
|
|
79
|
+
with self.get_context(instance):
|
|
80
|
+
self.start(instance)
|
|
81
|
+
result = self.func(instance, *args, **kwargs)
|
|
82
|
+
self.stop(instance)
|
|
83
|
+
return result
|
|
84
|
+
|
|
85
|
+
return functools.update_wrapper(sync_wrapper, self.func)
|
|
86
|
+
|
|
87
|
+
def start(self, instance):
|
|
88
|
+
pass
|
|
89
|
+
|
|
90
|
+
def stop(self, instance):
|
|
91
|
+
pass
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
from typing import TypeVar, Generic
|
|
2
|
+
|
|
3
|
+
T = TypeVar("T")
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Inherit(Generic[T]):
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
Runtime inheritance. Acts like a wrapper around an instantiated base class of type T, and allows overriding methods in subclasses like regular inheritance.
|
|
10
|
+
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
def __init__(self, parent: T):
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
Set parent
|
|
17
|
+
|
|
18
|
+
"""
|
|
19
|
+
object.__setattr__(self, "_parent", parent)
|
|
20
|
+
|
|
21
|
+
def __getattr__(self, name):
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
Since regular attribute access checks own methods first, we don't need to do anything fancy to fall back to the parent when not implemented.
|
|
25
|
+
|
|
26
|
+
"""
|
|
27
|
+
return getattr(self._parent, name)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.3.29
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: fmtr.tools
|
|
3
|
-
Version: 1.3.
|
|
3
|
+
Version: 1.3.29
|
|
4
4
|
Summary: Collection of high-level tools to simplify everyday development tasks, with a focus on AI/ML
|
|
5
5
|
Home-page: https://github.com/fmtr/fmtr.tools
|
|
6
6
|
Author: Frontmatter
|
|
@@ -126,61 +126,61 @@ Requires-Dist: logfire[httpx]; extra == "http"
|
|
|
126
126
|
Provides-Extra: setup
|
|
127
127
|
Requires-Dist: setuptools; extra == "setup"
|
|
128
128
|
Provides-Extra: all
|
|
129
|
-
Requires-Dist:
|
|
129
|
+
Requires-Dist: tinynetrc; extra == "all"
|
|
130
|
+
Requires-Dist: filetype; extra == "all"
|
|
131
|
+
Requires-Dist: dnspython[doh]; extra == "all"
|
|
132
|
+
Requires-Dist: json_repair; extra == "all"
|
|
133
|
+
Requires-Dist: ollama; extra == "all"
|
|
134
|
+
Requires-Dist: google-auth; extra == "all"
|
|
135
|
+
Requires-Dist: pydantic-settings; extra == "all"
|
|
130
136
|
Requires-Dist: semver; extra == "all"
|
|
131
|
-
Requires-Dist:
|
|
137
|
+
Requires-Dist: openai; extra == "all"
|
|
138
|
+
Requires-Dist: distributed; extra == "all"
|
|
132
139
|
Requires-Dist: yamlscript; extra == "all"
|
|
133
|
-
Requires-Dist: pyyaml; extra == "all"
|
|
134
140
|
Requires-Dist: dask[bag]; extra == "all"
|
|
141
|
+
Requires-Dist: pyyaml; extra == "all"
|
|
142
|
+
Requires-Dist: tabulate; extra == "all"
|
|
143
|
+
Requires-Dist: flet-webview; extra == "all"
|
|
144
|
+
Requires-Dist: flet-video; extra == "all"
|
|
145
|
+
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
146
|
+
Requires-Dist: torchaudio; extra == "all"
|
|
147
|
+
Requires-Dist: pymupdf; extra == "all"
|
|
148
|
+
Requires-Dist: pandas; extra == "all"
|
|
149
|
+
Requires-Dist: regex; extra == "all"
|
|
135
150
|
Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
|
|
136
|
-
Requires-Dist: google-auth; extra == "all"
|
|
137
|
-
Requires-Dist: google-
|
|
151
|
+
Requires-Dist: google-auth-oauthlib; extra == "all"
|
|
152
|
+
Requires-Dist: google-auth-httplib2; extra == "all"
|
|
138
153
|
Requires-Dist: docker; extra == "all"
|
|
139
|
-
Requires-Dist:
|
|
140
|
-
Requires-Dist:
|
|
141
|
-
Requires-Dist: deepmerge; extra == "all"
|
|
142
|
-
Requires-Dist: regex; extra == "all"
|
|
143
|
-
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
144
|
-
Requires-Dist: openai; extra == "all"
|
|
145
|
-
Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
|
|
154
|
+
Requires-Dist: sentence_transformers; extra == "all"
|
|
155
|
+
Requires-Dist: httpx_retries; extra == "all"
|
|
146
156
|
Requires-Dist: torchvision; extra == "all"
|
|
147
|
-
Requires-Dist:
|
|
157
|
+
Requires-Dist: uvicorn[standard]; extra == "all"
|
|
158
|
+
Requires-Dist: faker; extra == "all"
|
|
159
|
+
Requires-Dist: transformers[sentencepiece]; extra == "all"
|
|
160
|
+
Requires-Dist: setuptools; extra == "all"
|
|
148
161
|
Requires-Dist: bokeh; extra == "all"
|
|
162
|
+
Requires-Dist: contexttimer; extra == "all"
|
|
149
163
|
Requires-Dist: fastapi; extra == "all"
|
|
164
|
+
Requires-Dist: tokenizers; extra == "all"
|
|
165
|
+
Requires-Dist: diskcache; extra == "all"
|
|
150
166
|
Requires-Dist: cachetools; extra == "all"
|
|
151
|
-
Requires-Dist:
|
|
152
|
-
Requires-Dist: peft; extra == "all"
|
|
153
|
-
Requires-Dist: pydantic-settings; extra == "all"
|
|
167
|
+
Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
|
|
154
168
|
Requires-Dist: openpyxl; extra == "all"
|
|
155
|
-
Requires-Dist: google-auth-httplib2; extra == "all"
|
|
156
|
-
Requires-Dist: torchaudio; extra == "all"
|
|
157
|
-
Requires-Dist: pydantic; extra == "all"
|
|
158
|
-
Requires-Dist: sre_yield; extra == "all"
|
|
159
169
|
Requires-Dist: appdirs; extra == "all"
|
|
160
170
|
Requires-Dist: huggingface_hub; extra == "all"
|
|
161
|
-
Requires-Dist:
|
|
162
|
-
Requires-Dist:
|
|
163
|
-
Requires-Dist:
|
|
164
|
-
Requires-Dist:
|
|
165
|
-
Requires-Dist:
|
|
171
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
172
|
+
Requires-Dist: sre_yield; extra == "all"
|
|
173
|
+
Requires-Dist: flet[all]; extra == "all"
|
|
174
|
+
Requires-Dist: html2text; extra == "all"
|
|
175
|
+
Requires-Dist: google-api-python-client; extra == "all"
|
|
176
|
+
Requires-Dist: pydantic; extra == "all"
|
|
177
|
+
Requires-Dist: Unidecode; extra == "all"
|
|
178
|
+
Requires-Dist: peft; extra == "all"
|
|
166
179
|
Requires-Dist: pymupdf4llm; extra == "all"
|
|
180
|
+
Requires-Dist: httpx; extra == "all"
|
|
181
|
+
Requires-Dist: deepmerge; extra == "all"
|
|
167
182
|
Requires-Dist: logfire; extra == "all"
|
|
168
|
-
Requires-Dist: google-auth-oauthlib; extra == "all"
|
|
169
|
-
Requires-Dist: tokenizers; extra == "all"
|
|
170
|
-
Requires-Dist: ollama; extra == "all"
|
|
171
|
-
Requires-Dist: diskcache; extra == "all"
|
|
172
|
-
Requires-Dist: faker; extra == "all"
|
|
173
|
-
Requires-Dist: logfire[fastapi]; extra == "all"
|
|
174
|
-
Requires-Dist: setuptools; extra == "all"
|
|
175
183
|
Requires-Dist: logfire[httpx]; extra == "all"
|
|
176
|
-
Requires-Dist: tabulate; extra == "all"
|
|
177
|
-
Requires-Dist: sentence_transformers; extra == "all"
|
|
178
|
-
Requires-Dist: html2text; extra == "all"
|
|
179
|
-
Requires-Dist: flet-video; extra == "all"
|
|
180
|
-
Requires-Dist: json_repair; extra == "all"
|
|
181
|
-
Requires-Dist: httpx; extra == "all"
|
|
182
|
-
Requires-Dist: Unidecode; extra == "all"
|
|
183
|
-
Requires-Dist: uvicorn[standard]; extra == "all"
|
|
184
184
|
Dynamic: author
|
|
185
185
|
Dynamic: author-email
|
|
186
186
|
Dynamic: description
|
|
@@ -8,6 +8,7 @@ setup.py
|
|
|
8
8
|
./fmtr/tools/augmentation_tools.py
|
|
9
9
|
./fmtr/tools/caching_tools.py
|
|
10
10
|
./fmtr/tools/constants.py
|
|
11
|
+
./fmtr/tools/context_tools.py
|
|
11
12
|
./fmtr/tools/data_modelling_tools.py
|
|
12
13
|
./fmtr/tools/dataclass_tools.py
|
|
13
14
|
./fmtr/tools/datatype_tools.py
|
|
@@ -21,6 +22,7 @@ setup.py
|
|
|
21
22
|
./fmtr/tools/html_tools.py
|
|
22
23
|
./fmtr/tools/http_tools.py
|
|
23
24
|
./fmtr/tools/import_tools.py
|
|
25
|
+
./fmtr/tools/inherit_tools.py
|
|
24
26
|
./fmtr/tools/inspection_tools.py
|
|
25
27
|
./fmtr/tools/iterator_tools.py
|
|
26
28
|
./fmtr/tools/json_fix_tools.py
|
|
@@ -94,6 +96,7 @@ fmtr/tools/async_tools.py
|
|
|
94
96
|
fmtr/tools/augmentation_tools.py
|
|
95
97
|
fmtr/tools/caching_tools.py
|
|
96
98
|
fmtr/tools/constants.py
|
|
99
|
+
fmtr/tools/context_tools.py
|
|
97
100
|
fmtr/tools/data_modelling_tools.py
|
|
98
101
|
fmtr/tools/dataclass_tools.py
|
|
99
102
|
fmtr/tools/datatype_tools.py
|
|
@@ -107,6 +110,7 @@ fmtr/tools/hfh_tools.py
|
|
|
107
110
|
fmtr/tools/html_tools.py
|
|
108
111
|
fmtr/tools/http_tools.py
|
|
109
112
|
fmtr/tools/import_tools.py
|
|
113
|
+
fmtr/tools/inherit_tools.py
|
|
110
114
|
fmtr/tools/inspection_tools.py
|
|
111
115
|
fmtr/tools/iterator_tools.py
|
|
112
116
|
fmtr/tools/json_fix_tools.py
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
from typing import Tuple
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
def combine_args_kwargs(args: dict=None, kwargs: dict=None) -> dict:
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
Combines arguments and keyword arguments into a single dictionary.
|
|
8
|
-
|
|
9
|
-
"""
|
|
10
|
-
args = args or []
|
|
11
|
-
kwargs = kwargs or {}
|
|
12
|
-
args = {i: arg for i, arg in enumerate(args)}
|
|
13
|
-
args.update(kwargs)
|
|
14
|
-
if all(isinstance(key, int) for key in args.keys()):
|
|
15
|
-
args = list(args.values())
|
|
16
|
-
return args
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def split_args_kwargs(args_kwargs: dict) -> Tuple[list, dict]:
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
Splits arguments and keyword arguments into a list and a dictionary.
|
|
23
|
-
|
|
24
|
-
"""
|
|
25
|
-
if isinstance(args_kwargs, list):
|
|
26
|
-
args, kwargs = args_kwargs, {}
|
|
27
|
-
else:
|
|
28
|
-
args = [arg for key, arg in args_kwargs.items() if isinstance(key, int)]
|
|
29
|
-
kwargs = {key: arg for key, arg in args_kwargs.items() if not isinstance(key, int)}
|
|
30
|
-
|
|
31
|
-
return args, kwargs
|
|
32
|
-
|
|
33
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
1.3.27
|
|
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
|
|
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
|
|
@@ -14,61 +14,61 @@ pydantic-ai[logfire,openai]
|
|
|
14
14
|
ollama
|
|
15
15
|
|
|
16
16
|
[all]
|
|
17
|
-
|
|
17
|
+
tinynetrc
|
|
18
|
+
filetype
|
|
19
|
+
dnspython[doh]
|
|
20
|
+
json_repair
|
|
21
|
+
ollama
|
|
22
|
+
google-auth
|
|
23
|
+
pydantic-settings
|
|
18
24
|
semver
|
|
19
|
-
|
|
25
|
+
openai
|
|
26
|
+
distributed
|
|
20
27
|
yamlscript
|
|
21
|
-
pyyaml
|
|
22
28
|
dask[bag]
|
|
29
|
+
pyyaml
|
|
30
|
+
tabulate
|
|
31
|
+
flet-webview
|
|
32
|
+
flet-video
|
|
33
|
+
logfire[fastapi]
|
|
34
|
+
torchaudio
|
|
35
|
+
pymupdf
|
|
36
|
+
pandas
|
|
37
|
+
regex
|
|
23
38
|
pydantic-ai[logfire,openai]
|
|
24
|
-
google-auth
|
|
25
|
-
google-
|
|
39
|
+
google-auth-oauthlib
|
|
40
|
+
google-auth-httplib2
|
|
26
41
|
docker
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
deepmerge
|
|
30
|
-
regex
|
|
31
|
-
transformers[sentencepiece]
|
|
32
|
-
openai
|
|
33
|
-
pydevd-pycharm~=251.25410.159
|
|
42
|
+
sentence_transformers
|
|
43
|
+
httpx_retries
|
|
34
44
|
torchvision
|
|
35
|
-
|
|
45
|
+
uvicorn[standard]
|
|
46
|
+
faker
|
|
47
|
+
transformers[sentencepiece]
|
|
48
|
+
setuptools
|
|
36
49
|
bokeh
|
|
50
|
+
contexttimer
|
|
37
51
|
fastapi
|
|
52
|
+
tokenizers
|
|
53
|
+
diskcache
|
|
38
54
|
cachetools
|
|
39
|
-
|
|
40
|
-
peft
|
|
41
|
-
pydantic-settings
|
|
55
|
+
pydevd-pycharm~=251.25410.159
|
|
42
56
|
openpyxl
|
|
43
|
-
google-auth-httplib2
|
|
44
|
-
torchaudio
|
|
45
|
-
pydantic
|
|
46
|
-
sre_yield
|
|
47
57
|
appdirs
|
|
48
58
|
huggingface_hub
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
59
|
+
pytest-cov
|
|
60
|
+
sre_yield
|
|
61
|
+
flet[all]
|
|
62
|
+
html2text
|
|
63
|
+
google-api-python-client
|
|
64
|
+
pydantic
|
|
65
|
+
Unidecode
|
|
66
|
+
peft
|
|
54
67
|
pymupdf4llm
|
|
68
|
+
httpx
|
|
69
|
+
deepmerge
|
|
55
70
|
logfire
|
|
56
|
-
google-auth-oauthlib
|
|
57
|
-
tokenizers
|
|
58
|
-
ollama
|
|
59
|
-
diskcache
|
|
60
|
-
faker
|
|
61
|
-
logfire[fastapi]
|
|
62
|
-
setuptools
|
|
63
71
|
logfire[httpx]
|
|
64
|
-
tabulate
|
|
65
|
-
sentence_transformers
|
|
66
|
-
html2text
|
|
67
|
-
flet-video
|
|
68
|
-
json_repair
|
|
69
|
-
httpx
|
|
70
|
-
Unidecode
|
|
71
|
-
uvicorn[standard]
|
|
72
72
|
|
|
73
73
|
[api]
|
|
74
74
|
fastapi
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|