mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-06 11:23:48 -05:00
isort .
This commit is contained in:
@@ -79,9 +79,6 @@ def handle_pagination(jobs, service_id, page):
|
||||
return prev_page, next_page, pagination
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def get_job_statistics(job, status):
|
||||
statistics = job.get("statistics", [])
|
||||
for stat in statistics:
|
||||
|
||||
@@ -2,11 +2,11 @@ from flask import abort, flash, redirect, render_template, session, url_for
|
||||
from flask_login import current_user
|
||||
from markupsafe import Markup
|
||||
|
||||
from app.enums import InvitedOrgUserStatus, InvitedUserStatus
|
||||
from app.main import main
|
||||
from app.models.organization import Organization
|
||||
from app.models.service import Service
|
||||
from app.models.user import InvitedOrgUser, InvitedUser, OrganizationUsers, User, Users
|
||||
from app.enums import InvitedUserStatus, InvitedOrgUserStatus
|
||||
|
||||
|
||||
@main.route("/invitation/<token>")
|
||||
|
||||
@@ -21,6 +21,7 @@ from app import (
|
||||
organizations_client,
|
||||
service_api_client,
|
||||
)
|
||||
from app.enums import VerificationStatus
|
||||
from app.event_handlers import (
|
||||
create_archive_service_event,
|
||||
create_resume_service_event,
|
||||
@@ -52,7 +53,6 @@ from app.utils import DELIVERED_STATUSES, FAILURE_STATUSES, SENDING_STATUSES
|
||||
from app.utils.time import parse_naive_dt
|
||||
from app.utils.user import user_has_permissions, user_is_platform_admin
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from app.enums import VerificationStatus
|
||||
|
||||
PLATFORM_ADMIN_SERVICE_PERMISSIONS = OrderedDict(
|
||||
[
|
||||
|
||||
@@ -5,6 +5,7 @@ from flask import abort, current_app, request, session
|
||||
from flask_login import AnonymousUserMixin, UserMixin, login_user, logout_user
|
||||
from werkzeug.utils import cached_property
|
||||
|
||||
from app.enums import InvitedUserStatus
|
||||
from app.event_handlers import (
|
||||
create_add_user_to_service_event,
|
||||
create_set_user_permissions_event,
|
||||
@@ -22,7 +23,6 @@ from app.utils.user_permissions import (
|
||||
translate_permissions_from_db_to_ui,
|
||||
)
|
||||
from notifications_python_client.errors import HTTPError
|
||||
from app.enums import InvitedUserStatus
|
||||
|
||||
|
||||
def _get_service_id_from_view_args():
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
||||
from app.enums import ApiKeyType
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
||||
|
||||
# must match key types in notifications-api/app/models.py
|
||||
KEY_TYPE_NORMAL = ApiKeyType.NORMAL
|
||||
|
||||
@@ -5,13 +5,13 @@ from urllib.parse import unquote
|
||||
from flask import current_app, request
|
||||
|
||||
from app import redis_client
|
||||
from app.enums import InvitedUserStatus
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||
from app.utils.user_permissions import (
|
||||
all_ui_permissions,
|
||||
translate_permissions_from_ui_to_db,
|
||||
)
|
||||
from notifications_utils.url_safe_token import generate_token
|
||||
from app.enums import InvitedUserStatus
|
||||
|
||||
|
||||
class InviteApiClient(NotifyAdminAPIClient):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import datetime
|
||||
from zoneinfo import ZoneInfo
|
||||
|
||||
from app.enums import JobStatus
|
||||
from app.extensions import redis_client
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user, cache
|
||||
from app.utils.csv import get_user_preferred_timezone
|
||||
from app.enums import JobStatus
|
||||
|
||||
|
||||
class JobApiClient(NotifyAdminAPIClient):
|
||||
@@ -58,7 +58,7 @@ class JobApiClient(NotifyAdminAPIClient):
|
||||
job["original_file_name"],
|
||||
)
|
||||
for job in self.get_jobs(service_id, limit_days=0)["data"]
|
||||
if job["job_status"] != JobStatus.CANCELLED.value
|
||||
if job["job_status"] != JobStatus.CANCELLED
|
||||
)
|
||||
|
||||
def get_page_of_jobs(self, service_id, *, page, statuses=None, limit_days=None):
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
||||
from app.enums import InvitedOrgUserStatus
|
||||
from app.notify_client import NotifyAdminAPIClient, _attach_current_user
|
||||
|
||||
|
||||
class OrgInviteApiClient(NotifyAdminAPIClient):
|
||||
|
||||
@@ -7,16 +7,21 @@ from ordered_set import OrderedSet
|
||||
from werkzeug.datastructures import MultiDict
|
||||
from werkzeug.routing import RequestRedirect
|
||||
|
||||
from app.enums import NotificationStatus
|
||||
from notifications_utils.field import Field
|
||||
|
||||
SENDING_STATUSES = ["created", "pending", "sending"]
|
||||
DELIVERED_STATUSES = ["delivered", "sent"]
|
||||
SENDING_STATUSES = [
|
||||
NotificationStatus.CREATED,
|
||||
NotificationStatus.PENDING,
|
||||
NotificationStatus.SENDING,
|
||||
]
|
||||
DELIVERED_STATUSES = [NotificationStatus.DELIVERED, NotificationStatus.SENT]
|
||||
FAILURE_STATUSES = [
|
||||
"failed",
|
||||
"temporary-failure",
|
||||
"permanent-failure",
|
||||
"technical-failure",
|
||||
"validation-failed",
|
||||
NotificationStatus.FAILED,
|
||||
NotificationStatus.TEMPORARY_FAILURE,
|
||||
NotificationStatus.PERMANENT_FAILURE,
|
||||
NotificationStatus.TECHNICAL_FAILURE,
|
||||
NotificationStatus.VALIDATION_FAILED,
|
||||
]
|
||||
REQUESTED_STATUSES = SENDING_STATUSES + DELIVERED_STATUSES + FAILURE_STATUSES
|
||||
|
||||
|
||||
Reference in New Issue
Block a user