Skip to content

Commit

Permalink
23504 - Fixing flake8 x2.
Browse files Browse the repository at this point in the history
  • Loading branch information
hfekete committed Oct 18, 2024
1 parent 5771d6b commit 1035c1c
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
5 changes: 3 additions & 2 deletions search-api/src/search_api/exceptions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,11 @@ def __post_init__(self):


class DbRecordNotFoundException(BaseExceptionE):
"""Row not found in database"""
"""Row not found in database."""

def __init__(self):
self.message = "DB record not found"
"""Return a valid Record Not Found Exception."""
self.message = 'DB record not found'
self.status_code = HTTPStatus.NOT_FOUND
super().__init__()

Expand Down
2 changes: 1 addition & 1 deletion search-api/src/search_api/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""Exposes the versioned endpoints."""
from .constants import EndpointVersionPath
from .v1 import bus_bp, internal_bp, meta_bp, ops_bp, purchases_bp
from .v2 import search_bp, payments_bp
from .v2 import payments_bp, search_bp
from .version_endpoint import VersionEndpoint


Expand Down
2 changes: 1 addition & 1 deletion search-api/src/search_api/resources/v2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Exposes all of the resource v2 endpoints in Flask-Blueprint style."""
from .search import bp as search_bp
from .payments import bp as payments_bp
from .search import bp as search_bp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@
from .payments import bp as payments_bp

bp = Blueprint('PAYMENTS', __name__, url_prefix='/payments') # pylint: disable=invalid-name

bp.register_blueprint(payments_bp)
5 changes: 2 additions & 3 deletions search-api/src/search_api/resources/v2/payments/payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@
from search_api.exceptions import DbRecordNotFoundException
from search_api.models import DocumentAccessRequest
from search_api.services import simple_queue
# from search_api.services.gcp_auth.auth_service import ensure_authorized_queue_user
from search_api.services.gcp_auth import auth_service
from search_api.services.gcp_auth.auth_service import ensure_authorized_queue_user

bp = Blueprint('GCP_LISTENER', __name__, url_prefix='') # pylint: disable=invalid-name


@bp.post('')
@cross_origin(origin='*')
@auth_service.ensure_authorized_queue_user
@ensure_authorized_queue_user
def gcp_listener():
"""Process the incoming cloud event.
Expand Down
1 change: 1 addition & 0 deletions search-api/src/search_api/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"""This module wraps the calls to external services used by the API."""

from gcp_queue import GcpQueue

from .authz import BASIC_USER, SBC_STAFF, STAFF_ROLE, SYSTEM_ROLE, get_role, is_staff, is_system
from .business_solr import BusinessSolr
from .flags import Flags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def verify_jwt(session):


def ensure_authorized_queue_user(f):
"""Ensures the user is authorized to use the queue."""
"""Ensure the user is authorized to use the queue."""

@functools.wraps(f)
def decorated_function(*args, **kwargs):
Expand Down

0 comments on commit 1035c1c

Please sign in to comment.