File tree Expand file tree Collapse file tree 8 files changed +10
-13
lines changed
Expand file tree Collapse file tree 8 files changed +10
-13
lines changed Original file line number Diff line number Diff line change 22# ruff: noqa: S311
33
44import datetime as dt
5- from uuid import UUID
65import math
76import random
8- from uuid import uuid4
7+ from uuid import UUID , uuid4
98
109from typing_extensions import override
1110
Original file line number Diff line number Diff line change @@ -456,12 +456,12 @@ def check_user_has_access_to_site(
456456) -> None :
457457 """Checks if a user has access to a site."""
458458 user = get_user_by_email (session = session , email = email )
459- site_uuids = [str ( site .location_uuid ) for site in user .location_group .locations ]
459+ site_uuids = [site .location_uuid for site in user .location_group .locations ]
460460
461461 if site_uuid not in site_uuids :
462462 raise HTTPException (
463463 status_code = 403 ,
464464 detail = f"Forbidden. User ({ email } ) "
465- f"does not have access to this site { str ( site_uuid ) } . "
466- f"User has access to { site_uuids } " ,
465+ f"does not have access to this site { site_uuid !s } . "
466+ f"User has access to { [ str ( s ) for s in site_uuids ] } " ,
467467 )
Original file line number Diff line number Diff line change 22
33import datetime as dt
44import logging
5+ from collections .abc import Generator
56
67import pytest
78from pvsite_datamodel .read .model import get_or_create_model
1617from sqlalchemy import Engine , create_engine
1718from sqlalchemy .orm import Session
1819from testcontainers .postgres import PostgresContainer
19- from collections .abc import Generator
2020
2121log = logging .getLogger (__name__ )
2222
Original file line number Diff line number Diff line change 55import logging
66
77import pytest
8- from pvsite_datamodel .sqlmodels import LocationSQL , GenerationSQL
98from fastapi import HTTPException
9+ from pvsite_datamodel .sqlmodels import GenerationSQL , LocationSQL
1010from sqlalchemy import Engine
1111from sqlalchemy .orm import Session
1212
Original file line number Diff line number Diff line change 66import jwt
77from fastapi import Depends , HTTPException , Request
88from fastapi .security import HTTPAuthorizationCredentials , HTTPBearer
9- from typing_extensions import override
109
1110token_auth_scheme = HTTPBearer ()
1211
Original file line number Diff line number Diff line change 22
33import datetime as dt
44from enum import Enum
5- from typing import Literal
6- from typing import Annotated
5+ from typing import Annotated , Literal
76from uuid import UUID
87from zoneinfo import ZoneInfo
9- from fastapi import Depends
108
9+ from fastapi import Depends
1110from pydantic import BaseModel , Field
1211
1312
Original file line number Diff line number Diff line change 88
99
1010# NOTE: We should probably make this take a timezone argument.
11- # This would mean changing the column names, so I'm leaving it for now,
11+ # This would mean changing the column names, so I'm leaving it for now,
1212# as I don't know whether this would affect clients.
1313def format_csv_and_created_time (
1414 values : list [PredictedPower ],
Original file line number Diff line number Diff line change 1- import unittest
21import datetime as dt
2+ import unittest
33
44from quartz_api .internal .models import ActualPower
55
You can’t perform that action at this time.
0 commit comments