Skip to content

Commit a886e6f

Browse files
authored
Added specific exception catch and Removed Fields that duplicates the name of its containing class (#26)
* Added specific exception catch Closed (FLK-E722) Do not use bare `except`, specify exception instead #15 * Removed Fields that duplicates the name of its containing class Closed (PTC-W0052) Field duplicates the name of its containing class #23
1 parent 56d0feb commit a886e6f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/Actions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Actions:
22
def __init__(self, actions = None):
33
if actions is None:
44
actions = []
5-
self.actions = actions
5+
self.actions_list = actions
66
@staticmethod
77
def to_string():
88
result_s = ""

src/Conditions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ class Conditions:
22
def __init__(self, conditions = None ):
33
if conditions is None:
44
conditions = []
5-
self.conditions = conditions
5+
self.conditions_list = conditions
66

77
@staticmethod
88
def to_string():

src/StateMachine.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def __init__(self, xml_file : str):
1313
def __CheckConditions(self,conditions):
1414
all_conditions_satisfied = True
1515
if(conditions is not None):
16-
_conditions = conditions.conditions
16+
_conditions = conditions.conditions_list
1717
for condition in _conditions:
1818
module,expression = self.__PrepareExpression(condition.expression)
1919
if module in self.context:
@@ -28,7 +28,7 @@ def __CheckConditions(self,conditions):
2828
if str(result) != condition.result:
2929
all_conditions_satisfied = False
3030
break
31-
except:
31+
except AttributeError:
3232
logging.error("Not Found Expression %s in Context", condition.expression)
3333
all_conditions_satisfied = False
3434
else:
@@ -41,7 +41,7 @@ def __CheckConditions(self,conditions):
4141
def __ExecActions(self,actions):
4242
all_action_executed = True
4343
if(actions is not None):
44-
_actions = actions.actions
44+
_actions = actions.actions_list
4545
for action in _actions:
4646
module,expression = self.__PrepareExpression(action.expression)
4747
if module in self.context:
@@ -52,7 +52,7 @@ def __ExecActions(self,actions):
5252
func()
5353
else:
5454
func
55-
except:
55+
except AttributeError:
5656
logging.error("Not Found Expression %s in Context", action.expression)
5757
all_action_executed = False;
5858
else:

0 commit comments

Comments
 (0)