ansys-fluent-core 0.29.dev0__py3-none-any.whl → 0.29.dev2__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 ansys-fluent-core might be problematic. Click here for more details.
- ansys/fluent/core/__init__.py +1 -1
- ansys/fluent/core/_version.py +2 -2
- ansys/fluent/core/codegen/tuigen.py +1 -1
- ansys/fluent/core/codegen/walk_api.py +45 -18
- ansys/fluent/core/generated/api_tree/api_objects.json +1 -1
- ansys/fluent/core/generated/datamodel_252/meshing.py +1 -0
- ansys/fluent/core/generated/datamodel_252/preferences.py +7 -0
- ansys/fluent/core/generated/fluent_version_252.py +3 -3
- ansys/fluent/core/generated/meshing/tui_252.py +395 -390
- ansys/fluent/core/generated/solver/settings_252.py +782 -306
- ansys/fluent/core/generated/solver/settings_252.pyi +442 -133
- ansys/fluent/core/generated/solver/tui_252.py +4046 -3737
- ansys/fluent/core/launcher/container_launcher.py +4 -3
- ansys/fluent/core/launcher/fluent_container.py +22 -19
- ansys/fluent/core/launcher/launcher.py +2 -2
- ansys/fluent/core/launcher/pim_launcher.py +2 -2
- ansys/fluent/core/launcher/slurm_launcher.py +2 -2
- ansys/fluent/core/launcher/standalone_launcher.py +2 -2
- ansys/fluent/core/logging.py +2 -0
- ansys/fluent/core/logging_config.yaml +3 -0
- ansys/fluent/core/services/app_utilities.py +2 -1
- ansys/fluent/core/services/datamodel_se.py +141 -61
- ansys/fluent/core/services/field_data.py +252 -0
- ansys/fluent/core/services/interceptors.py +28 -2
- ansys/fluent/core/session.py +7 -2
- ansys/fluent/core/session_solver.py +21 -0
- ansys/fluent/core/streaming_services/datamodel_event_streaming.py +12 -12
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/LICENSE +1 -1
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/METADATA +53 -31
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/RECORD +65 -141
- {ansys_fluent_core-0.29.dev0.dist-info → ansys_fluent_core-0.29.dev2.dist-info}/WHEEL +1 -1
- ansys/fluent/core/docs/README.rst +0 -155
- ansys/fluent/tests/conftest.py +0 -415
- ansys/fluent/tests/fluent_fixtures.py +0 -195
- ansys/fluent/tests/integration/test_optislang/test_optislang_integration.py +0 -263
- ansys/fluent/tests/parametric/test_local_parametric_run.py +0 -36
- ansys/fluent/tests/parametric/test_local_parametric_setup.py +0 -34
- ansys/fluent/tests/parametric/test_parametric_workflow.py +0 -279
- ansys/fluent/tests/test_aero_session.py +0 -88
- ansys/fluent/tests/test_batch_ops.py +0 -39
- ansys/fluent/tests/test_builtin_settings.py +0 -761
- ansys/fluent/tests/test_cad_to_post_ftm.py +0 -525
- ansys/fluent/tests/test_cad_to_post_wtm.py +0 -250
- ansys/fluent/tests/test_casereader.py +0 -324
- ansys/fluent/tests/test_codegen.py +0 -783
- ansys/fluent/tests/test_creatable.py +0 -31
- ansys/fluent/tests/test_data_model_cache.py +0 -434
- ansys/fluent/tests/test_datamodel_api.py +0 -449
- ansys/fluent/tests/test_datamodel_service.py +0 -814
- ansys/fluent/tests/test_datareader.py +0 -103
- ansys/fluent/tests/test_error_handling.py +0 -24
- ansys/fluent/tests/test_events_manager.py +0 -214
- ansys/fluent/tests/test_field_data.py +0 -466
- ansys/fluent/tests/test_file_session.py +0 -355
- ansys/fluent/tests/test_file_transfer_service.py +0 -165
- ansys/fluent/tests/test_fix_doc.py +0 -29
- ansys/fluent/tests/test_flobject.py +0 -1235
- ansys/fluent/tests/test_fluent_fixes.py +0 -106
- ansys/fluent/tests/test_fluent_session.py +0 -270
- ansys/fluent/tests/test_fluent_version.py +0 -66
- ansys/fluent/tests/test_fluent_version_marker.py +0 -65
- ansys/fluent/tests/test_icing_session.py +0 -9
- ansys/fluent/tests/test_launcher.py +0 -529
- ansys/fluent/tests/test_launcher_remote.py +0 -272
- ansys/fluent/tests/test_lispy.py +0 -40
- ansys/fluent/tests/test_logging.py +0 -16
- ansys/fluent/tests/test_mapped_api.py +0 -774
- ansys/fluent/tests/test_meshing_utilities.py +0 -2436
- ansys/fluent/tests/test_meshing_workflow.py +0 -421
- ansys/fluent/tests/test_meshingmode/test_meshing_launch.py +0 -168
- ansys/fluent/tests/test_new_meshing_workflow.py +0 -1801
- ansys/fluent/tests/test_preferences.py +0 -89
- ansys/fluent/tests/test_pure_mesh_vs_mesh_workflow.py +0 -101
- ansys/fluent/tests/test_reduction.py +0 -484
- ansys/fluent/tests/test_rp_vars.py +0 -77
- ansys/fluent/tests/test_scheduler.py +0 -471
- ansys/fluent/tests/test_scheme_eval_222.py +0 -338
- ansys/fluent/tests/test_scheme_eval_231.py +0 -243
- ansys/fluent/tests/test_search.py +0 -344
- ansys/fluent/tests/test_session.py +0 -594
- ansys/fluent/tests/test_settings_api.py +0 -606
- ansys/fluent/tests/test_settings_reader.py +0 -85
- ansys/fluent/tests/test_slurm_future.py +0 -67
- ansys/fluent/tests/test_solution_variables.py +0 -241
- ansys/fluent/tests/test_solver_monitors.py +0 -83
- ansys/fluent/tests/test_solvermode/boundaries_periodic_expDict +0 -1712
- ansys/fluent/tests/test_solvermode/test_boundaries.py +0 -127
- ansys/fluent/tests/test_solvermode/test_calculationactivities.py +0 -20
- ansys/fluent/tests/test_solvermode/test_controls.py +0 -131
- ansys/fluent/tests/test_solvermode/test_general.py +0 -109
- ansys/fluent/tests/test_solvermode/test_initialization.py +0 -83
- ansys/fluent/tests/test_solvermode/test_materials.py +0 -40
- ansys/fluent/tests/test_solvermode/test_methods.py +0 -65
- ansys/fluent/tests/test_solvermode/test_models.py +0 -99
- ansys/fluent/tests/test_solvermode/test_named_expressions.py +0 -35
- ansys/fluent/tests/test_solvermode/test_post_vector.py +0 -22
- ansys/fluent/tests/test_solvermode/test_species_model.py +0 -67
- ansys/fluent/tests/test_streaming_services.py +0 -52
- ansys/fluent/tests/test_systemcoupling.py +0 -44
- ansys/fluent/tests/test_topy.py +0 -179
- ansys/fluent/tests/test_tui_api.py +0 -70
- ansys/fluent/tests/test_type_stub.py +0 -37
- ansys/fluent/tests/test_utils.py +0 -82
- ansys/fluent/tests/util/__init__.py +0 -36
- ansys/fluent/tests/util/meshing_workflow.py +0 -33
- ansys/fluent/tests/util/solver.py +0 -72
- ansys_fluent_core-0.29.dev0.dist-info/AUTHORS +0 -12
|
@@ -6,7 +6,7 @@ import itertools
|
|
|
6
6
|
import logging
|
|
7
7
|
import os
|
|
8
8
|
from threading import RLock
|
|
9
|
-
from typing import Any, Callable, Iterator, NoReturn, Sequence
|
|
9
|
+
from typing import Any, Callable, Iterator, NoReturn, Sequence, TypeVar
|
|
10
10
|
|
|
11
11
|
from google.protobuf.json_format import MessageToDict, ParseDict
|
|
12
12
|
import grpc
|
|
@@ -28,7 +28,8 @@ from ansys.fluent.core.solver.error_message import allowed_name_error_message
|
|
|
28
28
|
from ansys.fluent.core.utils.fluent_version import FluentVersion
|
|
29
29
|
|
|
30
30
|
Path = list[tuple[str, str]]
|
|
31
|
-
|
|
31
|
+
PyMenuT = TypeVar("PyMenuT", bound="PyMenu")
|
|
32
|
+
ValueT = None | bool | int | float | str | Sequence["ValueT"] | dict[str, "ValueT"]
|
|
32
33
|
logger: logging.Logger = logging.getLogger("pyfluent.datamodel")
|
|
33
34
|
|
|
34
35
|
member_specs_oneof_fields = [
|
|
@@ -175,6 +176,8 @@ class DatamodelServiceImpl:
|
|
|
175
176
|
self._stub = DataModelGrpcModule.DataModelStub(intercept_channel)
|
|
176
177
|
self._metadata = metadata
|
|
177
178
|
self.file_transfer_service = file_transfer_service
|
|
179
|
+
if os.getenv("REMOTING_MAPPED_NEW_DM_API") == "1":
|
|
180
|
+
self._metadata.append(("mapped", "1"))
|
|
178
181
|
|
|
179
182
|
# TODO: Remove it from the proto interface
|
|
180
183
|
def initialize_datamodel(
|
|
@@ -301,7 +304,7 @@ class DatamodelServiceImpl:
|
|
|
301
304
|
return self._stub.unsubscribeEvents(request, metadata=self._metadata)
|
|
302
305
|
|
|
303
306
|
|
|
304
|
-
def _convert_value_to_variant(val:
|
|
307
|
+
def _convert_value_to_variant(val: ValueT, var: Variant) -> None:
|
|
305
308
|
"""Convert a Python data type to Fluent's variant type."""
|
|
306
309
|
if isinstance(val, bool):
|
|
307
310
|
var.bool_state = val
|
|
@@ -322,7 +325,7 @@ def _convert_value_to_variant(val: _TValue, var: Variant) -> None:
|
|
|
322
325
|
_convert_value_to_variant(v, var.variant_map_state.item[k])
|
|
323
326
|
|
|
324
327
|
|
|
325
|
-
def _convert_variant_to_value(var: Variant) ->
|
|
328
|
+
def _convert_variant_to_value(var: Variant) -> ValueT:
|
|
326
329
|
"""Convert Fluent's variant type to a Python data type."""
|
|
327
330
|
if var.HasField("bool_state"):
|
|
328
331
|
return var.bool_state
|
|
@@ -495,7 +498,7 @@ class DatamodelService(StreamingService):
|
|
|
495
498
|
self.cache = DataModelCache() if pyfluent.DATAMODEL_USE_STATE_CACHE else None
|
|
496
499
|
self.version = version
|
|
497
500
|
|
|
498
|
-
def get_attribute_value(self, rules: str, path: str, attribute: str) ->
|
|
501
|
+
def get_attribute_value(self, rules: str, path: str, attribute: str) -> ValueT:
|
|
499
502
|
"""Get attribute value."""
|
|
500
503
|
request = DataModelProtoModule.GetAttributeValueRequest(
|
|
501
504
|
rules=rules, path=path, attribute=attribute
|
|
@@ -503,7 +506,7 @@ class DatamodelService(StreamingService):
|
|
|
503
506
|
response = self._impl.get_attribute_value(request)
|
|
504
507
|
return _convert_variant_to_value(response.result)
|
|
505
508
|
|
|
506
|
-
def get_state(self, rules: str, path: str) ->
|
|
509
|
+
def get_state(self, rules: str, path: str) -> ValueT:
|
|
507
510
|
"""Get state."""
|
|
508
511
|
request = DataModelProtoModule.GetStateRequest(rules=rules, path=path)
|
|
509
512
|
response = self._impl.get_state(request)
|
|
@@ -568,7 +571,7 @@ class DatamodelService(StreamingService):
|
|
|
568
571
|
version=self.version,
|
|
569
572
|
)
|
|
570
573
|
|
|
571
|
-
def set_state(self, rules: str, path: str, state:
|
|
574
|
+
def set_state(self, rules: str, path: str, state: ValueT) -> None:
|
|
572
575
|
"""Set state."""
|
|
573
576
|
request = DataModelProtoModule.SetStateRequest(
|
|
574
577
|
rules=rules, path=path, wait=True
|
|
@@ -601,7 +604,7 @@ class DatamodelService(StreamingService):
|
|
|
601
604
|
self,
|
|
602
605
|
rules: str,
|
|
603
606
|
path: str,
|
|
604
|
-
dict_state: dict[str,
|
|
607
|
+
dict_state: dict[str, ValueT],
|
|
605
608
|
recursive=False,
|
|
606
609
|
) -> None:
|
|
607
610
|
"""Update the dict."""
|
|
@@ -633,8 +636,8 @@ class DatamodelService(StreamingService):
|
|
|
633
636
|
)
|
|
634
637
|
|
|
635
638
|
def execute_command(
|
|
636
|
-
self, rules: str, path: str, command: str, args: dict[str,
|
|
637
|
-
) ->
|
|
639
|
+
self, rules: str, path: str, command: str, args: dict[str, ValueT]
|
|
640
|
+
) -> ValueT:
|
|
638
641
|
"""Execute the command."""
|
|
639
642
|
request = DataModelProtoModule.ExecuteCommandRequest(
|
|
640
643
|
rules=rules, path=path, command=command, wait=True
|
|
@@ -651,8 +654,8 @@ class DatamodelService(StreamingService):
|
|
|
651
654
|
return _convert_variant_to_value(response.result)
|
|
652
655
|
|
|
653
656
|
def execute_query(
|
|
654
|
-
self, rules: str, path: str, query: str, args: dict[str,
|
|
655
|
-
) ->
|
|
657
|
+
self, rules: str, path: str, query: str, args: dict[str, ValueT]
|
|
658
|
+
) -> ValueT:
|
|
656
659
|
"""Execute the query."""
|
|
657
660
|
request = DataModelProtoModule.ExecuteQueryRequest(
|
|
658
661
|
rules=rules, path=path, query=query
|
|
@@ -722,7 +725,7 @@ class DatamodelService(StreamingService):
|
|
|
722
725
|
self.subscriptions.unsubscribe_all()
|
|
723
726
|
|
|
724
727
|
def add_on_child_created(
|
|
725
|
-
self, rules: str, path: str, child_type: str,
|
|
728
|
+
self, rules: str, path: str, child_type: str, cb: Callable[[str], None]
|
|
726
729
|
) -> EventSubscription:
|
|
727
730
|
"""Add on child created."""
|
|
728
731
|
request_dict = {
|
|
@@ -737,11 +740,18 @@ class DatamodelService(StreamingService):
|
|
|
737
740
|
]
|
|
738
741
|
}
|
|
739
742
|
subscription = EventSubscription(self, path, request_dict)
|
|
740
|
-
|
|
743
|
+
|
|
744
|
+
def cb_grpc(child_type: str, child_name: str):
|
|
745
|
+
ppath = convert_se_path_to_path(path)
|
|
746
|
+
ppath.append((child_type, child_name))
|
|
747
|
+
child_path = convert_path_to_se_path(ppath)
|
|
748
|
+
cb(child_path)
|
|
749
|
+
|
|
750
|
+
self.event_streaming.register_callback(subscription.tag, cb_grpc)
|
|
741
751
|
return subscription
|
|
742
752
|
|
|
743
753
|
def add_on_deleted(
|
|
744
|
-
self, rules: str, path: str,
|
|
754
|
+
self, rules: str, path: str, cb: Callable[[], None]
|
|
745
755
|
) -> EventSubscription:
|
|
746
756
|
"""Add on deleted."""
|
|
747
757
|
request_dict = {
|
|
@@ -753,11 +763,11 @@ class DatamodelService(StreamingService):
|
|
|
753
763
|
]
|
|
754
764
|
}
|
|
755
765
|
subscription = EventSubscription(self, path, request_dict)
|
|
756
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
766
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
757
767
|
return subscription
|
|
758
768
|
|
|
759
769
|
def add_on_changed(
|
|
760
|
-
self, rules: str, path: str,
|
|
770
|
+
self, rules: str, path: str, cb: Callable[[ValueT], None]
|
|
761
771
|
) -> EventSubscription:
|
|
762
772
|
"""Add on changed."""
|
|
763
773
|
request_dict = {
|
|
@@ -769,11 +779,11 @@ class DatamodelService(StreamingService):
|
|
|
769
779
|
]
|
|
770
780
|
}
|
|
771
781
|
subscription = EventSubscription(self, path, request_dict)
|
|
772
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
782
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
773
783
|
return subscription
|
|
774
784
|
|
|
775
785
|
def add_on_affected(
|
|
776
|
-
self, rules: str, path: str,
|
|
786
|
+
self, rules: str, path: str, cb: Callable[[], None]
|
|
777
787
|
) -> EventSubscription:
|
|
778
788
|
"""Add on affected."""
|
|
779
789
|
request_dict = {
|
|
@@ -785,11 +795,11 @@ class DatamodelService(StreamingService):
|
|
|
785
795
|
]
|
|
786
796
|
}
|
|
787
797
|
subscription = EventSubscription(self, path, request_dict)
|
|
788
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
798
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
789
799
|
return subscription
|
|
790
800
|
|
|
791
801
|
def add_on_affected_at_type_path(
|
|
792
|
-
self, rules: str, path: str, child_type: str,
|
|
802
|
+
self, rules: str, path: str, child_type: str, cb: Callable[[], None]
|
|
793
803
|
) -> EventSubscription:
|
|
794
804
|
"""Add on affected at type path."""
|
|
795
805
|
request_dict = {
|
|
@@ -804,11 +814,16 @@ class DatamodelService(StreamingService):
|
|
|
804
814
|
]
|
|
805
815
|
}
|
|
806
816
|
subscription = EventSubscription(self, path, request_dict)
|
|
807
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
817
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
808
818
|
return subscription
|
|
809
819
|
|
|
810
820
|
def add_on_command_executed_old(
|
|
811
|
-
self,
|
|
821
|
+
self,
|
|
822
|
+
rules: str,
|
|
823
|
+
path: str,
|
|
824
|
+
command: str,
|
|
825
|
+
obj,
|
|
826
|
+
cb: Callable[[str, ValueT], None],
|
|
812
827
|
) -> EventSubscription:
|
|
813
828
|
"""Add on command executed."""
|
|
814
829
|
request_dict = {
|
|
@@ -823,11 +838,11 @@ class DatamodelService(StreamingService):
|
|
|
823
838
|
]
|
|
824
839
|
}
|
|
825
840
|
subscription = EventSubscription(self, path, request_dict)
|
|
826
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
841
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
827
842
|
return subscription
|
|
828
843
|
|
|
829
844
|
def add_on_command_executed(
|
|
830
|
-
self, rules: str, path: str,
|
|
845
|
+
self, rules: str, path: str, cb: Callable[[str, ValueT], None]
|
|
831
846
|
) -> EventSubscription:
|
|
832
847
|
"""Add on command executed."""
|
|
833
848
|
request_dict = {
|
|
@@ -841,11 +856,11 @@ class DatamodelService(StreamingService):
|
|
|
841
856
|
]
|
|
842
857
|
}
|
|
843
858
|
subscription = EventSubscription(self, path, request_dict)
|
|
844
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
859
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
845
860
|
return subscription
|
|
846
861
|
|
|
847
862
|
def add_on_attribute_changed(
|
|
848
|
-
self, rules: str, path: str, attribute: str,
|
|
863
|
+
self, rules: str, path: str, attribute: str, cb: Callable[[ValueT], None]
|
|
849
864
|
) -> EventSubscription:
|
|
850
865
|
"""Add on attribute changed."""
|
|
851
866
|
request_dict = {
|
|
@@ -860,11 +875,16 @@ class DatamodelService(StreamingService):
|
|
|
860
875
|
]
|
|
861
876
|
}
|
|
862
877
|
subscription = EventSubscription(self, path, request_dict)
|
|
863
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
878
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
864
879
|
return subscription
|
|
865
880
|
|
|
866
881
|
def add_on_command_attribute_changed(
|
|
867
|
-
self,
|
|
882
|
+
self,
|
|
883
|
+
rules: str,
|
|
884
|
+
path: str,
|
|
885
|
+
command: str,
|
|
886
|
+
attribute: str,
|
|
887
|
+
cb: Callable[[ValueT], None],
|
|
868
888
|
) -> EventSubscription:
|
|
869
889
|
"""Add on command attribute changed."""
|
|
870
890
|
request_dict = {
|
|
@@ -880,7 +900,7 @@ class DatamodelService(StreamingService):
|
|
|
880
900
|
]
|
|
881
901
|
}
|
|
882
902
|
subscription = EventSubscription(self, path, request_dict)
|
|
883
|
-
self.event_streaming.register_callback(subscription.tag,
|
|
903
|
+
self.event_streaming.register_callback(subscription.tag, cb)
|
|
884
904
|
return subscription
|
|
885
905
|
|
|
886
906
|
|
|
@@ -905,6 +925,30 @@ def convert_path_to_se_path(path: Path) -> str:
|
|
|
905
925
|
return se_path
|
|
906
926
|
|
|
907
927
|
|
|
928
|
+
def convert_se_path_to_path(se_path: str) -> Path:
|
|
929
|
+
"""Convert a StateEngine path to a path structure.
|
|
930
|
+
|
|
931
|
+
Parameters
|
|
932
|
+
----------
|
|
933
|
+
se_path : str
|
|
934
|
+
StateEngine path.
|
|
935
|
+
|
|
936
|
+
Returns
|
|
937
|
+
-------
|
|
938
|
+
Path
|
|
939
|
+
path structure
|
|
940
|
+
"""
|
|
941
|
+
path = []
|
|
942
|
+
for comp in se_path.split("/"):
|
|
943
|
+
if comp:
|
|
944
|
+
if ":" in comp:
|
|
945
|
+
name, value = comp.split(":")
|
|
946
|
+
else:
|
|
947
|
+
name, value = comp, ""
|
|
948
|
+
path.append((name, value))
|
|
949
|
+
return path
|
|
950
|
+
|
|
951
|
+
|
|
908
952
|
class PyCallableStateObject:
|
|
909
953
|
"""Any object which can be called to get its state.
|
|
910
954
|
|
|
@@ -1066,7 +1110,7 @@ class PyStateContainer(PyCallableStateObject):
|
|
|
1066
1110
|
return self.get_state()
|
|
1067
1111
|
|
|
1068
1112
|
def add_on_attribute_changed(
|
|
1069
|
-
self, attribute: str, cb: Callable
|
|
1113
|
+
self, attribute: str, cb: Callable[[ValueT], None]
|
|
1070
1114
|
) -> EventSubscription:
|
|
1071
1115
|
"""Register a callback for when an attribute is changed.
|
|
1072
1116
|
|
|
@@ -1074,7 +1118,7 @@ class PyStateContainer(PyCallableStateObject):
|
|
|
1074
1118
|
----------
|
|
1075
1119
|
attribute : str
|
|
1076
1120
|
attribute name
|
|
1077
|
-
cb : Callable
|
|
1121
|
+
cb : Callable[[ValueT], None]
|
|
1078
1122
|
Callback function
|
|
1079
1123
|
|
|
1080
1124
|
Returns
|
|
@@ -1083,11 +1127,11 @@ class PyStateContainer(PyCallableStateObject):
|
|
|
1083
1127
|
EventSubscription instance which can be used to unregister the callback
|
|
1084
1128
|
"""
|
|
1085
1129
|
return self.service.add_on_attribute_changed(
|
|
1086
|
-
self.rules, convert_path_to_se_path(self.path), attribute,
|
|
1130
|
+
self.rules, convert_path_to_se_path(self.path), attribute, cb
|
|
1087
1131
|
)
|
|
1088
1132
|
|
|
1089
1133
|
def add_on_command_attribute_changed(
|
|
1090
|
-
self, command: str, attribute: str, cb: Callable
|
|
1134
|
+
self, command: str, attribute: str, cb: Callable[[ValueT], None]
|
|
1091
1135
|
) -> EventSubscription:
|
|
1092
1136
|
"""Register a callback for when an attribute is changed.
|
|
1093
1137
|
|
|
@@ -1097,7 +1141,7 @@ class PyStateContainer(PyCallableStateObject):
|
|
|
1097
1141
|
command name
|
|
1098
1142
|
attribute : str
|
|
1099
1143
|
attribute name
|
|
1100
|
-
cb : Callable
|
|
1144
|
+
cb : Callable[[ValueT], None]
|
|
1101
1145
|
Callback function
|
|
1102
1146
|
|
|
1103
1147
|
Returns
|
|
@@ -1106,7 +1150,7 @@ class PyStateContainer(PyCallableStateObject):
|
|
|
1106
1150
|
EventSubscription instance which can be used to unregister the callback
|
|
1107
1151
|
"""
|
|
1108
1152
|
return self.service.add_on_command_attribute_changed(
|
|
1109
|
-
self.rules, convert_path_to_se_path(self.path), command, attribute,
|
|
1153
|
+
self.rules, convert_path_to_se_path(self.path), command, attribute, cb
|
|
1110
1154
|
)
|
|
1111
1155
|
|
|
1112
1156
|
def __dir__(self):
|
|
@@ -1253,14 +1297,16 @@ class PyMenu(PyStateContainer):
|
|
|
1253
1297
|
self.rules, convert_path_to_se_path(self.path), command
|
|
1254
1298
|
)
|
|
1255
1299
|
|
|
1256
|
-
def add_on_child_created(
|
|
1300
|
+
def add_on_child_created(
|
|
1301
|
+
self, child_type: str, cb: Callable[[PyMenuT], None]
|
|
1302
|
+
) -> EventSubscription:
|
|
1257
1303
|
"""Register a callback for when a child object is created.
|
|
1258
1304
|
|
|
1259
1305
|
Parameters
|
|
1260
1306
|
----------
|
|
1261
1307
|
child_type : str
|
|
1262
1308
|
Type of the child object
|
|
1263
|
-
cb : Callable
|
|
1309
|
+
cb : Callable[[PyMenuT], None]
|
|
1264
1310
|
Callback function
|
|
1265
1311
|
|
|
1266
1312
|
Returns
|
|
@@ -1268,16 +1314,23 @@ class PyMenu(PyStateContainer):
|
|
|
1268
1314
|
EventSubscription
|
|
1269
1315
|
EventSubscription instance which can be used to unregister the callback
|
|
1270
1316
|
"""
|
|
1317
|
+
|
|
1318
|
+
def cb_service(child_path: str):
|
|
1319
|
+
child_path = convert_se_path_to_path(child_path)
|
|
1320
|
+
child_type, child_name = child_path[-1]
|
|
1321
|
+
child = getattr(self, child_type)[child_name]
|
|
1322
|
+
cb(child)
|
|
1323
|
+
|
|
1271
1324
|
return self.service.add_on_child_created(
|
|
1272
|
-
self.rules, convert_path_to_se_path(self.path), child_type,
|
|
1325
|
+
self.rules, convert_path_to_se_path(self.path), child_type, cb_service
|
|
1273
1326
|
)
|
|
1274
1327
|
|
|
1275
|
-
def add_on_deleted(self, cb: Callable) -> EventSubscription:
|
|
1328
|
+
def add_on_deleted(self, cb: Callable[[], None]) -> EventSubscription:
|
|
1276
1329
|
"""Register a callback for when the object is deleted.
|
|
1277
1330
|
|
|
1278
1331
|
Parameters
|
|
1279
1332
|
----------
|
|
1280
|
-
cb : Callable
|
|
1333
|
+
cb : Callable[[], None]
|
|
1281
1334
|
Callback function
|
|
1282
1335
|
|
|
1283
1336
|
Returns
|
|
@@ -1286,15 +1339,15 @@ class PyMenu(PyStateContainer):
|
|
|
1286
1339
|
EventSubscription instance which can be used to unregister the callback
|
|
1287
1340
|
"""
|
|
1288
1341
|
return self.service.add_on_deleted(
|
|
1289
|
-
self.rules, convert_path_to_se_path(self.path),
|
|
1342
|
+
self.rules, convert_path_to_se_path(self.path), cb
|
|
1290
1343
|
)
|
|
1291
1344
|
|
|
1292
|
-
def add_on_changed(self, cb: Callable) -> EventSubscription:
|
|
1345
|
+
def add_on_changed(self, cb: Callable[[PyMenuT], None]) -> EventSubscription:
|
|
1293
1346
|
"""Register a callback for when the object is modified.
|
|
1294
1347
|
|
|
1295
1348
|
Parameters
|
|
1296
1349
|
----------
|
|
1297
|
-
cb : Callable
|
|
1350
|
+
cb : Callable[[PyMenuT], None]
|
|
1298
1351
|
Callback function
|
|
1299
1352
|
|
|
1300
1353
|
Returns
|
|
@@ -1302,16 +1355,20 @@ class PyMenu(PyStateContainer):
|
|
|
1302
1355
|
EventSubscription
|
|
1303
1356
|
EventSubscription instance which can be used to unregister the callback
|
|
1304
1357
|
"""
|
|
1358
|
+
|
|
1359
|
+
def cb_service(value: ValueT):
|
|
1360
|
+
cb(self)
|
|
1361
|
+
|
|
1305
1362
|
return self.service.add_on_changed(
|
|
1306
|
-
self.rules, convert_path_to_se_path(self.path),
|
|
1363
|
+
self.rules, convert_path_to_se_path(self.path), cb_service
|
|
1307
1364
|
)
|
|
1308
1365
|
|
|
1309
|
-
def add_on_affected(self, cb: Callable) -> EventSubscription:
|
|
1366
|
+
def add_on_affected(self, cb: Callable[[PyMenuT], None]) -> EventSubscription:
|
|
1310
1367
|
"""Register a callback for when the object is affected.
|
|
1311
1368
|
|
|
1312
1369
|
Parameters
|
|
1313
1370
|
----------
|
|
1314
|
-
cb : Callable
|
|
1371
|
+
cb : Callable[[PyMenuT], None]
|
|
1315
1372
|
Callback function
|
|
1316
1373
|
|
|
1317
1374
|
Returns
|
|
@@ -1319,12 +1376,16 @@ class PyMenu(PyStateContainer):
|
|
|
1319
1376
|
EventSubscription
|
|
1320
1377
|
EventSubscription instance which can be used to unregister the callback
|
|
1321
1378
|
"""
|
|
1379
|
+
|
|
1380
|
+
def cb_service():
|
|
1381
|
+
cb(self)
|
|
1382
|
+
|
|
1322
1383
|
return self.service.add_on_affected(
|
|
1323
|
-
self.rules, convert_path_to_se_path(self.path),
|
|
1384
|
+
self.rules, convert_path_to_se_path(self.path), cb_service
|
|
1324
1385
|
)
|
|
1325
1386
|
|
|
1326
1387
|
def add_on_affected_at_type_path(
|
|
1327
|
-
self, child_type: str, cb: Callable
|
|
1388
|
+
self, child_type: str, cb: Callable[[PyMenuT], None]
|
|
1328
1389
|
) -> EventSubscription:
|
|
1329
1390
|
"""Register a callback for when the object is affected at child type.
|
|
1330
1391
|
|
|
@@ -1332,7 +1393,7 @@ class PyMenu(PyStateContainer):
|
|
|
1332
1393
|
----------
|
|
1333
1394
|
child_type : str
|
|
1334
1395
|
child type
|
|
1335
|
-
cb : Callable
|
|
1396
|
+
cb : Callable[[PyMenuT], None]
|
|
1336
1397
|
Callback function
|
|
1337
1398
|
|
|
1338
1399
|
Returns
|
|
@@ -1340,12 +1401,16 @@ class PyMenu(PyStateContainer):
|
|
|
1340
1401
|
EventSubscription
|
|
1341
1402
|
EventSubscription instance which can be used to unregister the callback
|
|
1342
1403
|
"""
|
|
1404
|
+
|
|
1405
|
+
def cb_service():
|
|
1406
|
+
cb(self)
|
|
1407
|
+
|
|
1343
1408
|
return self.service.add_on_affected_at_type_path(
|
|
1344
|
-
self.rules, convert_path_to_se_path(self.path), child_type,
|
|
1409
|
+
self.rules, convert_path_to_se_path(self.path), child_type, cb_service
|
|
1345
1410
|
)
|
|
1346
1411
|
|
|
1347
1412
|
def add_on_command_executed_old(
|
|
1348
|
-
self, command: str, cb: Callable
|
|
1413
|
+
self, command: str, cb: Callable[[PyMenuT, str, ValueT], None]
|
|
1349
1414
|
) -> EventSubscription:
|
|
1350
1415
|
"""Register a callback for when a command is executed.
|
|
1351
1416
|
|
|
@@ -1353,7 +1418,7 @@ class PyMenu(PyStateContainer):
|
|
|
1353
1418
|
----------
|
|
1354
1419
|
command : str
|
|
1355
1420
|
Command name
|
|
1356
|
-
cb : Callable
|
|
1421
|
+
cb : Callable[[PyMenuT, str, ValueT], None]
|
|
1357
1422
|
Callback function
|
|
1358
1423
|
|
|
1359
1424
|
Returns
|
|
@@ -1361,16 +1426,22 @@ class PyMenu(PyStateContainer):
|
|
|
1361
1426
|
EventSubscription
|
|
1362
1427
|
EventSubscription instance which can be used to unregister the callback
|
|
1363
1428
|
"""
|
|
1429
|
+
|
|
1430
|
+
def cb_service(command: str, args: ValueT):
|
|
1431
|
+
cb(self, command, args)
|
|
1432
|
+
|
|
1364
1433
|
return self.service.add_on_command_executed_old(
|
|
1365
|
-
self.rules, convert_path_to_se_path(self.path), command, self,
|
|
1434
|
+
self.rules, convert_path_to_se_path(self.path), command, self, cb_service
|
|
1366
1435
|
)
|
|
1367
1436
|
|
|
1368
|
-
def add_on_command_executed(
|
|
1437
|
+
def add_on_command_executed(
|
|
1438
|
+
self, cb: Callable[[PyMenuT, str, ValueT], None]
|
|
1439
|
+
) -> EventSubscription:
|
|
1369
1440
|
"""Register a callback for when a command is executed.
|
|
1370
1441
|
|
|
1371
1442
|
Parameters
|
|
1372
1443
|
----------
|
|
1373
|
-
cb : Callable
|
|
1444
|
+
cb : Callable[[PyMenuT, str, ValueT], None]
|
|
1374
1445
|
Callback function
|
|
1375
1446
|
|
|
1376
1447
|
Returns
|
|
@@ -1378,8 +1449,12 @@ class PyMenu(PyStateContainer):
|
|
|
1378
1449
|
EventSubscription
|
|
1379
1450
|
EventSubscription instance which can be used to unregister the callback
|
|
1380
1451
|
"""
|
|
1452
|
+
|
|
1453
|
+
def cb_service(command: str, args: ValueT):
|
|
1454
|
+
cb(self, command, args)
|
|
1455
|
+
|
|
1381
1456
|
return self.service.add_on_command_executed(
|
|
1382
|
-
self.rules, convert_path_to_se_path(self.path),
|
|
1457
|
+
self.rules, convert_path_to_se_path(self.path), cb_service
|
|
1383
1458
|
)
|
|
1384
1459
|
|
|
1385
1460
|
|
|
@@ -1393,12 +1468,12 @@ class PyParameter(PyStateContainer):
|
|
|
1393
1468
|
"""Get default value of the parameter."""
|
|
1394
1469
|
return self.get_attr(Attribute.DEFAULT.value)
|
|
1395
1470
|
|
|
1396
|
-
def add_on_changed(self, cb: Callable) -> EventSubscription:
|
|
1471
|
+
def add_on_changed(self, cb: Callable[[PyMenuT], None]) -> EventSubscription:
|
|
1397
1472
|
"""Register a callback for when the object is modified.
|
|
1398
1473
|
|
|
1399
1474
|
Parameters
|
|
1400
1475
|
----------
|
|
1401
|
-
cb : Callable
|
|
1476
|
+
cb : Callable[[PyMenuT], None]
|
|
1402
1477
|
Callback function
|
|
1403
1478
|
|
|
1404
1479
|
Returns
|
|
@@ -1406,8 +1481,12 @@ class PyParameter(PyStateContainer):
|
|
|
1406
1481
|
EventSubscription
|
|
1407
1482
|
EventSubscription instance which can be used to unregister the callback
|
|
1408
1483
|
"""
|
|
1484
|
+
|
|
1485
|
+
def cb_service(value: ValueT):
|
|
1486
|
+
cb(self)
|
|
1487
|
+
|
|
1409
1488
|
return self.service.add_on_changed(
|
|
1410
|
-
self.rules, convert_path_to_se_path(self.path),
|
|
1489
|
+
self.rules, convert_path_to_se_path(self.path), cb_service
|
|
1411
1490
|
)
|
|
1412
1491
|
|
|
1413
1492
|
|
|
@@ -1892,7 +1971,8 @@ class PyCommand:
|
|
|
1892
1971
|
id,
|
|
1893
1972
|
static_info.get("args"),
|
|
1894
1973
|
)
|
|
1895
|
-
|
|
1974
|
+
# Possible error thrown from the grpc layer
|
|
1975
|
+
except (RuntimeError, ValueError):
|
|
1896
1976
|
logger.warning(
|
|
1897
1977
|
"Create command arguments object is available from 23.1 onwards"
|
|
1898
1978
|
)
|