From d3b895ddc6ad2b1ad492b5258f5db45646995005 Mon Sep 17 00:00:00 2001 From: Andrew Shumway Date: Wed, 27 Mar 2024 10:32:40 -0600 Subject: [PATCH] PEP-257 changes --- app/celery/provider_tasks.py | 8 +------- app/celery/tasks.py | 15 +++------------ app/delivery/send_to_providers.py | 8 ++++---- app/job/rest.py | 5 +---- 4 files changed, 9 insertions(+), 27 deletions(-) diff --git a/app/celery/provider_tasks.py b/app/celery/provider_tasks.py index e8d120a56..5d8d05ca2 100644 --- a/app/celery/provider_tasks.py +++ b/app/celery/provider_tasks.py @@ -91,13 +91,7 @@ def check_sms_delivery_receipt(self, message_id, notification_id, sent_at): bind=True, name="deliver_sms", max_retries=48, default_retry_delay=300 ) def deliver_sms(self, notification_id): - """ - This logic will branch off to the final step in delivering - the notification to sns. - Logic is in place for delivery receipts. - Additional logic to help devs output authentication code to - terminal. - """ + """Branch off to the final step in delivering the notification to sns and get delivery receipts.""" try: current_app.logger.info( "Start sending SMS for notification id: {}".format(notification_id) diff --git a/app/celery/tasks.py b/app/celery/tasks.py index 540e29177..ff7ead5ef 100644 --- a/app/celery/tasks.py +++ b/app/celery/tasks.py @@ -31,10 +31,7 @@ from app.v2.errors import TotalRequestsError @notify_celery.task(name="process-job") def process_job(job_id, sender_id=None): - """ - We update job status, get the csv data from s3 and begin processing - csv rows. - """ + """ Update job status, get csv data from s3, and begin processing csv rows.""" start = datetime.utcnow() job = dao_get_job_by_id(job_id) current_app.logger.info( @@ -114,10 +111,7 @@ def get_recipient_csv_and_template_and_sender_id(job): def process_row(row, template, job, service, sender_id=None): - """ - The process will branch off based on notification type, - sms or email. - """ + """Branch off based on notification type, sms or email.""" template_type = template.template_type encrypted = encryption.encrypt( { @@ -175,10 +169,7 @@ def __total_sending_limits_for_job_exceeded(service, job, job_id): @notify_celery.task(bind=True, name="save-sms", max_retries=5, default_retry_delay=300) def save_sms(self, service_id, notification_id, encrypted_notification, sender_id=None): - """ - We are persisting the notification to the db here and - placing notification in queue to send to sns. - """ + """Persist notification to db and place notification in queue to send to sns.""" notification = encryption.decrypt(encrypted_notification) # SerialisedService and SerialisedTemplate classes are # used here to grab the same service and template from the cache diff --git a/app/delivery/send_to_providers.py b/app/delivery/send_to_providers.py index 5e9373a60..98f86396a 100644 --- a/app/delivery/send_to_providers.py +++ b/app/delivery/send_to_providers.py @@ -22,10 +22,10 @@ from app.serialised_models import SerialisedService, SerialisedTemplate def send_sms_to_provider(notification): - """ - This is the last step in the message send flow. - We get necessary data for recipient, template, - notification and send it off to the provider. + """Final step in the message send flow. + + Get data for recipient, template, + notification and send it to sns. """ # we no longer store the personalisation in the db, # need to retrieve from s3 before generating content diff --git a/app/job/rest.py b/app/job/rest.py index 46fe698da..d139fe9ae 100644 --- a/app/job/rest.py +++ b/app/job/rest.py @@ -166,10 +166,7 @@ def get_jobs_by_service(service_id): @job_blueprint.route("", methods=["POST"]) def create_job(service_id): - """ - Entry point from UI for one-off messages - as well as CSV uploads. - """ + """Entry point from UI for one-off messages as well as CSV uploads.""" service = dao_fetch_service_by_id(service_id) if not service.active: raise InvalidRequest("Create job is not allowed: service is inactive ", 403)