mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-09 07:13:12 -04:00
fix flake 8
This commit is contained in:
@@ -44,7 +44,7 @@ def list_s3_objects():
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception:
|
||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
f"An error occurred while regenerating cache #notify-admin-1200",
|
f"An error occurred while regenerating cache #notify-admin-1200",
|
||||||
exc_info=True,
|
exc_info=True,
|
||||||
@@ -116,7 +116,7 @@ def download_from_s3(
|
|||||||
except botocore.exceptions.PartialCredentialsError as pce:
|
except botocore.exceptions.PartialCredentialsError as pce:
|
||||||
current_app.logger.error("Incomplete credentials provided", exc_info=True)
|
current_app.logger.error("Incomplete credentials provided", exc_info=True)
|
||||||
raise Exception(pce)
|
raise Exception(pce)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
current_app.logger.error(f"An error occurred", exc_info=True)
|
current_app.logger.error(f"An error occurred", exc_info=True)
|
||||||
text = f"EXCEPTION local_filename {local_filename}"
|
text = f"EXCEPTION local_filename {local_filename}"
|
||||||
raise Exception(text)
|
raise Exception(text)
|
||||||
@@ -191,7 +191,7 @@ def get_job_from_s3(service_id, job_id):
|
|||||||
sleep_time = backoff_factor * (2**retries) # Exponential backoff
|
sleep_time = backoff_factor * (2**retries) # Exponential backoff
|
||||||
time.sleep(sleep_time)
|
time.sleep(sleep_time)
|
||||||
continue
|
continue
|
||||||
except Exception as e:
|
except Exception:
|
||||||
current_app.logger.error(f"Failed to get object from bucket", exc_info=True)
|
current_app.logger.error(f"Failed to get object from bucket", exc_info=True)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|||||||
@@ -300,8 +300,8 @@ def bulk_invite_user_to_service(file_name, service_id, user_id, auth_type, permi
|
|||||||
current_app.logger.warning(
|
current_app.logger.warning(
|
||||||
f"*** ERROR occurred for email address: {email_address.strip()}"
|
f"*** ERROR occurred for email address: {email_address.strip()}"
|
||||||
)
|
)
|
||||||
current_app.logger, info(response[0].get_data(as_text=True))
|
current_app.logger.info(response[0].get_data(as_text=True))
|
||||||
except Exception as e:
|
except Exception:
|
||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
f"*** ERROR occurred for email address: {email_address.strip()}.",
|
f"*** ERROR occurred for email address: {email_address.strip()}.",
|
||||||
exc_info=True,
|
exc_info=True,
|
||||||
@@ -531,7 +531,7 @@ def populate_go_live(file_name):
|
|||||||
go_live_user = None
|
go_live_user = None
|
||||||
except NoResultFound:
|
except NoResultFound:
|
||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
f"No user found for email address", exc_info=True
|
"No user found for email address", exc_info=True
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
try:
|
try:
|
||||||
@@ -1070,4 +1070,4 @@ def add_test_users_to_db(generate, state, admin):
|
|||||||
state=state,
|
state=state,
|
||||||
platform_admin=admin,
|
platform_admin=admin,
|
||||||
)
|
)
|
||||||
currente_app.logger.info(f"{num} {user.email_address} created")
|
current_app.logger.info(f"{num} {user.email_address} created")
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ def get_login_gov_user(login_uuid, email_address):
|
|||||||
if user.email_address != email_address:
|
if user.email_address != email_address:
|
||||||
try:
|
try:
|
||||||
save_user_attribute(user, {"email_address": email_address})
|
save_user_attribute(user, {"email_address": email_address})
|
||||||
except sqlalchemy.exc.IntegrityError as ie:
|
except sqlalchemy.exc.IntegrityError:
|
||||||
# We are trying to change the email address as a courtesy,
|
# We are trying to change the email address as a courtesy,
|
||||||
# based on the assumption that the user has somehow changed their
|
# based on the assumption that the user has somehow changed their
|
||||||
# address in login.gov.
|
# address in login.gov.
|
||||||
|
|||||||
@@ -45,9 +45,9 @@ def sns_notification_handler(data, headers):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
validate_sns_cert(message)
|
validate_sns_cert(message)
|
||||||
except Exception as e:
|
except Exception:
|
||||||
current_app.logger.error(
|
current_app.logger.error(
|
||||||
f"SES-SNS callback failed: validation failed with error: Signature validation failed",
|
"SES-SNS callback failed: validation failed with error: Signature validation failed",
|
||||||
exc_info=True,
|
exc_info=True,
|
||||||
)
|
)
|
||||||
raise InvalidRequest("SES-SNS callback failed: validation failed", 400)
|
raise InvalidRequest("SES-SNS callback failed: validation failed", 400)
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ from app.service.service_senders_schema import (
|
|||||||
)
|
)
|
||||||
from app.service.utils import get_guest_list_objects
|
from app.service.utils import get_guest_list_objects
|
||||||
from app.user.users_schema import post_set_permissions_schema
|
from app.user.users_schema import post_set_permissions_schema
|
||||||
from app.utils import get_prev_next_pagination_links, hilite, utc_now
|
from app.utils import get_prev_next_pagination_links, utc_now
|
||||||
|
|
||||||
service_blueprint = Blueprint("service", __name__)
|
service_blueprint = Blueprint("service", __name__)
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ from app.notifications.process_notifications import (
|
|||||||
send_notification_to_queue,
|
send_notification_to_queue,
|
||||||
)
|
)
|
||||||
from app.schemas import invited_user_schema
|
from app.schemas import invited_user_schema
|
||||||
from app.utils import hilite, utc_now
|
from app.utils import utc_now
|
||||||
from notifications_utils.url_safe_token import check_token, generate_token
|
from notifications_utils.url_safe_token import check_token, generate_token
|
||||||
|
|
||||||
service_invite = Blueprint("service_invite", __name__)
|
service_invite = Blueprint("service_invite", __name__)
|
||||||
|
|||||||
Reference in New Issue
Block a user