Merge pull request #3140 from alphagov/fix-flake8

Fix flake8
This commit is contained in:
Katie Smith
2021-02-16 09:28:23 +00:00
committed by GitHub
12 changed files with 28 additions and 24 deletions

View File

@@ -4,7 +4,6 @@ from datetime import datetime
from flask import current_app
from notifications_utils.statsd_decorators import statsd
from sqlalchemy.schema import Sequence
from celery.exceptions import MaxRetriesExceededError
from app import cbc_proxy_client, db, notify_celery
from app.clients.cbc_proxy import CBCProxyFatalException, CBCProxyRetryableException
@@ -57,7 +56,7 @@ def check_provider_message_should_send(broadcast_event, provider):
raise CBCProxyFatalException(
f'Cannot send broadcast_event {broadcast_event.id} ' +
f'to provider {provider}: ' +
f'It is already in status technical-failure'
'It is already in status technical-failure'
)
if broadcast_event.transmitted_finishes_at < datetime.utcnow():
@@ -82,8 +81,8 @@ def check_provider_message_should_send(broadcast_event, provider):
raise CBCProxyFatalException(
f'Cannot send {broadcast_event.id}. Previous event {prev_event.id} ' +
f'(type {prev_event.message_type}) has no provider_message for provider {provider} yet.\n' +
f'You must ensure that the other event sends succesfully, then manually kick off this event ' +
f'again by re-running send_broadcast_provider_message for this event and provider.'
'You must ensure that the other event sends succesfully, then manually kick off this event ' +
'again by re-running send_broadcast_provider_message for this event and provider.'
)
# if there's a previous message that has started but not finished sending (whether it fatally errored or is
@@ -93,8 +92,8 @@ def check_provider_message_should_send(broadcast_event, provider):
f'Cannot send {broadcast_event.id}. Previous event {prev_event.id} ' +
f'(type {prev_event.message_type}) has not finished sending to provider {provider} yet.\n' +
f'It is currently in status "{prev_provider_message.status}".\n' +
f'You must ensure that the other event sends succesfully, then manually kick off this event ' +
f'again by re-running send_broadcast_provider_message for this event and provider.'
'You must ensure that the other event sends succesfully, then manually kick off this event ' +
'again by re-running send_broadcast_provider_message for this event and provider.'
)

View File

@@ -224,7 +224,8 @@ def check_if_letters_still_in_created():
msg = "{} letters were created before 17.30 yesterday and still have 'created' status. " \
"Follow runbook to resolve: " \
"https://github.com/alphagov/notifications-manuals/wiki/Support-Runbook#deal-with-Letters-still-in-created. " \
"https://github.com/alphagov/notifications-manuals/wiki/Support-Runbook" \
"#deal-with-Letters-still-in-created. " \
"Notifications: {}".format(len(letters), letter_ids)
current_app.logger.warning(msg)

View File

@@ -134,7 +134,7 @@ class CBCProxyClientBase(ABC):
InvocationType='RequestResponse',
Payload=payload_bytes,
)
except botocore.exceptions.ClientError as exc:
except botocore.exceptions.ClientError:
current_app.logger.exception(f'Boto ClientError calling lambda {lambda_name}')
success = False
return success

View File

@@ -2,7 +2,6 @@ import boto3
import botocore
from flask import current_app
from time import monotonic
from notifications_utils.recipients import InvalidEmailError
from app.clients import STATISTICS_DELIVERED, STATISTICS_FAILURE
from app.clients.email import EmailClient, EmailClientException, EmailClientNonRetryableException

View File

@@ -151,7 +151,7 @@ def get_dt_string_or_none(val):
def get_uuid_string_or_none(val):
return str(val) if val else None
return str(val) if val else None
def format_sequential_number(sequential_number):

View File

@@ -31,7 +31,7 @@ def create_broadcast():
if not validate_xml(cap_xml, 'CAP-v1.2.xsd'):
raise BadRequestError(
message=f'Request data is not valid CAP XML',
message='Request data is not valid CAP XML',
status_code=400,
)