Skip to content

Commit 81d8e92

Browse files
committed
keep ruff only
Signed-off-by: Sylvain Hellegouarch <[email protected]>
1 parent bf6c7cf commit 81d8e92

File tree

6 files changed

+191
-214
lines changed

6 files changed

+191
-214
lines changed

chaosaddons/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@
99
try:
1010
__version__ = version("chaostoolkit-addons")
1111
except PackageNotFoundError: # pragma: no cover
12-
__version__ = 'unknown'
12+
__version__ = "unknown"

chaosaddons/controls/bypass.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,33 @@
4646
from chaoslib.types import Activity
4747

4848

49-
__all__ = ["before_experiment_control", "before_activity_control",
50-
"after_activity_control"]
49+
__all__ = [
50+
"before_experiment_control",
51+
"before_activity_control",
52+
"after_activity_control",
53+
]
5154
logger = logging.getLogger("chaostoolkit")
5255

5356

54-
def before_experiment_control(target_type: str = None,
55-
target_names: List[str] = None, **kwargs):
57+
def before_experiment_control(
58+
target_type: str = None, target_names: List[str] = None, **kwargs
59+
):
5660
if target_type:
5761
logger.warning(
5862
"No '{}' will be executed as configured by the bypass "
59-
"control".format(target_type))
63+
"control".format(target_type)
64+
)
6065
if target_names:
6166
logger.warning(
6267
"The following activities will not be executed: {}".format(
63-
", ".join(target_names)))
68+
", ".join(target_names)
69+
)
70+
)
6471

6572

66-
def before_activity_control(context: Activity, target_type: str = None,
67-
target_names: List[str] = None):
73+
def before_activity_control(
74+
context: Activity, target_type: str = None, target_names: List[str] = None
75+
):
6876
"""
6977
Sets the `dry` property on the activity so it is not actually executed
7078
"""
@@ -74,8 +82,9 @@ def before_activity_control(context: Activity, target_type: str = None,
7482
context["dry"] = True
7583

7684

77-
def after_activity_control(context: Activity, target_type: str = None,
78-
target_names: List[str] = None):
85+
def after_activity_control(
86+
context: Activity, target_type: str = None, target_names: List[str] = None
87+
):
7988
"""
8089
Removes the `dry` property that was previously set
8190
"""

chaosaddons/controls/repeat.py

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22
from copy import deepcopy
33
from typing import List
44

5-
from chaoslib.types import Activity, Experiment, Run
5+
from chaoslib.types import Activity, Experiment, Run
66

77
__all__ = ["after_activity_control"]
88
logger = logging.getLogger("chaostoolkit")
99

1010

11-
def after_activity_control(context: Activity, experiment: Experiment,
12-
state: Run, repeat_count: int = 0,
13-
break_if_previous_iteration_failed: bool = False
14-
) -> None:
11+
def after_activity_control(
12+
context: Activity,
13+
experiment: Experiment,
14+
state: Run,
15+
repeat_count: int = 0,
16+
break_if_previous_iteration_failed: bool = False,
17+
) -> None:
1518
"""
1619
Repeat the activity a certain number of times.
1720
@@ -72,28 +75,28 @@ def after_activity_control(context: Activity, experiment: Experiment,
7275
if break_if_previous_iteration_failed and last_status != "succeeded":
7376
logger.debug(
7477
"Last iteration failed so stopping our iterations "
75-
f"of '{activity_name}'")
78+
f"of '{activity_name}'"
79+
)
7680
return
7781

78-
hypothesis_activities = experiment.get(
79-
"steady-state-hypothesis", {}).get("probes", [])
80-
repeat_activity(
81-
activity, hypothesis_activities, repeat_count=repeat_count)
82+
hypothesis_activities = experiment.get("steady-state-hypothesis", {}).get(
83+
"probes", []
84+
)
85+
repeat_activity(activity, hypothesis_activities, repeat_count=repeat_count)
8286

8387
method_activities = experiment.get("method", [])
84-
repeat_activity(
85-
activity, method_activities, repeat_count=repeat_count)
88+
repeat_activity(activity, method_activities, repeat_count=repeat_count)
8689

8790
rollback_activities = experiment.get("rollbacks", [])
88-
repeat_activity(
89-
activity, rollback_activities, repeat_count=repeat_count)
91+
repeat_activity(activity, rollback_activities, repeat_count=repeat_count)
9092

9193

9294
###############################################################################
9395
# Internals
9496
###############################################################################
95-
def repeat_activity(activity: Activity, activities: List[Activity],
96-
repeat_count: int = 0) -> None:
97+
def repeat_activity(
98+
activity: Activity, activities: List[Activity], repeat_count: int = 0
99+
) -> None:
97100
if not activities:
98101
return
99102

@@ -102,8 +105,8 @@ def repeat_activity(activity: Activity, activities: List[Activity],
102105

103106
for pos, a in enumerate(copy_activities):
104107
if a["name"] == activity_name:
105-
for index in range(1, repeat_count+1):
108+
for index in range(1, repeat_count + 1):
106109
new_activity = deepcopy(activity)
107110
new_activity["iteration_index"] = index
108-
activities.insert(pos+index, new_activity)
111+
activities.insert(pos + index, new_activity)
109112
break

0 commit comments

Comments
 (0)