iris-pex-embedded-python 4.0.1b4__py3-none-any.whl → 4.0.1b6__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.
- iop/production/component.py +16 -0
- iop/production/model.py +48 -0
- iop/production/types.py +10 -4
- {iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/METADATA +1 -1
- {iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/RECORD +9 -9
- {iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/WHEEL +0 -0
- {iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/entry_points.txt +0 -0
- {iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/licenses/LICENSE +0 -0
- {iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/top_level.txt +0 -0
iop/production/component.py
CHANGED
|
@@ -66,6 +66,13 @@ class ComponentRef:
|
|
|
66
66
|
return self.target_setting(name)
|
|
67
67
|
raise AttributeError(name)
|
|
68
68
|
|
|
69
|
+
def __dir__(self) -> list[str]:
|
|
70
|
+
names = set(super().__dir__())
|
|
71
|
+
if self.component_class is not None:
|
|
72
|
+
names.update(_target_setting_names(self.component_class))
|
|
73
|
+
names.update(self.target_setting_names)
|
|
74
|
+
return sorted(names)
|
|
75
|
+
|
|
69
76
|
def target_setting(self, name: str) -> TargetSettingRef:
|
|
70
77
|
self.target_setting_names.add(name)
|
|
71
78
|
return TargetSettingRef(
|
|
@@ -232,3 +239,12 @@ class ComponentRef:
|
|
|
232
239
|
item["Setting"] = settings
|
|
233
240
|
|
|
234
241
|
return item
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
def _target_setting_names(component_class: type) -> tuple[str, ...]:
|
|
245
|
+
names: dict[str, None] = {}
|
|
246
|
+
for base in reversed(component_class.__mro__):
|
|
247
|
+
for name, value in base.__dict__.items():
|
|
248
|
+
if isinstance(value, TargetSetting):
|
|
249
|
+
names[name] = None
|
|
250
|
+
return tuple(names)
|
iop/production/model.py
CHANGED
|
@@ -34,6 +34,7 @@ from .types import (
|
|
|
34
34
|
PersistentMessageRegistration,
|
|
35
35
|
ProductionDiff,
|
|
36
36
|
ProductionGraph,
|
|
37
|
+
TargetSetting,
|
|
37
38
|
TargetSettingRef,
|
|
38
39
|
_edge_identity,
|
|
39
40
|
)
|
|
@@ -1055,6 +1056,35 @@ class Production(_DeclarativeProductionMixin):
|
|
|
1055
1056
|
)
|
|
1056
1057
|
self._items.append(ref)
|
|
1057
1058
|
self._items_by_name[ref.name] = ref
|
|
1059
|
+
self._apply_target_defaults()
|
|
1060
|
+
|
|
1061
|
+
def _apply_target_defaults(self) -> None:
|
|
1062
|
+
for ref in self._items:
|
|
1063
|
+
for setting_name, target_name in self._target_default_routes(ref):
|
|
1064
|
+
if setting_name not in ref.host_settings:
|
|
1065
|
+
if setting_name in ref.target_setting_names:
|
|
1066
|
+
continue
|
|
1067
|
+
ref.host_settings[setting_name] = target_name
|
|
1068
|
+
ref.target_setting_names.add(setting_name)
|
|
1069
|
+
if str(ref.host_settings[setting_name]) != target_name:
|
|
1070
|
+
continue
|
|
1071
|
+
if target_name not in self._items_by_name:
|
|
1072
|
+
continue
|
|
1073
|
+
self._register_connection(
|
|
1074
|
+
ref.name,
|
|
1075
|
+
setting_name,
|
|
1076
|
+
target_name,
|
|
1077
|
+
)
|
|
1078
|
+
|
|
1079
|
+
def _target_default_routes(self, ref: ComponentRef) -> tuple[tuple[str, str], ...]:
|
|
1080
|
+
if ref.component_class is None:
|
|
1081
|
+
return ()
|
|
1082
|
+
routes: list[tuple[str, str]] = []
|
|
1083
|
+
for setting_name, descriptor in _target_settings(ref.component_class):
|
|
1084
|
+
target_name = _target_default_name(descriptor.default)
|
|
1085
|
+
if target_name:
|
|
1086
|
+
routes.append((setting_name, target_name))
|
|
1087
|
+
return tuple(routes)
|
|
1058
1088
|
|
|
1059
1089
|
def _diff_current(
|
|
1060
1090
|
self,
|
|
@@ -1141,3 +1171,21 @@ def _connection_mode(mode: str) -> str:
|
|
|
1141
1171
|
"Unsupported connection mode: "
|
|
1142
1172
|
f"{mode!r}. Expected 'replace', 'add', or 'remove'."
|
|
1143
1173
|
)
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
def _target_settings(
|
|
1177
|
+
component_class: type,
|
|
1178
|
+
) -> tuple[tuple[str, TargetSetting], ...]:
|
|
1179
|
+
descriptors: dict[str, TargetSetting] = {}
|
|
1180
|
+
for base in reversed(component_class.__mro__):
|
|
1181
|
+
for name, value in base.__dict__.items():
|
|
1182
|
+
if isinstance(value, TargetSetting):
|
|
1183
|
+
descriptors[name] = value
|
|
1184
|
+
return tuple(descriptors.items())
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
def _target_default_name(value: Any) -> str:
|
|
1188
|
+
if value is None:
|
|
1189
|
+
return ""
|
|
1190
|
+
name = getattr(value, "name", value)
|
|
1191
|
+
return str(name).strip()
|
iop/production/types.py
CHANGED
|
@@ -12,11 +12,11 @@ from ..components.settings import Category, Setting, controls
|
|
|
12
12
|
class TargetSetting(Setting):
|
|
13
13
|
"""Production target setting descriptor created by target()."""
|
|
14
14
|
|
|
15
|
-
def __init__(self, **kwargs: Any):
|
|
15
|
+
def __init__(self, default: Any = "", **kwargs: Any):
|
|
16
16
|
kwargs.setdefault("iris_type", "Ens.DataType.ConfigName")
|
|
17
17
|
kwargs.setdefault("category", Category.BASIC)
|
|
18
18
|
kwargs.setdefault("control", controls.production_item())
|
|
19
|
-
super().__init__(
|
|
19
|
+
super().__init__(default, **kwargs)
|
|
20
20
|
|
|
21
21
|
@overload
|
|
22
22
|
def __get__(self, instance: None, owner: type | None = None) -> TargetSetting: ...
|
|
@@ -34,13 +34,16 @@ class TargetSetting(Setting):
|
|
|
34
34
|
return super().__get__(instance, owner)
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
def target(**kwargs: Any) -> TargetSetting:
|
|
37
|
+
def target(default: Any = "", **kwargs: Any) -> TargetSetting:
|
|
38
38
|
"""Purpose:
|
|
39
39
|
Declare a configurable outbound target setting on a component class.
|
|
40
40
|
|
|
41
41
|
Use when:
|
|
42
42
|
A service or process sends messages to another production component.
|
|
43
43
|
|
|
44
|
+
Pass a target item name as the first argument when the route should have
|
|
45
|
+
a default target even without an explicit Production.connect(...) call.
|
|
46
|
+
|
|
44
47
|
Lifecycle:
|
|
45
48
|
The descriptor becomes an IRIS production setting. Production.connect(...)
|
|
46
49
|
binds it to a concrete target component.
|
|
@@ -59,11 +62,14 @@ def target(**kwargs: Any) -> TargetSetting:
|
|
|
59
62
|
|
|
60
63
|
prod.connect(router.Output, operation)
|
|
61
64
|
|
|
65
|
+
class DefaultRouter(BusinessProcess):
|
|
66
|
+
Output = target("DefaultOperation")
|
|
67
|
+
|
|
62
68
|
Related:
|
|
63
69
|
docs/cookbooks/production-settings-and-targets.md,
|
|
64
70
|
docs/production-graph.md
|
|
65
71
|
"""
|
|
66
|
-
return TargetSetting(**kwargs)
|
|
72
|
+
return TargetSetting(default, **kwargs)
|
|
67
73
|
|
|
68
74
|
|
|
69
75
|
@dataclass
|
{iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/RECORD
RENAMED
|
@@ -65,19 +65,19 @@ iop/migration/utils.py,sha256=pOojLPMZes05KXrGN2ap45ffppP5Z4tS4bjJ0gSD5Oc,38183
|
|
|
65
65
|
iop/production/__init__.py,sha256=95VmJgC3lWtHpUJijLqyKKxFZa65OcRni8803kb4aHE,2148
|
|
66
66
|
iop/production/actions.py,sha256=TLVAjPTPq21oLj9c-IG10qMNJ2hvPzueviMy_c1a0ZU,17199
|
|
67
67
|
iop/production/common.py,sha256=IoUg9jkFzSQwDsHcXvkVAC4qxpWKs3kTfXFm_EP07EU,3091
|
|
68
|
-
iop/production/component.py,sha256=
|
|
68
|
+
iop/production/component.py,sha256=3a4z9rtr5DjFVejbY_7gYUCOIfWucrfDbWU19d8a738,8442
|
|
69
69
|
iop/production/declarations.py,sha256=Tb79Q6rwmFMi6xKpzajJa4Aa2_Tk3sD-e8qiuRJX77s,5821
|
|
70
70
|
iop/production/declarative.py,sha256=IpHYO46mu7k9wnq3DpFreoALPoX1Vi8DrJb-85O_-bQ,7853
|
|
71
71
|
iop/production/diff.py,sha256=NYpcSVklaGpaZOyl933W8eLsDWcwjlf6Upbp4pVGSMU,9975
|
|
72
72
|
iop/production/import_.py,sha256=twBra6j2peolFadv8WyDwZZOd9NznzAkPsk2RbOfZQM,10833
|
|
73
73
|
iop/production/inspection.py,sha256=PPv9DiDS4OrnKROqV7JPbuY8Y0JR-m8syPhap3GgE4g,3363
|
|
74
|
-
iop/production/model.py,sha256=
|
|
74
|
+
iop/production/model.py,sha256=RCss8i6jnpP-sNv0eLCwpxU2y2uOaLKJ5qeP4mlwwuQ,43533
|
|
75
75
|
iop/production/planning.py,sha256=nCYrXLKlHBlUaQZPzPfqtIERIv62F2sg4gJ0b8mtcKk,23375
|
|
76
76
|
iop/production/reconstruction.py,sha256=5vVteTEM6IOiQUfpe4AUQg6Nt4oaaIDR61-1l6Vu8hk,12532
|
|
77
77
|
iop/production/rendering.py,sha256=UVHLICY4zWEP3W7-99TpB2WeLBNREC2N8rYSnBa_iZM,20240
|
|
78
78
|
iop/production/runtime.py,sha256=6grX1u20OhHnvhzC3yPDTFEoDs_TN4mfs5MxzFzZMls,2637
|
|
79
79
|
iop/production/source_inference.py,sha256=Wl3E9-1hWb4qxD1jwrrZTLSgqN-0vGhOrJtmzDWPCao,21613
|
|
80
|
-
iop/production/types.py,sha256=
|
|
80
|
+
iop/production/types.py,sha256=B5tSmRAwFBoFPxp7oVPmfMW9sxHaeBtonAfv6C06W1g,16889
|
|
81
81
|
iop/production/validation.py,sha256=14BfjrLXW1AOuP8AdBrs-CY6zynaDc8_AUD9frsYAIU,13753
|
|
82
82
|
iop/runtime/__init__.py,sha256=wcyWMRuPCYE_CLd1NmgmI1M-IbFs2Gz2yIj2-EW_2AA,70
|
|
83
83
|
iop/runtime/director.py,sha256=KW8BvkATK8XuIUPNBD9rMww9r3Zg4K3H54868eOgvl0,12867
|
|
@@ -91,9 +91,9 @@ iop/runtime/remote/director.py,sha256=bkie751GrYLgGs7ApRCowHpSnJA8KupxCOrFDQmjyO
|
|
|
91
91
|
iop/runtime/remote/migration.py,sha256=Iboz-Ye7i9xif9bn433GazCF-gtD-HJW3wiUwWS5P6w,1831
|
|
92
92
|
iop/runtime/remote/settings.py,sha256=P1Hsgld5o57HpSZgPVZzobyjlUmxJj6bstiWvR0JXnc,2144
|
|
93
93
|
iop/runtime/remote/setup.py,sha256=Tr80F3JJTy7oSUso2jyx0iA_KZayd4MYt9vL0BvPpMA,2600
|
|
94
|
-
iris_pex_embedded_python-4.0.
|
|
95
|
-
iris_pex_embedded_python-4.0.
|
|
96
|
-
iris_pex_embedded_python-4.0.
|
|
97
|
-
iris_pex_embedded_python-4.0.
|
|
98
|
-
iris_pex_embedded_python-4.0.
|
|
99
|
-
iris_pex_embedded_python-4.0.
|
|
94
|
+
iris_pex_embedded_python-4.0.1b6.dist-info/licenses/LICENSE,sha256=rZSiBFId_sfbJ6RL0GjjPX-InNLkNS9ou7eQsikciI8,1089
|
|
95
|
+
iris_pex_embedded_python-4.0.1b6.dist-info/METADATA,sha256=BGtIyGv7zT0llTUrwEHAHc27J-sruyQcOxnWrw812aI,5846
|
|
96
|
+
iris_pex_embedded_python-4.0.1b6.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
97
|
+
iris_pex_embedded_python-4.0.1b6.dist-info/entry_points.txt,sha256=fzS8ZFsPe8cnpEx208X60DNugCPQmuSloPeg4pyyJDY,42
|
|
98
|
+
iris_pex_embedded_python-4.0.1b6.dist-info/top_level.txt,sha256=BM54-OXQ6l2BDtmesWNXckh033s9gcjoO7bfjbwZbxU,4
|
|
99
|
+
iris_pex_embedded_python-4.0.1b6.dist-info/RECORD,,
|
{iris_pex_embedded_python-4.0.1b4.dist-info → iris_pex_embedded_python-4.0.1b6.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|