Skip to content

Commit

Permalink
Code Reformating
Browse files Browse the repository at this point in the history
  • Loading branch information
stuartcampbell committed Nov 1, 2024
1 parent 91d7c81 commit c41e4aa
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions src/nsls2api/api/v1/beamline_api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import fastapi
from fastapi import HTTPException, Depends, Request
from fastapi import Depends, HTTPException, Request
from fastapi.security.api_key import APIKey

from nsls2api.api.models.proposal_model import (
Expand Down Expand Up @@ -27,7 +27,8 @@ async def details(name: str):
beamline = await beamline_service.beamline_by_name(name)
if beamline is None:
raise HTTPException(
status_code=fastapi.status.HTTP_404_NOT_FOUND, detail=f"Beamline '{name}' does not exist"
status_code=fastapi.status.HTTP_404_NOT_FOUND,
detail=f"Beamline '{name}' does not exist",
)
return beamline

Expand All @@ -37,19 +38,21 @@ async def get_beamline_accounts(name: str, api_key: APIKey = Depends(get_current
service_accounts = await beamline_service.service_accounts(name)
if service_accounts is None:
raise HTTPException(
status_code=fastapi.status.HTTP_404_NOT_FOUND, detail=f"Beamline '{name}' does not exist"
status_code=fastapi.status.HTTP_404_NOT_FOUND,
detail=f"Beamline '{name}' does not exist",
)
return service_accounts


@router.get("/beamline/{name}/slack-channel-managers")
async def get_beamline_slack_channel_managers(
name: str, api_key: APIKey = Depends(get_current_user)
name: str, api_key: APIKey = Depends(get_current_user)
):
slack_channel_managers = await beamline_service.slack_channel_managers(name)
if slack_channel_managers is None:
raise HTTPException(
status_code=fastapi.status.HTTP_404_NOT_FOUND, detail=f"Beamline named {name} could not be found"
status_code=fastapi.status.HTTP_404_NOT_FOUND,
detail=f"Beamline named {name} could not be found",
)
return slack_channel_managers

Expand Down Expand Up @@ -82,15 +85,15 @@ async def get_beamline_detectors(name: str) -> DetectorList:
dependencies=[Depends(validate_admin_role)],
)
async def add_or_delete_detector(
request: Request, name: str, detector_name: str, detector: Detector | None = None
request: Request, name: str, detector_name: str, detector: Detector | None = None
):
if request.method == "PUT":
logger.info(f"Adding detector {detector_name} to beamline {name}")

if not detector:
raise HTTPException(
status_code=fastapi.status.HTTP_422_UNPROCESSABLE_ENTITY,
detail=f"No detector information supplied in request body.",
detail="No detector information supplied in request body.",
)
if detector_name != detector.name:
raise HTTPException(
Expand Down Expand Up @@ -235,7 +238,8 @@ async def get_beamline_services(name: str):
beamline_services = await beamline_service.all_services(name)
if beamline_services is None:
raise HTTPException(
status_code=fastapi.status.HTTP_404_NOT_FOUND, detail=f"Beamline named {name} could not be found"
status_code=fastapi.status.HTTP_404_NOT_FOUND,
detail=f"Beamline named {name} could not be found",
)
return beamline_services

Expand Down

0 comments on commit c41e4aa

Please sign in to comment.