Skip to content

Commit

Permalink
style(api): format files
Browse files Browse the repository at this point in the history
  • Loading branch information
fschuch committed Mar 26, 2024
1 parent 05acff4 commit df8d93f
Show file tree
Hide file tree
Showing 29 changed files with 33 additions and 14 deletions.
1 change: 1 addition & 0 deletions jobbergate-api/alembic/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from jobbergate_api.apps.job_submissions import models # noqa # must be imported for metadata to work
from jobbergate_api.apps.models import Base
from jobbergate_api.apps.job_script_templates import models # noqa # must be imported for metadata to work

# from jobbergate_api.metadata import (
# metadata as jobbergate_api_metadata,
# ) # noqa # must be imported for metadata to work
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-01-04 18:26:46.943872
"""

import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from alembic import op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
Create Date: 2024-01-30 10:52:38.671713
"""

import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/dev_tools/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provide helper commands for local development.
"""

import typer

from dev_tools import db, dev_server, show_env
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/dev_tools/dev_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provide command for starting a local development server for the API.
"""

from time import sleep

import typer
Expand Down
5 changes: 2 additions & 3 deletions jobbergate-api/dev_tools/show_env.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provide command for showing the current environment.
"""

import json

import typer
Expand All @@ -19,8 +20,6 @@ def show_env(use_json: bool = typer.Option(False, "--json", help="Dump as JSON")
output = json.dumps(settings.dict())
else:
output = "\n ".join(
["Jobbergate settings:"] + [
f"{k}: {v}" for (k, v) in settings.dict().items()
],
["Jobbergate settings:"] + [f"{k}: {v}" for (k, v) in settings.dict().items()],
)
print(output)
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/apps/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
Note:
The dependencies can be reused multiple times, since FastAPI caches the results.
"""

from contextlib import asynccontextmanager, contextmanager
from dataclasses import dataclass
from itertools import chain
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/apps/file_validation.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Validation methods for the uploaded files.
"""

from ast import parse as ast_parse
from functools import wraps
from pathlib import PurePath
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/apps/garbage_collector.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Delete unused files from jobbergate's file storage."""

from fastapi import BackgroundTasks
from loguru import logger
from sqlalchemy import select
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,7 @@ async def job_script_workflow_get_file(
)
async def job_script_workflow_upload_file(
id_or_identifier: int | str = Path(),
runtime_config: RunTimeConfig
| None = Body(
runtime_config: RunTimeConfig | None = Body(
None, description="Runtime configuration is optional when the workflow file already exists"
),
upload_file: UploadFile = File(..., description="File to upload"),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Services for the job_script_templates resource, including module specific business logic."""

from typing import Any

from buzz import require_condition
Expand Down
4 changes: 2 additions & 2 deletions jobbergate-api/jobbergate_api/apps/job_scripts/routers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Router for the Job Script Template resource."""

from typing import cast

from buzz import handle_errors
Expand Down Expand Up @@ -202,8 +203,7 @@ async def job_script_get(
)
async def job_script_get_list(
list_params: ListParams = Depends(),
from_job_script_template_id: int
| None = Query(
from_job_script_template_id: int | None = Query(
None,
description="Filter job-scripts by the job-script-template-id they were created from.",
),
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/apps/job_scripts/schemas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
JobScript resource schema.
"""

from datetime import datetime
from textwrap import dedent
from typing import Any
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/apps/job_scripts/services.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Services for the job_scripts resource, including module specific business logic."""

from typing import Any, NamedTuple

from buzz import enforce_defined, require_condition
Expand Down
9 changes: 3 additions & 6 deletions jobbergate-api/jobbergate_api/apps/job_submissions/routers.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,15 @@ async def job_submission_get(
)
async def job_submission_get_list(
list_params: ListParams = Depends(),
slurm_job_ids: str
| None = Query(
slurm_job_ids: str | None = Query(
None,
description="Comma-separated list of slurm-job-ids to match active job_submissions",
),
submit_status: JobSubmissionStatus
| None = Query(
submit_status: JobSubmissionStatus | None = Query(
None,
description="Limit results to those with matching status",
),
from_job_script_id: int
| None = Query(
from_job_script_id: int | None = Query(
None,
description="Filter job-submissions by the job-script-id they were created from.",
),
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Pull settings from environment variables or a .env file if available.
"""

from enum import Enum
from typing import Optional

Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/email_notification.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Email notification system for Jobbergate.
"""

from dataclasses import dataclass
from typing import List, Optional, Union

Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Main file to startup the fastapi server.
"""

from contextlib import asynccontextmanager

import asyncpg
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/jobbergate_api/security.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Also provides a factory function for TokenSecurity to reduce boilerplate.
"""

from armasec import Armasec, TokenPayload
from armasec.schemas import DomainConfig
from armasec.token_security import PermissionMode
Expand Down
2 changes: 1 addition & 1 deletion jobbergate-api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ dev-tools = "dev_tools:app"

[tool.black]
line-length = 110
target-versions = ["py38", "py39", "py310"]
target-version = ["py38", "py39", "py310"]

[tool.isort]
line_length = 110
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the router for the Job Script Template resource."""

import json

import pytest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Database models for the smart template resource."""

from typing import Any

import pytest
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/apps/job_scripts/test_routers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests for the /job-scripts/ endpoint."""

import pytest
from fastapi import HTTPException, status
from loguru import logger
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/apps/job_scripts/test_services.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Database models for the job scripts resource."""

from itertools import product
from typing import Any

Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/apps/job_scripts/test_tools.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test job-script files.
"""

import snick

from jobbergate_api.apps.job_scripts.tools import inject_sbatch_params
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/apps/test_main.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Provide unit tests for the main app.
"""

import pytest
from fastapi import status
from httpx import AsyncClient
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/apps/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test the the models."""

import pytest
from sqlalchemy import String

Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/test_email_notification.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test the email notification system at Jobbergate.
"""

from unittest import mock

import pytest
Expand Down
1 change: 1 addition & 0 deletions jobbergate-api/tests/test_security.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Test the security module.
"""

from unittest.mock import patch

import pytest
Expand Down

0 comments on commit df8d93f

Please sign in to comment.