From f6e0bb6d17d61e54defef0cf3f7576daabe17b23 Mon Sep 17 00:00:00 2001 From: josh-deb Date: Wed, 27 Nov 2024 13:18:57 -0800 Subject: [PATCH] pre-commit --- beams/tests/artifacts/egg_generator.py | 2 +- beams/tests/test_bin.py | 2 +- beams/tests/test_serialize.py | 2 +- beams/tests/test_utility_trees.py | 3 +-- beams/tree_config/utility_trees/reset_ioc.py | 12 +++++------- beams/tree_config/value.py | 3 ++- examples/mfx_dg1/mfx_tree.py | 2 +- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/beams/tests/artifacts/egg_generator.py b/beams/tests/artifacts/egg_generator.py index 3cf06ef..f5f4c1e 100644 --- a/beams/tests/artifacts/egg_generator.py +++ b/beams/tests/artifacts/egg_generator.py @@ -10,7 +10,6 @@ from beams.tree_config.action import IncPVActionItem, SetPVActionItem from beams.tree_config.base import BehaviorTreeItem -from beams.tree_config.value import EPICSValue, FixedValue from beams.tree_config.composite import SequenceItem from beams.tree_config.condition import (BinaryConditionItem, BoundedConditionItem, @@ -18,6 +17,7 @@ from beams.tree_config.idiom import CheckAndDoItem from beams.tree_config.py_trees import (RunningItem, StatusQueueItem, SuccessItem) +from beams.tree_config.value import EPICSValue, FixedValue # egg 1 diff --git a/beams/tests/test_bin.py b/beams/tests/test_bin.py index f9505a3..144201f 100644 --- a/beams/tests/test_bin.py +++ b/beams/tests/test_bin.py @@ -15,9 +15,9 @@ from beams.bin.main import main from beams.tests.conftest import cli_args, restore_logging from beams.tree_config import save_tree_item_to_path -from beams.tree_config.value import EPICSValue from beams.tree_config.composite import SequenceItem from beams.tree_config.condition import BinaryConditionItem +from beams.tree_config.value import EPICSValue logger = logging.getLogger(__name__) diff --git a/beams/tests/test_serialize.py b/beams/tests/test_serialize.py index 9b8498c..758d89f 100644 --- a/beams/tests/test_serialize.py +++ b/beams/tests/test_serialize.py @@ -2,10 +2,10 @@ from beams.tree_config.action import IncPVActionItem, SetPVActionItem from beams.tree_config.base import BehaviorTreeItem -from beams.tree_config.value import EPICSValue, FixedValue from beams.tree_config.composite import SequenceItem from beams.tree_config.condition import BinaryConditionItem, ConditionOperator from beams.tree_config.idiom import CheckAndDoItem +from beams.tree_config.value import EPICSValue, FixedValue def test_serialize_check_and_do(): diff --git a/beams/tests/test_utility_trees.py b/beams/tests/test_utility_trees.py index 1da14c0..c8751a6 100644 --- a/beams/tests/test_utility_trees.py +++ b/beams/tests/test_utility_trees.py @@ -1,5 +1,4 @@ import time -from pathlib import Path import py_trees from caproto.tests.conftest import run_example_ioc @@ -18,7 +17,7 @@ def test_sys_reset(request, bt_cleaner): "beams.tests.mock_iocs.SysResetIOC", request=request, pv_to_check="SysResetTest:HEARTBEAT", - ) + ) reset_ioc_tree.setup_with_descendants() while reset_ioc_tree.status not in ( diff --git a/beams/tree_config/utility_trees/reset_ioc.py b/beams/tree_config/utility_trees/reset_ioc.py index 2c02df9..600c01e 100644 --- a/beams/tree_config/utility_trees/reset_ioc.py +++ b/beams/tree_config/utility_trees/reset_ioc.py @@ -2,16 +2,14 @@ from dataclasses import dataclass import py_trees -from py_trees.composites import Sequence - from epics import caget +from py_trees.composites import Sequence from beams.behavior_tree.action_node import ActionNode, wrapped_action_work - -from beams.tree_config.base import BaseItem -from beams.tree_config.value import BlackBoardValue, EPICSValue from beams.tree_config.action import SetPVActionItem +from beams.tree_config.base import BaseItem from beams.tree_config.condition import BinaryConditionItem, ConditionOperator +from beams.tree_config.value import BlackBoardValue, EPICSValue logger = logging.getLogger(__name__) @@ -27,7 +25,7 @@ class ResetIOCItem(BaseItem): def __post_init__(self): # non dataclass PVss self.hbeat_val = BlackBoardValue(bb_name=f"{self.ioc_prefix}_reset", - key_name=self.HEARTBEAT_KEY_NAME) + key_name=self.HEARTBEAT_KEY_NAME) self.name = f"{self.ioc_prefix}_reset_tree" def get_tree(self) -> Sequence: @@ -59,7 +57,7 @@ def cache_hbeat_wfunc(): send_reset = SetPVActionItem(name=f"reset_{self.ioc_prefix}", pv=f"{self.ioc_prefix}:SysReset", value=1, - loop_period_sec=3.0, # this is greater than work_timeout period, should only happen once. + loop_period_sec=3.0, # this is greater than work_timeout period, should only happen once. termination_check=reset_success_termination_condiiton) root = Sequence(name=self.name, diff --git a/beams/tree_config/value.py b/beams/tree_config/value.py index 315678e..ed5cf7b 100644 --- a/beams/tree_config/value.py +++ b/beams/tree_config/value.py @@ -1,9 +1,10 @@ import logging -from typing import Any from dataclasses import dataclass +from typing import Any import py_trees from epics import caget + from beams.serialization import as_tagged_union logger = logging.getLogger(__name__) diff --git a/examples/mfx_dg1/mfx_tree.py b/examples/mfx_dg1/mfx_tree.py index 542c119..2c3e055 100644 --- a/examples/mfx_dg1/mfx_tree.py +++ b/examples/mfx_dg1/mfx_tree.py @@ -2,13 +2,13 @@ from beams.tree_config import save_tree_item_to_path from beams.tree_config.action import SetPVActionItem -from beams.tree_config.value import EPICSValue, FixedValue from beams.tree_config.composite import (SelectorItem, SequenceConditionItem, SequenceItem) from beams.tree_config.condition import (BinaryConditionItem, BoundedConditionItem, ConditionOperator) from beams.tree_config.idiom import CheckAndDoItem +from beams.tree_config.value import EPICSValue, FixedValue # DG2 Stopper: remove check_dg2_stp_not_open = BinaryConditionItem(