icmd-python 3.3.4__py3-none-any.whl → 3.10.0__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.
icmd/__init__.py CHANGED
@@ -6,14 +6,20 @@ from .core.advisory import AdvisoryFinding, ContractProvider, check_input_dict
6
6
  from .core.contracts import ContractClient, ContractTransport
7
7
  from .core.exceptions import (
8
8
  ICMDAuthenticationError,
9
+ ICMDChecksumMismatchError,
9
10
  ICMDConnectionError,
10
11
  ICMDContractUnavailableError,
12
+ ICMDMissingDependencyError,
13
+ ICMDModelMigrationError,
11
14
  ICMDRefreshNetworkError,
12
15
  ICMDRefreshRateLimitedError,
13
16
  ICMDRefreshResponseError,
14
17
  ICMDRefreshTokenInvalidError,
15
18
  ICMDRefreshUnavailableError,
19
+ ICMDReleaseRefusedError,
16
20
  ICMDRequestError,
21
+ ICMDResultsChangedError,
22
+ ICMDResultsRefusedError,
17
23
  ICMDTokenRefreshError,
18
24
  ICMDValidationError,
19
25
  )
@@ -83,14 +89,20 @@ __all__ = [
83
89
  "GridSampling",
84
90
  "GridVariable",
85
91
  "ICMDAuthenticationError",
92
+ "ICMDChecksumMismatchError",
86
93
  "ICMDConnectionError",
87
94
  "ICMDContractUnavailableError",
95
+ "ICMDMissingDependencyError",
96
+ "ICMDModelMigrationError",
88
97
  "ICMDRefreshNetworkError",
89
98
  "ICMDRefreshRateLimitedError",
90
99
  "ICMDRefreshResponseError",
91
100
  "ICMDRefreshTokenInvalidError",
92
101
  "ICMDRefreshUnavailableError",
102
+ "ICMDReleaseRefusedError",
93
103
  "ICMDRequestError",
104
+ "ICMDResultsChangedError",
105
+ "ICMDResultsRefusedError",
94
106
  "ICMDTokenRefreshError",
95
107
  "ICMDValidationError",
96
108
  "LatinHypercubeSampling",
icmd/_vendor/assembler.py CHANGED
@@ -23,7 +23,9 @@ __all__ = [
23
23
  "build_design_document",
24
24
  ]
25
25
 
26
- #: The scenario discriminator this assembler emits into ``qt_model_inputs``.
26
+ #: The scenario discriminator inside ``qt_model_inputs``. A catalog node
27
+ #: carries ``qt_model.scenario_key`` instead and the backend derives this from
28
+ #: it; a trained-model node, whose scenarios have no key, still carries it.
27
29
  #: Exported so consumers that must recognize it -- notably the advisory check,
28
30
  #: which excludes it from contract validation -- bind to this module rather than
29
31
  #: re-spelling the literal. Renaming it here must not leave a stale copy behind.
@@ -83,23 +85,29 @@ def assemble_model_inputs(inputs: Mapping[str, Any]) -> list[dict[str, Any]]:
83
85
 
84
86
 
85
87
  def assemble_model_node(
86
- name: str,
88
+ key: str,
87
89
  model_uuid: str,
88
90
  inputs: Mapping[str, Any],
89
- scenario: str | None = None,
91
+ scenario_key: str | None = None,
90
92
  node_id: str | None = None,
91
93
  ) -> dict[str, Any]:
92
94
  """Build one model workflow node without model lookup or validation.
93
95
 
94
- ``node_id`` identifies this workflow instance. The catalog ``model_uuid``
95
- remains in ``qt_model.uuid`` and is used only as the default node id.
96
+ The node is identified by ``qt_model.key`` and ``qt_model.scenario_key``.
97
+ The backend derives the ``__meta_scenario`` title from the scenario key, so
98
+ a discriminator in *inputs* is dropped when one is given rather than sent
99
+ as a second, possibly stale, answer. ``node_id`` identifies this workflow
100
+ instance. The catalog ``model_uuid`` remains in ``qt_model.uuid`` and is
101
+ used only as the default node id.
96
102
  """
97
103
  model_inputs = deepcopy(dict(inputs))
98
- if scenario is not None:
99
- model_inputs[SCENARIO_KEY] = {"title": scenario}
104
+ qt_model = {"key": key, "uuid": model_uuid}
105
+ if scenario_key is not None:
106
+ qt_model["scenario_key"] = scenario_key
107
+ model_inputs.pop(SCENARIO_KEY, None)
100
108
  return {
101
109
  "id": model_uuid if node_id is None else node_id,
102
- "qt_model": {"name": name, "uuid": model_uuid},
110
+ "qt_model": qt_model,
103
111
  "qt_model_inputs": assemble_model_inputs(model_inputs),
104
112
  }
105
113
 
icmd/apps/agent.py CHANGED
@@ -212,5 +212,16 @@ class AgentApp:
212
212
  return self._client.request_json("get", "agent/providers")
213
213
 
214
214
  def usage(self) -> dict | list[dict]:
215
- """Get the group's monthly Assist token usage (``GET agent/assist/usage``)."""
215
+ """Get the group's Assist credit balance (``GET agent/assist/usage``).
216
+
217
+ Group admins only.
218
+
219
+ Returns
220
+ -------
221
+ dict
222
+ ``granted``, ``used``, ``balance`` and ``month_used`` in credits,
223
+ and ``status`` (``"ok"`` / ``"low"`` / ``"out"``). ``balance``
224
+ can be negative. An unmetered group returns ``None`` for all five
225
+ keys, ``status`` included.
226
+ """
216
227
  return self._client.request_json("get", "agent/assist/usage")
icmd/apps/base.py CHANGED
@@ -274,7 +274,7 @@ class ReadOnlyResource:
274
274
  Parameters
275
275
  ----------
276
276
  name : str
277
- The action's ``url_path`` (e.g. ``"resubmit"``,
277
+ The action's ``url_path`` (e.g. ``"submit-draft"``,
278
278
  ``"queue-position"``, ``"save-calibration"``).
279
279
  uuid : str | None
280
280
  When given, the action is detail-scoped to this resource UUID.