fmtr.tools 1.3.11__py3-none-any.whl → 1.3.13__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.

@@ -1,8 +1,7 @@
1
- from dataclasses import dataclass
2
- from functools import cached_property
3
-
4
1
  import dns as dnspython
2
+ from dataclasses import dataclass
5
3
  from dns import query
4
+ from functools import cached_property
6
5
  from httpx_retries import Retry, RetryTransport
7
6
 
8
7
  from fmtr.tools import http_tools as http
@@ -82,8 +81,14 @@ class HTTP:
82
81
 
83
82
  headers = self.HEADERS | dict(Host=self.host)
84
83
  url = self.url.format(host=self.ip)
85
- response_doh = self.CLIENT.post(url, headers=headers, content=exchange.query_last.to_wire())
86
- response_doh.raise_for_status()
87
- response = Response.from_http(response_doh)
88
84
 
89
- exchange.response.message.answer += response.message.answer
85
+ try:
86
+ response_doh = self.CLIENT.post(url, headers=headers, content=exchange.query_last.to_wire())
87
+ response_doh.raise_for_status()
88
+ response = Response.from_http(response_doh)
89
+ exchange.response.message.answer += response.message.answer
90
+
91
+ except Exception as exception:
92
+ exchange.response.message.set_rcode(dnspython.rcode.SERVFAIL)
93
+ exchange.response.is_complete = True
94
+ logger.exception(exception)
@@ -1,6 +1,7 @@
1
1
  import dns
2
2
  import httpx
3
3
  from dataclasses import dataclass
4
+ from dns import rcode as dnsrcode
4
5
  from dns.message import Message, QueryMessage
5
6
  from dns.rrset import RRset
6
7
  from functools import cached_property
@@ -58,6 +59,14 @@ class Response(BaseDNSData):
58
59
  return None
59
60
  return self.message.answer[-1]
60
61
 
62
+ @property
63
+ def rcode(self) -> dnsrcode.Rcode:
64
+ return self.message.rcode()
65
+
66
+ @property
67
+ def rcode_text(self) -> str:
68
+ return dnsrcode.to_text(self.rcode)
69
+
61
70
  def __str__(self):
62
71
  """
63
72
 
@@ -79,7 +79,10 @@ class Plain:
79
79
  if not request.is_valid:
80
80
  raise ValueError(f'Only one question per request is supported. Got {len(request.question)} questions.')
81
81
 
82
- with logger.span(f'Handling request {request.message.id=} {request.question=} {exchange.client=}...'):
82
+ span = logger.span(
83
+ f'Handling request {request.message.id=} {request.type_text} {request.name_text} {request.question=} {exchange.ip=} {exchange.port=}...'
84
+ )
85
+ with span:
83
86
 
84
87
  with logger.span(f'Checking cache...'):
85
88
  self.check_cache(exchange)
@@ -89,6 +92,9 @@ class Plain:
89
92
  exchange.response.is_complete = True
90
93
 
91
94
  self.cache[exchange.key] = exchange.response
95
+ logger.info(f'Resolution complete {request.message.id=} {exchange.response.rcode_text=} {exchange.response.answer=}')
96
+
97
+ attribs = dict(rcode=exchange.response.rcode, rcode_text=exchange.response.rcode_text)
98
+ span.set_attributes(attribs)
92
99
 
93
- logger.info(f'Resolution complete {request.message.id=} {exchange.response.answer=}')
94
100
  return exchange
fmtr/tools/version CHANGED
@@ -1 +1 @@
1
- 1.3.11
1
+ 1.3.13
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fmtr.tools
3
- Version: 1.3.11
3
+ Version: 1.3.13
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: sre_yield; extra == "all"
130
- Requires-Dist: tinynetrc; extra == "all"
131
- Requires-Dist: tokenizers; extra == "all"
132
- Requires-Dist: pydantic-settings; extra == "all"
129
+ Requires-Dist: logfire; extra == "all"
130
+ Requires-Dist: torchaudio; extra == "all"
131
+ Requires-Dist: pydantic; extra == "all"
132
+ Requires-Dist: ollama; extra == "all"
133
+ Requires-Dist: contexttimer; extra == "all"
134
+ Requires-Dist: Unidecode; extra == "all"
135
+ Requires-Dist: bokeh; extra == "all"
133
136
  Requires-Dist: dask[bag]; extra == "all"
134
- Requires-Dist: filetype; extra == "all"
137
+ Requires-Dist: faker; extra == "all"
138
+ Requires-Dist: yamlscript; extra == "all"
139
+ Requires-Dist: pytest-cov; extra == "all"
140
+ Requires-Dist: logfire[fastapi]; extra == "all"
135
141
  Requires-Dist: logfire[httpx]; extra == "all"
142
+ Requires-Dist: diskcache; extra == "all"
143
+ Requires-Dist: pyyaml; extra == "all"
136
144
  Requires-Dist: distributed; extra == "all"
137
- Requires-Dist: regex; extra == "all"
145
+ Requires-Dist: tinynetrc; extra == "all"
146
+ Requires-Dist: deepmerge; extra == "all"
147
+ Requires-Dist: uvicorn[standard]; extra == "all"
138
148
  Requires-Dist: pymupdf4llm; extra == "all"
139
- Requires-Dist: torchaudio; extra == "all"
140
- Requires-Dist: cachetools; extra == "all"
141
- Requires-Dist: bokeh; extra == "all"
149
+ Requires-Dist: filetype; extra == "all"
150
+ Requires-Dist: sre_yield; extra == "all"
142
151
  Requires-Dist: transformers[sentencepiece]; extra == "all"
152
+ Requires-Dist: sentence_transformers; extra == "all"
143
153
  Requires-Dist: fastapi; extra == "all"
144
- Requires-Dist: tabulate; extra == "all"
145
- Requires-Dist: faker; extra == "all"
154
+ Requires-Dist: flet[all]; extra == "all"
155
+ Requires-Dist: flet-webview; extra == "all"
146
156
  Requires-Dist: setuptools; extra == "all"
147
- Requires-Dist: logfire; extra == "all"
148
- Requires-Dist: appdirs; extra == "all"
149
- Requires-Dist: peft; extra == "all"
150
- Requires-Dist: pymupdf; extra == "all"
151
- Requires-Dist: torchvision; extra == "all"
152
- Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
153
- Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
154
- Requires-Dist: ollama; extra == "all"
155
- Requires-Dist: google-auth; extra == "all"
156
- Requires-Dist: flet-video; extra == "all"
157
- Requires-Dist: google-auth-httplib2; extra == "all"
158
- Requires-Dist: pytest-cov; extra == "all"
159
- Requires-Dist: huggingface_hub; extra == "all"
160
- Requires-Dist: Unidecode; extra == "all"
161
157
  Requires-Dist: openai; extra == "all"
162
- Requires-Dist: google-api-python-client; extra == "all"
163
- Requires-Dist: logfire[fastapi]; extra == "all"
164
- Requires-Dist: diskcache; extra == "all"
165
- Requires-Dist: pydantic; extra == "all"
166
- Requires-Dist: sentence_transformers; extra == "all"
158
+ Requires-Dist: google-auth-oauthlib; extra == "all"
167
159
  Requires-Dist: docker; extra == "all"
168
- Requires-Dist: html2text; extra == "all"
160
+ Requires-Dist: flet-video; extra == "all"
161
+ Requires-Dist: tabulate; extra == "all"
169
162
  Requires-Dist: semver; extra == "all"
170
- Requires-Dist: pandas; extra == "all"
171
- Requires-Dist: contexttimer; extra == "all"
172
- Requires-Dist: dnspython[doh]; extra == "all"
173
- Requires-Dist: flet[all]; extra == "all"
174
- Requires-Dist: pyyaml; extra == "all"
175
- Requires-Dist: httpx; extra == "all"
176
163
  Requires-Dist: httpx_retries; extra == "all"
177
- Requires-Dist: deepmerge; extra == "all"
178
164
  Requires-Dist: json_repair; extra == "all"
179
- Requires-Dist: yamlscript; extra == "all"
180
- Requires-Dist: uvicorn[standard]; extra == "all"
181
- Requires-Dist: flet-webview; extra == "all"
182
- Requires-Dist: google-auth-oauthlib; extra == "all"
165
+ Requires-Dist: tokenizers; extra == "all"
166
+ Requires-Dist: pydantic-settings; extra == "all"
167
+ Requires-Dist: torchvision; extra == "all"
168
+ Requires-Dist: google-api-python-client; extra == "all"
169
+ Requires-Dist: html2text; extra == "all"
170
+ Requires-Dist: google-auth-httplib2; extra == "all"
171
+ Requires-Dist: cachetools; extra == "all"
172
+ Requires-Dist: httpx; extra == "all"
173
+ Requires-Dist: google-auth; extra == "all"
174
+ Requires-Dist: pymupdf; extra == "all"
175
+ Requires-Dist: regex; extra == "all"
176
+ Requires-Dist: huggingface_hub; extra == "all"
183
177
  Requires-Dist: openpyxl; extra == "all"
178
+ Requires-Dist: pydevd-pycharm~=251.25410.159; extra == "all"
179
+ Requires-Dist: appdirs; extra == "all"
180
+ Requires-Dist: dnspython[doh]; extra == "all"
181
+ Requires-Dist: pydantic-ai[logfire,openai]; extra == "all"
182
+ Requires-Dist: peft; extra == "all"
183
+ Requires-Dist: pandas; extra == "all"
184
184
  Dynamic: author
185
185
  Dynamic: author-email
186
186
  Dynamic: description
@@ -44,16 +44,16 @@ 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=NHwZLjrWn5Hn9sdgFA0ixXGem916c9K6ERwYF7z_-dc,6
47
+ fmtr/tools/version,sha256=328hBDnJV-prjTlVQ7pm2D7s-V9Yds2R3yjA2Xc9M4Q,6
48
48
  fmtr/tools/yaml_tools.py,sha256=Bhhyd6GQVKO72Lp8ky7bAUjIB_65Hdh0Q45SKIEe6S8,1901
49
49
  fmtr/tools/ai_tools/__init__.py,sha256=JZrLuOFNV1A3wvJgonxOgz_4WS-7MfCuowGWA5uYCjs,372
50
50
  fmtr/tools/ai_tools/agentic_tools.py,sha256=acSEPFS-aguDXanWGs3fAAlRyJSYPZW7L-Kb2qDLm-I,4300
51
51
  fmtr/tools/ai_tools/inference_tools.py,sha256=2UP2gXEyOJUjyyV6zmFIYmIxUsh1rXkRH0IbFvr2bRs,11908
52
52
  fmtr/tools/dns_tools/__init__.py,sha256=PjD3Og6D5yvDVpKmsUsrnSpz_rjXpl4zBtvMqm8xKWU,237
53
- fmtr/tools/dns_tools/client.py,sha256=c2vzWBDZSxijwL1KvWUoDGc8wqk_KTAFxCr0P1rNjy8,2367
54
- fmtr/tools/dns_tools/dm.py,sha256=QqEYebamLWMzr1KM1x4P4dUvPZL_zvymZrNj6ghw0rg,4445
53
+ fmtr/tools/dns_tools/client.py,sha256=zAPJbQZIuNJPTA-HDBtrVZHvHRP_7QYWLgH7D73g5LU,2598
54
+ fmtr/tools/dns_tools/dm.py,sha256=rg2y-zyMW8PzkzEkFah3KcbrIeInFBdLdemJHGwW8Vk,4661
55
55
  fmtr/tools/dns_tools/proxy.py,sha256=b3TdSwRO7IwcNjrWg1e8jVQb-YxJhT377rdVkeDc8_I,1466
56
- fmtr/tools/dns_tools/server.py,sha256=Owk5Oyf-9yyI9vzBo-j7VMYN6pOYE8K0rABL65Gpq_0,2631
56
+ fmtr/tools/dns_tools/server.py,sha256=reHQvZq1kqMShpRyIK985u08XdkMnHlDOQh8vPUOiIg,2899
57
57
  fmtr/tools/entrypoints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  fmtr/tools/entrypoints/cache_hfh.py,sha256=fQNs4J9twQuZH_Yj98-oOvEX7-LrSUP3kO8nzw2HrHs,60
59
59
  fmtr/tools/entrypoints/ep_test.py,sha256=B8HfWISfSgw_xVX475CbJGh_QnpOe9MH65H8qGjTWbY,46
@@ -76,9 +76,9 @@ fmtr/tools/tests/test_path.py,sha256=AkZQa6_8BQ-VaCyL_J-iKmdf2ZaM-xFYR37Kun3k4_g
76
76
  fmtr/tools/tests/test_yaml.py,sha256=jc0TwwKu9eC0LvFGNMERdgBue591xwLxYXFbtsRwXVM,287
77
77
  fmtr/tools/version_tools/__init__.py,sha256=pg4iLtmIr5HtyEW_j0fMFoIdzqi_w9xH8-grQaXLB28,318
78
78
  fmtr/tools/version_tools/version_tools.py,sha256=Hcc6yferZS1hHbugRTdiHhSNmXEEG0hjCiTTXKna-YY,1127
79
- fmtr_tools-1.3.11.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
80
- fmtr_tools-1.3.11.dist-info/METADATA,sha256=KbWHkJ4m5OQMOCWma9Bnd53J77hAPvNKofIicPXgR_E,15938
81
- fmtr_tools-1.3.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
- fmtr_tools-1.3.11.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
83
- fmtr_tools-1.3.11.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
84
- fmtr_tools-1.3.11.dist-info/RECORD,,
79
+ fmtr_tools-1.3.13.dist-info/licenses/LICENSE,sha256=FW9aa6vVN5IjRQWLT43hs4_koYSmpcbIovlKeAJ0_cI,10757
80
+ fmtr_tools-1.3.13.dist-info/METADATA,sha256=-ichUA6JZb4dYc08MhnCKtZvyL6uuTIy824HI5QFpt4,15938
81
+ fmtr_tools-1.3.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
82
+ fmtr_tools-1.3.13.dist-info/entry_points.txt,sha256=h-r__Xh5njtFqreMLg6cGuTFS4Qh-QqJPU1HB-_BS-Q,357
83
+ fmtr_tools-1.3.13.dist-info/top_level.txt,sha256=LXem9xCgNOD72tE2gRKESdiQTL902mfFkwWb6-dlwEE,5
84
+ fmtr_tools-1.3.13.dist-info/RECORD,,