fmtr.tools 1.3.3__py3-none-any.whl → 1.3.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fmtr.tools might be problematic. Click here for more details.

@@ -2,6 +2,7 @@ import socket
2
2
  from dataclasses import dataclass
3
3
 
4
4
  from fmtr.tools.dns_tools.dm import Exchange
5
+ from fmtr.tools.logging_tools import logger
5
6
 
6
7
 
7
8
  @dataclass
@@ -30,7 +31,7 @@ class Plain:
30
31
  """
31
32
  sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
32
33
  sock.bind((self.host, self.port))
33
- print(f"Listening on {self.host}:{self.port}")
34
+ logger.info(f'Listening on {self.host}:{self.port}')
34
35
  while True:
35
36
  data, (ip, port) = sock.recvfrom(512)
36
37
  exchange = Exchange.from_wire(data, ip=ip, port=port)
@@ -0,0 +1,8 @@
1
+ def main():
2
+ """
3
+
4
+ Ensure YS binary is installed.
5
+
6
+ """
7
+ from fmtr.tools import yaml
8
+ return yaml.install()
@@ -108,6 +108,11 @@ class Transformer:
108
108
  default: Any = None
109
109
  is_recursive: bool = False
110
110
 
111
+ def __post_init__(self):
112
+ with logger.span(f'Compiling expression {len(self.items)=}'):
113
+ rx = self.rx
114
+ logger.debug(f'Compiled successfully {rx.groups=}')
115
+
111
116
  @cached_property
112
117
  def pattern(self) -> str:
113
118
  """
@@ -132,6 +137,11 @@ class Transformer:
132
137
  return re.compile(self.pattern)
133
138
 
134
139
  def get_default(self, key: Key) -> Any:
140
+ """
141
+
142
+ Define what to return in case of no match
143
+
144
+ """
135
145
  if self.is_recursive:
136
146
  return key
137
147
  else:
@@ -162,7 +172,7 @@ class Transformer:
162
172
 
163
173
  if not match:
164
174
  value = self.get_default(key)
165
- logger.debug(f'No match for {key=}. Returning {self.default=}')
175
+ logger.debug(f'No match for {key=}. Returning {self.get_default(key)=}')
166
176
  else:
167
177
 
168
178
  match_ids = {name: v for name, v in match.groupdict().items() if v}
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.3.3
1
+ 1.3.5
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.3
3
+ Version: 1.3.5
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
@@ -102,7 +102,7 @@ Requires-Dist: pymupdf; extra == "pdf"
102
102
  Requires-Dist: pydantic; extra == "pdf"
103
103
  Requires-Dist: pymupdf4llm; extra == "pdf"
104
104
  Provides-Extra: debug
105
- Requires-Dist: pydevd-pycharm; extra == "debug"
105
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "debug"
106
106
  Provides-Extra: sets
107
107
  Requires-Dist: pydantic-settings; extra == "sets"
108
108
  Requires-Dist: pydantic; extra == "sets"
@@ -130,60 +130,60 @@ Requires-Dist: logfire[httpx]; extra == "http"
130
130
  Provides-Extra: setup
131
131
  Requires-Dist: setuptools; extra == "setup"
132
132
  Provides-Extra: all
133
- Requires-Dist: appdirs; extra == "all"
134
- Requires-Dist: diskcache; extra == "all"
135
- Requires-Dist: html2text; extra == "all"
136
- Requires-Dist: semver; extra == "all"
137
- Requires-Dist: transformers[sentencepiece]; extra == "all"
133
+ Requires-Dist: openpyxl; extra == "all"
134
+ Requires-Dist: sentence_transformers; extra == "all"
135
+ Requires-Dist: logfire[fastapi]; extra == "all"
136
+ Requires-Dist: setuptools; extra == "all"
137
+ Requires-Dist: tinynetrc; extra == "all"
138
+ Requires-Dist: flet[all]; extra == "all"
139
+ Requires-Dist: contexttimer; extra == "all"
138
140
  Requires-Dist: json_repair; extra == "all"
139
- Requires-Dist: sre_yield; extra == "all"
140
- Requires-Dist: torchvision; extra == "all"
141
+ Requires-Dist: google-api-python-client; extra == "all"
142
+ Requires-Dist: bokeh; extra == "all"
143
+ Requires-Dist: faker; extra == "all"
144
+ Requires-Dist: tabulate; extra == "all"
145
+ Requires-Dist: httpx_retries; extra == "all"
146
+ Requires-Dist: html2text; extra == "all"
147
+ Requires-Dist: google-auth; extra == "all"
148
+ Requires-Dist: openai; extra == "all"
149
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
150
+ Requires-Dist: logfire[httpx]; extra == "all"
151
+ Requires-Dist: appdirs; extra == "all"
141
152
  Requires-Dist: pymupdf; extra == "all"
142
- Requires-Dist: Unidecode; extra == "all"
143
- Requires-Dist: ollama; extra == "all"
144
- Requires-Dist: peft; extra == "all"
145
- Requires-Dist: google-auth-oauthlib; extra == "all"
146
- Requires-Dist: pandas; extra == "all"
147
- Requires-Dist: pydantic; extra == "all"
148
- Requires-Dist: yamlscript; extra == "all"
149
- Requires-Dist: pyyaml; extra == "all"
150
- Requires-Dist: pymupdf4llm; extra == "all"
151
153
  Requires-Dist: docker; extra == "all"
152
- Requires-Dist: faker; extra == "all"
153
- Requires-Dist: distributed; extra == "all"
154
- Requires-Dist: flet[all]; extra == "all"
155
- Requires-Dist: pytest-cov; extra == "all"
156
- Requires-Dist: dnspython[doh]; extra == "all"
157
- Requires-Dist: tinynetrc; extra == "all"
158
- Requires-Dist: flet-video; extra == "all"
159
154
  Requires-Dist: dask[bag]; extra == "all"
160
- Requires-Dist: bokeh; extra == "all"
161
- Requires-Dist: httpx; extra == "all"
155
+ Requires-Dist: torchvision; extra == "all"
156
+ Requires-Dist: distributed; extra == "all"
157
+ Requires-Dist: pydantic-settings; extra == "all"
162
158
  Requires-Dist: logfire; extra == "all"
163
- Requires-Dist: contexttimer; extra == "all"
164
- Requires-Dist: httpx_retries; extra == "all"
165
- Requires-Dist: google-auth; extra == "all"
166
- Requires-Dist: deepmerge; extra == "all"
167
- Requires-Dist: torchaudio; extra == "all"
168
- Requires-Dist: regex; extra == "all"
169
- Requires-Dist: sentence_transformers; extra == "all"
170
- Requires-Dist: tokenizers; extra == "all"
159
+ Requires-Dist: pymupdf4llm; extra == "all"
160
+ Requires-Dist: fastapi; extra == "all"
171
161
  Requires-Dist: huggingface_hub; extra == "all"
172
- Requires-Dist: tabulate; extra == "all"
173
- Requires-Dist: logfire[fastapi]; extra == "all"
174
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
162
+ Requires-Dist: pytest-cov; extra == "all"
163
+ Requires-Dist: sre_yield; extra == "all"
175
164
  Requires-Dist: flet-webview; extra == "all"
176
- Requires-Dist: pydantic-settings; extra == "all"
165
+ Requires-Dist: pydantic; extra == "all"
166
+ Requires-Dist: pandas; extra == "all"
167
+ Requires-Dist: flet-video; extra == "all"
168
+ Requires-Dist: deepmerge; extra == "all"
169
+ Requires-Dist: transformers[sentencepiece]; extra == "all"
170
+ Requires-Dist: filetype; extra == "all"
171
+ Requires-Dist: ollama; extra == "all"
177
172
  Requires-Dist: uvicorn[standard]; extra == "all"
178
- Requires-Dist: openai; extra == "all"
179
- Requires-Dist: pydevd-pycharm; extra == "all"
180
- Requires-Dist: google-api-python-client; extra == "all"
181
- Requires-Dist: fastapi; extra == "all"
182
- Requires-Dist: logfire[httpx]; extra == "all"
183
173
  Requires-Dist: google-auth-httplib2; extra == "all"
184
- Requires-Dist: filetype; extra == "all"
185
- Requires-Dist: openpyxl; extra == "all"
186
- Requires-Dist: setuptools; extra == "all"
174
+ Requires-Dist: httpx; extra == "all"
175
+ Requires-Dist: regex; extra == "all"
176
+ Requires-Dist: Unidecode; extra == "all"
177
+ Requires-Dist: google-auth-oauthlib; extra == "all"
178
+ Requires-Dist: pyyaml; extra == "all"
179
+ Requires-Dist: yamlscript; extra == "all"
180
+ Requires-Dist: peft; extra == "all"
181
+ Requires-Dist: dnspython[doh]; extra == "all"
182
+ Requires-Dist: semver; extra == "all"
183
+ Requires-Dist: torchaudio; extra == "all"
184
+ Requires-Dist: tokenizers; extra == "all"
185
+ Requires-Dist: diskcache; extra == "all"
186
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
187
187
  Dynamic: author
188
188
  Dynamic: author-email
189
189
  Dynamic: description
@@ -30,7 +30,7 @@ fmtr/tools/netrc_tools.py,sha256=PpNpz_mWlQi6VHGromKwFfTyLpHUXsd4LY6-OKLCbeI,376
30
30
  fmtr/tools/openai_tools.py,sha256=6SUgejgzUzmlKKct2_ePXntvMegu3FJgfk9x7aqtqYc,742
31
31
  fmtr/tools/packaging_tools.py,sha256=FlgOTnDRHZWQL2iR-wucTsyGEHRE-MlddKL30MPmUqE,253
32
32
  fmtr/tools/parallel_tools.py,sha256=QEb_gN1StkxsqYaH4HSjiJX8Y3gpb2uKNsOzG4uFpaM,3071
33
- fmtr/tools/pattern_tools.py,sha256=qlyMVpkkzsoxV-TRhaevsNvLekFotqUsgf2DA8L0sGk,5689
33
+ fmtr/tools/pattern_tools.py,sha256=EYKtBPnoBwTpvTPZWLYGrRFIGnSg2R6Tv2VmxvoJDog,5959
34
34
  fmtr/tools/pdf_tools.py,sha256=xvv9B84uAF81rFJRnXhSsxYuP42vY9ZdPVFrSMVe8G8,4069
35
35
  fmtr/tools/platform_tools.py,sha256=7p69CmAHe_sF68Fx9uVhns1k5EewTHTWgUYzkl6ZQKA,308
36
36
  fmtr/tools/process_tools.py,sha256=Ysh5Dk2QFBhXQerArjKdt7xZd3JrN5Ho02AaOjH0Nnw,1425
@@ -44,7 +44,7 @@ fmtr/tools/tabular_tools.py,sha256=tpIpZzYku1HcJrHZJL6BC39LmN3WUWVhFbK2N7nDVmE,1
44
44
  fmtr/tools/tokenization_tools.py,sha256=me-IBzSLyNYejLybwjO9CNB6Mj2NYfKPaOVThXyaGNg,4268
45
45
  fmtr/tools/tools.py,sha256=CAsApa1YwVdNE6H66Vjivs_mXYvOas3rh7fPELAnTpk,795
46
46
  fmtr/tools/unicode_tools.py,sha256=yS_9wpu8ogNoiIL7s1G_8bETFFO_YQlo4LNPv1NLDeY,52
47
- fmtr/tools/version,sha256=pbg4E5bSWOYbKrcebHaTPc25w2I4kZ1HI9h4zfIedp8,5
47
+ fmtr/tools/version,sha256=A3CRagPGF-vPgHHT1p_3Z_XER8Hoz9D7TibYsZEJVmU,5
48
48
  fmtr/tools/version_tools.py,sha256=yNs_CGqWpqE4jbK9wsPIi14peJVXYbhIcMqHAFOw3yE,1480
49
49
  fmtr/tools/yaml_tools.py,sha256=9kuYChqJelWQIjGlSnK4iDdOWWH06P0gp9jIcRrC3UI,1903
50
50
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
@@ -54,10 +54,11 @@ fmtr/tools/dns_tools/__init__.py,sha256=PjD3Og6D5yvDVpKmsUsrnSpz_rjXpl4zBtvMqm8x
54
54
  fmtr/tools/dns_tools/client.py,sha256=c2vzWBDZSxijwL1KvWUoDGc8wqk_KTAFxCr0P1rNjy8,2367
55
55
  fmtr/tools/dns_tools/dm.py,sha256=KWQeeZhsDyrKoXzAD5zEOoHH3aiD4uKRqwnD8fFP1nI,3725
56
56
  fmtr/tools/dns_tools/proxy.py,sha256=L0utKw8D1JXtAW9IfXcBdNMb-AyPFgW5XGiPnWuk7D8,1878
57
- fmtr/tools/dns_tools/server.py,sha256=0RLsyVH8C-15PAJgqMNqxbHTPbTWkq_thh8nnS1clAg,892
57
+ fmtr/tools/dns_tools/server.py,sha256=t38TmSpra3FRoMk351eHzOOPlSuaCyjxbvPwX9o15ak,942
58
58
  fmtr/tools/entrypoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  fmtr/tools/entrypoints/cache_hfh.py,sha256=fQNs4J9twQuZH_Yj98-oOvEX7-LrSUP3kO8nzw2HrHs,60
60
60
  fmtr/tools/entrypoints/ep_test.py,sha256=B8HfWISfSgw_xVX475CbJGh_QnpOe9MH65H8qGjTWbY,46
61
+ fmtr/tools/entrypoints/install_yamlscript.py,sha256=_q1OSjV2eja0JFlyS6Fyhx0xx4cFU1esX3X6TKZGG04,123
61
62
  fmtr/tools/entrypoints/remote_debug_test.py,sha256=wmKg9o2pQq7eqeHmaO8oviujNgtnsCVEXOdXLIcQWs4,123
62
63
  fmtr/tools/entrypoints/shell_debug.py,sha256=0No3tAg9Ri4_vvSlQCUtAY-11HR0nE45i0VVtiAViwY,106
63
64
  fmtr/tools/path_tools/__init__.py,sha256=v5CpmzXq5Ii90FtcmxAJKiLxmguZMrPnQ_HdT872Np0,443
@@ -74,9 +75,9 @@ fmtr/tools/tests/test_environment.py,sha256=iHaiMQfECYZPkPKwfuIZV9uHuWe3aE-p_dN_
74
75
  fmtr/tools/tests/test_json.py,sha256=IeSP4ziPvRcmS8kq7k9tHonC9rN5YYq9GSNT2ul6Msk,287
75
76
  fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g,2188
76
77
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
77
- fmtr_tools-1.3.3.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
78
- fmtr_tools-1.3.3.dist-info/METADATA,sha256=mqGPV0sovCZznll14sPWlH6fr1oa1WdyPit9_WiOu0I,16030
79
- fmtr_tools-1.3.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
80
- fmtr_tools-1.3.3.dist-info/entry_points.txt,sha256=fSQrDGNctdQXbUxpMWYVfVQ0mhZMDyaEDG3D3a0zOSc,278
81
- fmtr_tools-1.3.3.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
82
- fmtr_tools-1.3.3.dist-info/RECORD,,
78
+ fmtr_tools-1.3.5.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
79
+ fmtr_tools-1.3.5.dist-info/METADATA,sha256=BZUlxcIQC0rSnj6GtCK86nkFIqmDK7ArsG8sRi1VRrc,16060
80
+ fmtr_tools-1.3.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
81
+ fmtr_tools-1.3.5.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
82
+ fmtr_tools-1.3.5.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
83
+ fmtr_tools-1.3.5.dist-info/RECORD,,
@@ -1,5 +1,6 @@
1
1
  [console_scripts]
2
2
  fmtr-tools-cache-hfh = fmtr.tools.entrypoints.cache_hfh:main
3
3
  fmtr-tools-ep-test = fmtr.tools.entrypoints.ep_test:main
4
+ fmtr-tools-install-yamlscript = fmtr.tools.entrypoints.install_yamlscript:main
4
5
  fmtr-tools-remote-debug-test = fmtr.tools.entrypoints.remote_debug_test:main
5
6
  fmtr-tools-shell-debug = fmtr.tools.entrypoints.shell_debug:main