Skip to content

Commit

Permalink
run black
Browse files Browse the repository at this point in the history
Signed-off-by: constanca <[email protected]>
  • Loading branch information
constanca-m committed May 29, 2024
1 parent ba1578f commit f3df0e6
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 15 deletions.
5 changes: 4 additions & 1 deletion handlers/aws/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def lambda_handler(lambda_event: dict[str, Any], lambda_context: context_.Contex
if shipper is None:
shared_logger.warning(
"no shipper for output in replay queue",
extra={"output_destination": event["output_destination"], "event_input_id": event["event_input_id"]},
extra={
"output_destination": event["output_destination"],
"event_input_id": event["event_input_id"],
},
)
continue

Expand Down
4 changes: 3 additions & 1 deletion handlers/aws/replay_trigger.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ def __init__(self, replay_queue_arn: str):
def add_event_with_receipt_handle(self, event_uniq_id: str, receipt_handle: str) -> None:
self._events_with_receipt_handle[event_uniq_id] = receipt_handle

def replay_handler(self, output_destination: str, output_args: dict[str, Any], event_payload: dict[str, Any]) -> None:
def replay_handler(
self, output_destination: str, output_args: dict[str, Any], event_payload: dict[str, Any]
) -> None:
event_uniq_id: str = event_payload["_id"] + output_destination
self._failed_event_ids.append(event_uniq_id)

Expand Down
11 changes: 6 additions & 5 deletions handlers/aws/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ def get_shipper_from_input(event_input: Input) -> CompositeShipper:
if output.type == "logstash":
shared_logger.debug("setting Logstash shipper")

logstash_shipper: ProtocolShipper = ShipperFactory.create_from_output(
output_type="logstash", output=output
)
logstash_shipper: ProtocolShipper = ShipperFactory.create_from_output(output_type="logstash", output=output)

composite_shipper.add_shipper(shipper=logstash_shipper)

Expand Down Expand Up @@ -348,7 +346,9 @@ class ReplayEventHandler:
def __init__(self, event_input: Input):
self._event_input_id: str = event_input.id

def replay_handler(self, output_destination: str, output_args: dict[str, Any], event_payload: dict[str, Any]) -> None:
def replay_handler(
self, output_destination: str, output_args: dict[str, Any], event_payload: dict[str, Any]
) -> None:
sqs_replay_queue = os.environ["SQS_REPLAY_URL"]

sqs_client = get_sqs_client()
Expand All @@ -363,7 +363,8 @@ def replay_handler(self, output_destination: str, output_args: dict[str, Any], e
sqs_client.send_message(QueueUrl=sqs_replay_queue, MessageBody=json_dumper(message_payload))

shared_logger.debug(
"sent to replay queue", extra={"output_destination": output_destination, "event_input_id": self._event_input_id}
"sent to replay queue",
extra={"output_destination": output_destination, "event_input_id": self._event_input_id},
)


Expand Down
4 changes: 3 additions & 1 deletion tests/handlers/aws/test_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,9 @@ def test_lambda_handler_failure(self) -> None:
}
]
}
with self.assertRaisesRegex(OutputConfigException, "Cannot load output with destination output_destination"):
with self.assertRaisesRegex(
OutputConfigException, "Cannot load output with destination output_destination"
):
ctx = ContextMock()

handler(event, ctx) # type:ignore
Expand Down
7 changes: 4 additions & 3 deletions tests/handlers/aws/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def test_get_trigger_type_and_config_source(self) -> None:
"Records": [
{
"body": '{"output_destination": "output_destination", '
'"output_args": "output_args", "event_payload": "event_payload"}'
'"output_args": "output_args", "event_payload": "event_payload"}'
}
]
}
Expand Down Expand Up @@ -261,8 +261,9 @@ def test_get_shipper_from_input(self) -> None:
assert len(shipper._shippers) == 1
assert isinstance(shipper._shippers[0], LogstashShipper)

event_input_kinesis = config.get_input_by_id("arn:aws:kinesis:eu-central-1:123456789:stream/test-esf"
"-kinesis-stream")
event_input_kinesis = config.get_input_by_id(
"arn:aws:kinesis:eu-central-1:123456789:stream/test-esf" "-kinesis-stream"
)
assert event_input_kinesis is not None
shipper = get_shipper_from_input(event_input=event_input_kinesis)
assert len(shipper._shippers) == 1
Expand Down
10 changes: 6 additions & 4 deletions tests/share/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,8 +591,9 @@ def test_get_output_by_type(self) -> None:
batch_max_bytes=1,
)

assert isinstance(input_sqs.get_output_by_destination(output_destination="elasticsearch_url"),
ElasticsearchOutput)
assert isinstance(
input_sqs.get_output_by_destination(output_destination="elasticsearch_url"), ElasticsearchOutput
)

with self.subTest("logstash output"):
input_sqs = Input(input_type="s3-sqs", input_id="id")
Expand All @@ -616,8 +617,9 @@ def test_add_output(self) -> None:
batch_max_bytes=1,
)

assert isinstance(input_sqs.get_output_by_destination(output_destination="elasticsearch_url"),
ElasticsearchOutput)
assert isinstance(
input_sqs.get_output_by_destination(output_destination="elasticsearch_url"), ElasticsearchOutput
)

with self.subTest("logstash output"):
input_sqs = Input(input_type="s3-sqs", input_id="id")
Expand Down

0 comments on commit f3df0e6

Please sign in to comment.