From 5771d6b96b7447cb85d41a5df3a77556c401d622 Mon Sep 17 00:00:00 2001 From: Hrvoje Fekete Date: Fri, 18 Oct 2024 09:41:13 -0700 Subject: [PATCH] 23504 - Fixing flake8. --- search-api/src/search_api/config.py | 9 +++------ .../src/search_api/resources/v2/payments/payments.py | 6 +++--- .../src/search_api/services/gcp_auth/auth_service.py | 4 +--- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/search-api/src/search_api/config.py b/search-api/src/search_api/config.py index 8855fe4..6b65fe0 100644 --- a/search-api/src/search_api/config.py +++ b/search-api/src/search_api/config.py @@ -199,8 +199,7 @@ class UnitTestingConfig(Config): # pylint: disable=too-few-public-methods 'kty': 'RSA', 'alg': 'RS256', 'use': 'sig', - 'n': 'AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR', - # noqa: E501 + 'n': 'AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR', # noqa: E501 'e': 'AQAB' } ] @@ -213,11 +212,9 @@ class UnitTestingConfig(Config): # pylint: disable=too-few-public-methods 'kty': 'RSA', 'alg': 'RS256', 'use': 'sig', - 'n': 'AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR', - # noqa: E501 + 'n': 'AN-fWcpCyE5KPzHDjigLaSUVZI0uYrcGcc40InVtl-rQRDmAh-C2W8H4_Hxhr5VLc6crsJ2LiJTV_E72S03pzpOOaaYV6-TzAjCou2GYJIXev7f6Hh512PuG5wyxda_TlBSsI-gvphRTPsKCnPutrbiukCYrnPuWxX5_cES9eStR', # noqa: E501 'e': 'AQAB', - 'd': 'C0G3QGI6OQ6tvbCNYGCqq043YI_8MiBl7C5dqbGZmx1ewdJBhMNJPStuckhskURaDwk4-8VBW9SlvcfSJJrnZhgFMjOYSSsBtPGBIMIdM5eSKbenCCjO8Tg0BUh_xa3CHST1W4RQ5rFXadZ9AeNtaGcWj2acmXNO3DVETXAX3x0', - # noqa: E501 + 'd': 'C0G3QGI6OQ6tvbCNYGCqq043YI_8MiBl7C5dqbGZmx1ewdJBhMNJPStuckhskURaDwk4-8VBW9SlvcfSJJrnZhgFMjOYSSsBtPGBIMIdM5eSKbenCCjO8Tg0BUh_xa3CHST1W4RQ5rFXadZ9AeNtaGcWj2acmXNO3DVETXAX3x0', # noqa: E501 'p': 'APXcusFMQNHjh6KVD_hOUIw87lvK13WkDEeeuqAydai9Ig9JKEAAfV94W6Aftka7tGgE7ulg1vo3eJoLWJ1zvKM', 'q': 'AOjX3OnPJnk0ZFUQBwhduCweRi37I6DAdLTnhDvcPTrrNWuKPg9uGwHjzFCJgKd8KBaDQ0X1rZTZLTqi3peT43s', 'dp': 'AN9kBoA5o6_Rl9zeqdsIdWFmv4DB5lEqlEnC7HlAP-3oo3jWFO9KQqArQL1V8w2D4aCd0uJULiC9pCP7aTHvBhc', diff --git a/search-api/src/search_api/resources/v2/payments/payments.py b/search-api/src/search_api/resources/v2/payments/payments.py index 80271b7..5eca82e 100644 --- a/search-api/src/search_api/resources/v2/payments/payments.py +++ b/search-api/src/search_api/resources/v2/payments/payments.py @@ -38,15 +38,15 @@ def gcp_listener(): 200 - on success or invalid message (do not return invalid message in the queue) """ ce = simple_queue.get_simple_cloud_event(request, wrapped=True) - if ce is None or ce.data is None or not 'id' in ce.data or not 'statusCode' in ce.data: - # current flow says if msg is inv alid, it should be ACKed to get out of the queue + if ce is None or ce.data is None or 'id' not in ce.data or 'statusCode' not in ce.data: + # current flow says if msg is invalid, it should be ACKed to get out of the queue current_app.logger.error('Invalid Event Message Received: %s ', json.dumps(dataclasses.asdict(ce))) return {}, HTTPStatus.OK try: credit_card_payment = ce.data if credit_card_payment.get('corpTypeCode', '') != 'BUS': - raise Exception('invalid or missing corpTypeCode.') # noqa pylint: disable=broad-exception-raised + raise Exception('invalid or missing corpTypeCode.') # noqa: E713 # pylint: disable=broad-exception-raised dar = DocumentAccessRequest.find_by_id(credit_card_payment['id']) if not dar: raise DbRecordNotFoundException() diff --git a/search-api/src/search_api/services/gcp_auth/auth_service.py b/search-api/src/search_api/services/gcp_auth/auth_service.py index c4ec99b..e553117 100644 --- a/search-api/src/search_api/services/gcp_auth/auth_service.py +++ b/search-api/src/search_api/services/gcp_auth/auth_service.py @@ -18,14 +18,12 @@ import os from http import HTTPStatus - from cachecontrol import CacheControl from flask import abort, current_app, request from requests.sessions import Session - from google.oauth2 import service_account import google.auth.transport.requests -import google.oauth2.id_token as id_token # pylint: disable=consider-using-from-import +import google.oauth2.id_token as id_token # pylint: disable=consider-using-from-import from search_api.services.gcp_auth.abstract_auth_service import AuthService