ikalogic-at1000 0.2.0__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.
Files changed (34) hide show
  1. ikalogic_at1000-0.2.0/LICENSE +21 -0
  2. ikalogic_at1000-0.2.0/PKG-INFO +129 -0
  3. ikalogic_at1000-0.2.0/README.md +98 -0
  4. ikalogic_at1000-0.2.0/pyproject.toml +72 -0
  5. ikalogic_at1000-0.2.0/src/ikalogic_at1000/__init__.py +231 -0
  6. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/__init__.py +1 -0
  7. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/errors.py +22 -0
  8. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/events.py +147 -0
  9. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/host.py +12 -0
  10. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/models.py +824 -0
  11. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/specs.py +611 -0
  12. ikalogic_at1000-0.2.0/src/ikalogic_at1000/_core/transport.py +119 -0
  13. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/__init__.py +228 -0
  14. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/at1000.py +64 -0
  15. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/com.py +220 -0
  16. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/discovery.py +86 -0
  17. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/events.py +67 -0
  18. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/gpio.py +120 -0
  19. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/hmi.py +106 -0
  20. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/http_client.py +39 -0
  21. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/management.py +145 -0
  22. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/power.py +129 -0
  23. ikalogic_at1000-0.2.0/src/ikalogic_at1000/aio/relays.py +54 -0
  24. ikalogic_at1000-0.2.0/src/ikalogic_at1000/at1000.py +54 -0
  25. ikalogic_at1000-0.2.0/src/ikalogic_at1000/com.py +250 -0
  26. ikalogic_at1000-0.2.0/src/ikalogic_at1000/discovery.py +91 -0
  27. ikalogic_at1000-0.2.0/src/ikalogic_at1000/events.py +179 -0
  28. ikalogic_at1000-0.2.0/src/ikalogic_at1000/gpio.py +136 -0
  29. ikalogic_at1000-0.2.0/src/ikalogic_at1000/hmi.py +125 -0
  30. ikalogic_at1000-0.2.0/src/ikalogic_at1000/http_client.py +39 -0
  31. ikalogic_at1000-0.2.0/src/ikalogic_at1000/management.py +243 -0
  32. ikalogic_at1000-0.2.0/src/ikalogic_at1000/power.py +157 -0
  33. ikalogic_at1000-0.2.0/src/ikalogic_at1000/py.typed +0 -0
  34. ikalogic_at1000-0.2.0/src/ikalogic_at1000/relays.py +59 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Ikalogic SAS
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: ikalogic-at1000
3
+ Version: 0.2.0
4
+ Summary: Python SDK for Ikalogic AT1000 devices
5
+ Keywords: at1000,ikalogic,test-sequencer,automated-testing,hardware,instrumentation,sdk,api
6
+ Author: Corentin AZAIS, Vladislav KOSINOV
7
+ Author-email: Corentin AZAIS <c.azais@ikalogic.com>, Vladislav KOSINOV <v.kosinov@ikalogic.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Manufacturing
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Topic :: Software Development :: Embedded Systems
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Typing :: Typed
23
+ Requires-Dist: httpx>=0.28.1
24
+ Requires-Dist: pydantic>=2.12.5
25
+ Requires-Dist: websockets>=13.0
26
+ Requires-Dist: zeroconf>=0.148.0
27
+ Requires-Python: >=3.10
28
+ Project-URL: Homepage, https://ikalogic.com/test-sequencers/at1000/intro/
29
+ Project-URL: Documentation, https://ikalogic.com/kb/at1000-api/at1000_home/
30
+ Description-Content-Type: text/markdown
31
+
32
+ # ikalogic-at1000
33
+
34
+ Official Python SDK for the Ikalogic AT1000 Series Test Sequencers.
35
+
36
+ This package provides a high-level API to control and automate the Ikalogic [AT1000](https://ikalogic.com/test-sequencers/at1000/intro/), a test sequencer designed for functional testing of electronic devices, PCBs, and complex systems. It ships both a synchronous client (`ikalogic_at1000`) and an asynchronous client (`ikalogic_at1000.aio`).
37
+
38
+ ## Key Features
39
+
40
+ - **32 Programmable I/Os:** Handle analog and digital signals within a ±25V range.
41
+ - **8 Dry Contact Relays:** Control external circuits, with one relay equipped for high-precision current measurement.
42
+ - **Programmable Power Supply:** Delivers 0 to 24V at up to 2A with precise current monitoring.
43
+ - **Dual USB 3.0 Ports:** Feature power cycling (on/off control) and current measurement for testing USB devices.
44
+ - **Communication Interfaces:** Includes Ethernet, RS232, RS485, CAN, SPI, I2C, and UART.
45
+ - **Human-Machine Interface (HMI):** Onboard screen, rotary knob, and speaker for standalone operation and feedback.
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install ikalogic-at1000
51
+ ```
52
+
53
+ Or, with [uv](https://docs.astral.sh/uv/):
54
+
55
+ ```bash
56
+ uv add ikalogic-at1000
57
+ ```
58
+
59
+ Requires Python 3.10 or newer.
60
+
61
+ ## Quick Start
62
+
63
+ Connect to a device by hostname or IP, or discover devices on the local network:
64
+
65
+ ```python
66
+ from ikalogic_at1000 import AT1000, find_devices
67
+
68
+ # Discover AT1000 devices over mDNS
69
+ for device in find_devices():
70
+ print(device)
71
+
72
+ # Or connect directly
73
+ device = AT1000("at1000.local")
74
+ print(device.info.model, device.info.serial_number)
75
+
76
+ device.reset()
77
+ device.close()
78
+ ```
79
+
80
+ ## Asynchronous Usage
81
+
82
+ The same API is available as coroutines under `ikalogic_at1000.aio`:
83
+
84
+ ```python
85
+ import asyncio
86
+
87
+ from ikalogic_at1000.aio import AT1000
88
+
89
+
90
+ async def main():
91
+ device = await AT1000.create("at1000.local")
92
+ print(device.info.model, device.info.serial_number)
93
+
94
+ await device.reset()
95
+ await device.aclose()
96
+
97
+
98
+ asyncio.run(main())
99
+ ```
100
+
101
+ ## Real-time Events
102
+
103
+ Subscribe to live device state changes over a WebSocket. Connect, then register callbacks per event type (or `"*"` for all events):
104
+
105
+ ```python
106
+ from ikalogic_at1000 import AT1000
107
+
108
+ device = AT1000("at1000.local")
109
+ device.events.connect()
110
+
111
+
112
+ def on_gpio(event):
113
+ print(event.type, event.data)
114
+
115
+
116
+ unsubscribe = device.events.subscribe("gpio.state", on_gpio)
117
+
118
+ # later
119
+ unsubscribe()
120
+ device.close()
121
+ ```
122
+
123
+ ## Documentation
124
+
125
+ Full API documentation is available at <https://ikalogic.com/kb/at1000-api/at1000_home/>.
126
+
127
+ ## License
128
+
129
+ This package is distributed under the MIT License.
@@ -0,0 +1,98 @@
1
+ # ikalogic-at1000
2
+
3
+ Official Python SDK for the Ikalogic AT1000 Series Test Sequencers.
4
+
5
+ This package provides a high-level API to control and automate the Ikalogic [AT1000](https://ikalogic.com/test-sequencers/at1000/intro/), a test sequencer designed for functional testing of electronic devices, PCBs, and complex systems. It ships both a synchronous client (`ikalogic_at1000`) and an asynchronous client (`ikalogic_at1000.aio`).
6
+
7
+ ## Key Features
8
+
9
+ - **32 Programmable I/Os:** Handle analog and digital signals within a ±25V range.
10
+ - **8 Dry Contact Relays:** Control external circuits, with one relay equipped for high-precision current measurement.
11
+ - **Programmable Power Supply:** Delivers 0 to 24V at up to 2A with precise current monitoring.
12
+ - **Dual USB 3.0 Ports:** Feature power cycling (on/off control) and current measurement for testing USB devices.
13
+ - **Communication Interfaces:** Includes Ethernet, RS232, RS485, CAN, SPI, I2C, and UART.
14
+ - **Human-Machine Interface (HMI):** Onboard screen, rotary knob, and speaker for standalone operation and feedback.
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ pip install ikalogic-at1000
20
+ ```
21
+
22
+ Or, with [uv](https://docs.astral.sh/uv/):
23
+
24
+ ```bash
25
+ uv add ikalogic-at1000
26
+ ```
27
+
28
+ Requires Python 3.10 or newer.
29
+
30
+ ## Quick Start
31
+
32
+ Connect to a device by hostname or IP, or discover devices on the local network:
33
+
34
+ ```python
35
+ from ikalogic_at1000 import AT1000, find_devices
36
+
37
+ # Discover AT1000 devices over mDNS
38
+ for device in find_devices():
39
+ print(device)
40
+
41
+ # Or connect directly
42
+ device = AT1000("at1000.local")
43
+ print(device.info.model, device.info.serial_number)
44
+
45
+ device.reset()
46
+ device.close()
47
+ ```
48
+
49
+ ## Asynchronous Usage
50
+
51
+ The same API is available as coroutines under `ikalogic_at1000.aio`:
52
+
53
+ ```python
54
+ import asyncio
55
+
56
+ from ikalogic_at1000.aio import AT1000
57
+
58
+
59
+ async def main():
60
+ device = await AT1000.create("at1000.local")
61
+ print(device.info.model, device.info.serial_number)
62
+
63
+ await device.reset()
64
+ await device.aclose()
65
+
66
+
67
+ asyncio.run(main())
68
+ ```
69
+
70
+ ## Real-time Events
71
+
72
+ Subscribe to live device state changes over a WebSocket. Connect, then register callbacks per event type (or `"*"` for all events):
73
+
74
+ ```python
75
+ from ikalogic_at1000 import AT1000
76
+
77
+ device = AT1000("at1000.local")
78
+ device.events.connect()
79
+
80
+
81
+ def on_gpio(event):
82
+ print(event.type, event.data)
83
+
84
+
85
+ unsubscribe = device.events.subscribe("gpio.state", on_gpio)
86
+
87
+ # later
88
+ unsubscribe()
89
+ device.close()
90
+ ```
91
+
92
+ ## Documentation
93
+
94
+ Full API documentation is available at <https://ikalogic.com/kb/at1000-api/at1000_home/>.
95
+
96
+ ## License
97
+
98
+ This package is distributed under the MIT License.
@@ -0,0 +1,72 @@
1
+ [project]
2
+ name = "ikalogic-at1000"
3
+ version = "0.2.0"
4
+ description = "Python SDK for Ikalogic AT1000 devices"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [
9
+ { name = "Corentin AZAIS", email = "c.azais@ikalogic.com" },
10
+ { name = "Vladislav KOSINOV", email = "v.kosinov@ikalogic.com" },
11
+ ]
12
+ keywords = [
13
+ "at1000",
14
+ "ikalogic",
15
+ "test-sequencer",
16
+ "automated-testing",
17
+ "hardware",
18
+ "instrumentation",
19
+ "sdk",
20
+ "api",
21
+ ]
22
+ classifiers = [
23
+ "Development Status :: 4 - Beta",
24
+ "Intended Audience :: Developers",
25
+ "Intended Audience :: Manufacturing",
26
+ "Operating System :: OS Independent",
27
+ "Programming Language :: Python :: 3",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Programming Language :: Python :: 3.14",
33
+ "Topic :: Software Development :: Embedded Systems",
34
+ "Topic :: Scientific/Engineering",
35
+ "Typing :: Typed",
36
+ ]
37
+ requires-python = ">=3.10"
38
+ dependencies = [
39
+ "httpx>=0.28.1",
40
+ "pydantic>=2.12.5",
41
+ "websockets>=13.0",
42
+ "zeroconf>=0.148.0",
43
+ ]
44
+
45
+ [project.urls]
46
+ Homepage = "https://ikalogic.com/test-sequencers/at1000/intro/"
47
+ Documentation = "https://ikalogic.com/kb/at1000-api/at1000_home/"
48
+
49
+ [build-system]
50
+ requires = ["uv_build>=0.11.24,<0.12.0"]
51
+ build-backend = "uv_build"
52
+
53
+ [dependency-groups]
54
+ dev = [
55
+ "hypothesis>=6.150.2",
56
+ "pytest>=9.0.2",
57
+ "pytest-asyncio>=1.3.0",
58
+ "pytest-cov>=7.0.0",
59
+ "ruff>=0.14.13",
60
+ ]
61
+
62
+ [tool.ruff.lint]
63
+ extend-select = ["B", "N"]
64
+
65
+ [tool.pytest.ini_options]
66
+ addopts = [
67
+ "--import-mode=importlib",
68
+ "--maxfail=1",
69
+ "--cov=ikalogic_at1000",
70
+ "--cov-report=term-missing",
71
+ ]
72
+ asyncio_mode = "auto"
@@ -0,0 +1,231 @@
1
+ """AT1000 Python SDK (synchronous client).
2
+
3
+ The asynchronous client lives in :mod:`ikalogic_at1000.aio`.
4
+ """
5
+
6
+ from importlib.metadata import PackageNotFoundError, version
7
+
8
+ from ._core.errors import ApiError
9
+ from ._core.events import DeviceEvent
10
+ from ._core.models import (
11
+ AnalogInputConfiguration,
12
+ AnalogOutputConfiguration,
13
+ AnalogState,
14
+ AudioCapabilities,
15
+ BundleInfo,
16
+ CalibrationData,
17
+ CalibrationPoint,
18
+ CalibrationState,
19
+ Capabilities,
20
+ CanConfig,
21
+ CanConfigPatch,
22
+ CanFrame,
23
+ CanRxFilter,
24
+ ChannelCalibration,
25
+ Color,
26
+ CommunicationCapability,
27
+ CommunicationInterfaceType,
28
+ CreateProject,
29
+ CurrentMeasurementCapabilities,
30
+ CurrentMeasurementType,
31
+ CurrentRange,
32
+ CurrentTestResult,
33
+ DigitalInputConfiguration,
34
+ DigitalOutputConfiguration,
35
+ DigitalState,
36
+ DisplayCapabilities,
37
+ DutPsuCalibration,
38
+ EthernetCapability,
39
+ EthernetType,
40
+ HmiCapabilities,
41
+ I2cConfig,
42
+ I2cReadTransaction,
43
+ I2cWriteTransaction,
44
+ Information,
45
+ InputCapabilities,
46
+ InstallResponse,
47
+ InternalKnobEvent,
48
+ IoCapabilities,
49
+ KnobEvent,
50
+ ManagementVoltageRangeModel,
51
+ OpenDrainConfiguration,
52
+ PartialAnalogOutputConfiguration,
53
+ PartialDigitalInputConfiguration,
54
+ PartialDigitalOutputConfiguration,
55
+ PartialOpenDrainConfiguration,
56
+ PlaybackConfiguration,
57
+ PortMapping,
58
+ PowerDutConfiguration,
59
+ PowerDutState,
60
+ PowerSupplyCapabilities,
61
+ PowerUsbConfiguration,
62
+ PowerUsbState,
63
+ Progress,
64
+ ProgressValue,
65
+ Project,
66
+ ProjectEvent,
67
+ ProjectPatch,
68
+ Projects,
69
+ RebootResponse,
70
+ RelayAction,
71
+ RelayPowerState,
72
+ RelaysCapabilities,
73
+ RelayState,
74
+ RelayTestResult,
75
+ Rs232Config,
76
+ Rs485Config,
77
+ RunMode,
78
+ ScreenSize,
79
+ ScreenText,
80
+ SerialParity,
81
+ SerialStopBits,
82
+ SpiConfig,
83
+ SyncAction,
84
+ SyncConfiguration,
85
+ Text,
86
+ Time,
87
+ UartConfig,
88
+ UpdateStatus,
89
+ UsbCapability,
90
+ UsbDevice,
91
+ UsbInterface,
92
+ UsbState,
93
+ UsbTestResult,
94
+ UsbType,
95
+ )
96
+ from .at1000 import AT1000
97
+ from .com import Can, ComApi, ComUsb, I2c, Rs232, Rs485, Spi, Uart
98
+ from .discovery import find_devices
99
+ from .events import EventsApi
100
+ from .gpio import AnalogIO, DigitalIO, GpioApi
101
+ from .hmi import Audio, HmiApi, Knob, Screen
102
+ from .management import ManagementApi
103
+ from .power import PowerApi, PowerDut, PowerUsb, RelayPower
104
+ from .relays import Relay, RelaysApi
105
+
106
+ try:
107
+ __version__ = version("ikalogic-at1000")
108
+ except PackageNotFoundError: # pragma: no cover
109
+ __version__ = "0.0.0"
110
+
111
+ __all__ = [
112
+ "__version__",
113
+ "AT1000",
114
+ "ApiError",
115
+ "find_devices",
116
+ # gpio
117
+ "AnalogIO",
118
+ "AnalogInputConfiguration",
119
+ "AnalogOutputConfiguration",
120
+ "AnalogState",
121
+ "DigitalIO",
122
+ "DigitalInputConfiguration",
123
+ "DigitalOutputConfiguration",
124
+ "DigitalState",
125
+ "GpioApi",
126
+ "OpenDrainConfiguration",
127
+ "PartialAnalogOutputConfiguration",
128
+ "PartialDigitalInputConfiguration",
129
+ "PartialDigitalOutputConfiguration",
130
+ "PartialOpenDrainConfiguration",
131
+ "SyncAction",
132
+ "SyncConfiguration",
133
+ # power
134
+ "PowerApi",
135
+ "PowerDut",
136
+ "PowerDutConfiguration",
137
+ "PowerDutState",
138
+ "PowerUsb",
139
+ "PowerUsbConfiguration",
140
+ "PowerUsbState",
141
+ "RelayPower",
142
+ "RelayPowerState",
143
+ # com
144
+ "Can",
145
+ "CanConfig",
146
+ "CanConfigPatch",
147
+ "CanFrame",
148
+ "CanRxFilter",
149
+ "ComApi",
150
+ "ComUsb",
151
+ "I2c",
152
+ "I2cConfig",
153
+ "I2cReadTransaction",
154
+ "I2cWriteTransaction",
155
+ "Rs232",
156
+ "Rs232Config",
157
+ "Rs485",
158
+ "Rs485Config",
159
+ "SerialParity",
160
+ "SerialStopBits",
161
+ "Spi",
162
+ "SpiConfig",
163
+ "Uart",
164
+ "UartConfig",
165
+ "UsbDevice",
166
+ "UsbInterface",
167
+ "UsbState",
168
+ # hmi
169
+ "Audio",
170
+ "Color",
171
+ "HmiApi",
172
+ "InternalKnobEvent",
173
+ "Knob",
174
+ "KnobEvent",
175
+ "PlaybackConfiguration",
176
+ "Progress",
177
+ "ProgressValue",
178
+ "Screen",
179
+ "ScreenText",
180
+ "Text",
181
+ # relays
182
+ "Relay",
183
+ "RelayAction",
184
+ "RelayState",
185
+ "RelaysApi",
186
+ # events
187
+ "DeviceEvent",
188
+ "EventsApi",
189
+ # management
190
+ "AudioCapabilities",
191
+ "BundleInfo",
192
+ "CalibrationData",
193
+ "CalibrationPoint",
194
+ "CalibrationState",
195
+ "Capabilities",
196
+ "ChannelCalibration",
197
+ "CommunicationCapability",
198
+ "CommunicationInterfaceType",
199
+ "CreateProject",
200
+ "CurrentMeasurementCapabilities",
201
+ "CurrentMeasurementType",
202
+ "CurrentRange",
203
+ "CurrentTestResult",
204
+ "DisplayCapabilities",
205
+ "DutPsuCalibration",
206
+ "EthernetCapability",
207
+ "EthernetType",
208
+ "HmiCapabilities",
209
+ "Information",
210
+ "InputCapabilities",
211
+ "InstallResponse",
212
+ "IoCapabilities",
213
+ "ManagementApi",
214
+ "ManagementVoltageRangeModel",
215
+ "PortMapping",
216
+ "PowerSupplyCapabilities",
217
+ "Project",
218
+ "ProjectEvent",
219
+ "ProjectPatch",
220
+ "Projects",
221
+ "RebootResponse",
222
+ "RelayTestResult",
223
+ "RelaysCapabilities",
224
+ "RunMode",
225
+ "ScreenSize",
226
+ "Time",
227
+ "UpdateStatus",
228
+ "UsbCapability",
229
+ "UsbTestResult",
230
+ "UsbType",
231
+ ]
@@ -0,0 +1 @@
1
+ """Concurrency-agnostic core shared by the sync and async AT1000 clients."""
@@ -0,0 +1,22 @@
1
+ """Structured API error mirroring the JavaScript SDK's ``ApiError``."""
2
+
3
+
4
+ class ApiError(Exception):
5
+ """Error raised for AT1000 responses carrying ``{code, message, suggestion, path}``.
6
+
7
+ The string representation matches the JavaScript SDK exactly so callers can
8
+ rely on ``str(error)`` containing the offending ``path``.
9
+ """
10
+
11
+ def __init__(self, *, code: str, message: str, suggestion: str, path: str):
12
+ self.code = code
13
+ # Raw human-readable server message (without code/suggestion/path).
14
+ self.detail = message
15
+ self.suggestion = suggestion
16
+ self.path = path
17
+ formatted_suggestion = suggestion.replace("\n", "\n ")
18
+ super().__init__(
19
+ f"{message} ({code})\n"
20
+ f" Suggestion: {formatted_suggestion}\n"
21
+ f" Path: {path}"
22
+ )