Skip to content

Commit cab2e25

Browse files
committed
GH isort fix
1 parent 8d700de commit cab2e25

4 files changed

Lines changed: 14 additions & 12 deletions

File tree

mod_api/__init__.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
"""
2-
mod_apiJSON-only REST API for the CCExtractor CI/sample platform.
2+
mod_api: JSON REST API blueprint for the CCExtractor CI platform.
33
4-
Blueprint registered at /api/v1. All endpoints return structured JSON,
5-
use scoped Bearer token auth, and enforce rate limiting.
4+
Registered at /api/v1. All endpoints return structured JSON, use scoped
5+
Bearer token auth, and enforce per-client rate limiting.
66
"""
77

88
from flask import Blueprint
99

1010
mod_api = Blueprint('api', __name__)
1111

12-
# Import middleware (registers before_request, error handlers)
13-
from mod_api.middleware import error_handler # noqa: E402, F401
12+
# Middleware (registers before_request hooks and error handlers)
1413
from mod_api.middleware import auth # noqa: E402, F401
14+
from mod_api.middleware import error_handler # noqa: E402, F401
1515
from mod_api.middleware import rate_limit # noqa: E402, F401
16-
17-
# Import routes (registers endpoint functions)
16+
# Route modules (registers endpoint functions on the blueprint)
1817
from mod_api.routes import auth as auth_routes # noqa: E402, F401
18+
from mod_api.routes import errors_logs # noqa: E402, F401
19+
from mod_api.routes import results # noqa: E402, F401
1920
from mod_api.routes import runs # noqa: E402, F401
2021
from mod_api.routes import samples # noqa: E402, F401
21-
from mod_api.routes import results # noqa: E402, F401
22-
from mod_api.routes import errors_logs # noqa: E402, F401
2322
from mod_api.routes import system # noqa: E402, F401

mod_api/models/api_token.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212

1313
from argon2 import PasswordHasher
1414
from argon2.exceptions import VerifyMismatchError
15-
from sqlalchemy import Column, DateTime, ForeignKey, Integer, String, Text, UniqueConstraint
15+
from sqlalchemy import (Column, DateTime, ForeignKey, Integer, String, Text,
16+
UniqueConstraint)
1617
from sqlalchemy.orm import relationship
1718

1819
from database import Base
@@ -25,6 +26,7 @@
2526
'results:read',
2627
'baselines:write',
2728
'system:read',
29+
'tokens:manage',
2830
])
2931

3032
DEFAULT_SCOPES = ['runs:read', 'results:read']
@@ -64,7 +66,7 @@ def __init__(
6466
token_hash: str,
6567
token_prefix: str,
6668
scopes: List[str],
67-
expires_in_days: int = 30,
69+
expires_in_days: int = 7,
6870
) -> None:
6971
self.user_id = user_id
7072
self.token_name = token_name

mod_api/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def single_response(data, schema=None, http_status=200):
5151
return response
5252

5353

54-
def get_sort_column(sort_param, model, column_map):
54+
def get_sort_column(sort_param, column_map):
5555
"""
5656
Translate a validated sort string (e.g. '-created_at') into an
5757
SQLAlchemy order_by clause.

run.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,5 @@ def teardown(exception: Optional[Exception]):
276276

277277
# REST API v1
278278
from mod_api import mod_api
279+
279280
app.register_blueprint(mod_api, url_prefix='/api/v1')

0 commit comments

Comments
 (0)