Skip to content

Commit

Permalink
Apply formatter and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
istride committed Mar 6, 2025
1 parent ed44ec6 commit 3d0fa7e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/rpft/parsers/creation/flowparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ def _get_row_action(self, row):
)
elif row.type == "remove_from_group":
if not row.mainarg_groups:
LOGGER.warning(f"Removing contact from ALL groups.")
LOGGER.warning("Removing contact from ALL groups.")
return RemoveContactGroupAction(groups=[], all_groups=True)
elif row.mainarg_groups[0] == "ALL":
return RemoveContactGroupAction(groups=[], all_groups=True)
Expand Down Expand Up @@ -559,7 +559,8 @@ def _get_or_create_group(self, name, uuid=None):
def _get_row_node(self, row):
if (
row.type in ["add_to_group", "remove_from_group", "split_by_group"]
and row.obj_id and row.mainarg_groups
and row.obj_id
and row.mainarg_groups
):
self.rapidpro_container.record_group_uuid(row.mainarg_groups[0], row.obj_id)

Expand Down Expand Up @@ -804,8 +805,9 @@ def _compile_flow(self):
to fill in these missing UUIDs in a consistent way.
"""

# Caveat/TODO: Need to ensure starting node comes first.
flow_container = FlowContainer(flow_name=self.flow_name, uuid=self.flow_uuid, type=self.flow_type)
flow_container = FlowContainer(
flow_name=self.flow_name, uuid=self.flow_uuid, type=self.flow_type
)
if not len(self.node_group_stack) == 1:
raise Exception("Unexpected end of flow. Did you forget end_for/end_block?")
self.current_node_group().add_nodes_to_flow(flow_container)
Expand Down
2 changes: 2 additions & 0 deletions src/rpft/rapidpro/models/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
class RapidProActionError(Exception):
"Raised if some parameter of a RapidProAction is invalid."

pass


class RapidProRouterError(Exception):
"Raised if some parameter of a RapidProRouter is invalid."

pass
6 changes: 3 additions & 3 deletions tests/test_contentindexparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ def test_basic_user_model(self):

def test_flow_type(self):
ci_sheet = (
"type,sheet_name,data_sheet,data_row_id,new_name,data_model,options\n"
"create_flow,my_basic_flow,,,,,\n"
"create_flow,my_basic_flow,,,my_other_flow,,flow_type;messaging_background\n"
"type,sheet_name,new_name,data_model,options\n"
"create_flow,my_basic_flow,,,\n"
"create_flow,my_basic_flow,my_other_flow,,flow_type;messaging_background\n"
)
my_basic_flow = csv_join(
"row_id,type,from,message_text",
Expand Down
4 changes: 2 additions & 2 deletions tests/test_rowparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ def test_convert_empty(self):
self.assertEqual(out, self.emptyModel)

def test_convert_single_element(self):
self.oneModel = DictModel(**{"dict_field": {"K" : "V"}})
self.oneModel = DictModel(**{"dict_field": {"K": "V"}})
inputs = [
{"dict_field": ["K", "V"]},
{"dict_field": [["K", "V"]]},
Expand All @@ -184,7 +184,7 @@ def test_convert_single_element(self):
self.assertEqual(out, self.oneModel)

def test_convert_two_element(self):
self.onetwoModel = DictModel(**{"dict_field": {"K1" : "V1", "K2" : "V2"}})
self.onetwoModel = DictModel(**{"dict_field": {"K1": "V1", "K2": "V2"}})
inputs = [
{"dict_field": [["K1", "V1"], ["K2", "V2"]]},
{"dict_field.K1": "V1", "dict_field.K2": "V2"},
Expand Down

0 comments on commit 3d0fa7e

Please sign in to comment.