Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
peterdudfield committed Nov 13, 2024
1 parent fc929aa commit 3a5fed6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
24 changes: 11 additions & 13 deletions src/india_api/internal/inputs/indiadb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def get_predicted_power_production_for_location(
day_ahead_hours=day_ahead_hours,
day_ahead_timezone_delta_hours=day_ahead_timezone_delta_hours,
forecast_horizon_minutes=forecast_horizon_minutes,
model_name=ml_model_name
model_name=ml_model_name,
)
forecast_values: [ForecastValueSQL] = values[site.site_uuid]

Expand Down Expand Up @@ -187,16 +187,15 @@ def get_predicted_solar_power_production_for_location(
"""

# set this to be hard coded for now
model_name = 'pvnet_india'

model_name = "pvnet_india"

return self.get_predicted_power_production_for_location(
location=location,
asset_type=SiteAssetType.pv,
forecast_horizon=forecast_horizon,
forecast_horizon_minutes=forecast_horizon_minutes,
smooth_flag=smooth_flag,
model_name=model_name
model_name=model_name,
)

def get_predicted_wind_power_production_for_location(
Expand All @@ -217,7 +216,7 @@ def get_predicted_wind_power_production_for_location(
"""

# set this to be hard coded for now
model_name = 'windnet_india'
model_name = "windnet_india"

return self.get_predicted_power_production_for_location(
location=location,
Expand Down Expand Up @@ -273,13 +272,13 @@ def get_sites(self, email: str) -> list[internal.Site]:

return sites

def get_site_forecast(self, site_uuid: str, email:str) -> list[internal.PredictedPower]:
def get_site_forecast(self, site_uuid: str, email: str) -> list[internal.PredictedPower]:
"""Get a forecast for a site, this is for a solar site"""

# TODO feels like there is some duplicated code here which could be refactored

# hard coded model name
ml_model_name = 'pvnet_ad_sites'
ml_model_name = "pvnet_ad_sites"

# Get the window
start, _ = get_window()
Expand All @@ -291,10 +290,7 @@ def get_site_forecast(self, site_uuid: str, email:str) -> list[internal.Predicte
site_uuid = UUID(site_uuid)

values = get_latest_forecast_values_by_site(
session,
site_uuids=[site_uuid],
start_utc=start,
model_name=ml_model_name
session, site_uuids=[site_uuid], start_utc=start, model_name=ml_model_name
)
forecast_values: [ForecastValueSQL] = values[site_uuid]

Expand All @@ -312,7 +308,7 @@ def get_site_forecast(self, site_uuid: str, email:str) -> list[internal.Predicte

return values

def get_site_generation(self, site_uuid: str, email:str) -> list[internal.ActualPower]:
def get_site_generation(self, site_uuid: str, email: str) -> list[internal.ActualPower]:
"""Get the generation for a site, this is for a solar site"""

# TODO feels like there is some duplicated code here which could be refactored
Expand Down Expand Up @@ -344,7 +340,9 @@ def get_site_generation(self, site_uuid: str, email:str) -> list[internal.Actual

return values

def post_site_generation(self, site_uuid: str, generation: list[internal.ActualPower], email:str):
def post_site_generation(
self, site_uuid: str, generation: list[internal.ActualPower], email: str
):
"""Post generation for a site"""

with self._get_session() as session:
Expand Down
10 changes: 5 additions & 5 deletions src/india_api/internal/inputs/indiadb/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ def sites(db_session):
ml_id=1,
asset_type="pv",
country="india",
region='testID',
client_site_name='ruvnl_pv_testID1'
region="testID",
client_site_name="ruvnl_pv_testID1",
)
db_session.add(site)
sites.append(site)
Expand All @@ -80,16 +80,16 @@ def sites(db_session):
ml_id=2,
asset_type="wind",
country="india",
region='testID',
client_site_name = 'ruvnl_wind_testID'
region="testID",
client_site_name="ruvnl_wind_testID",
)
db_session.add(site)
sites.append(site)

db_session.commit()

# create user
user = get_user_by_email(session=db_session, email='[email protected]')
user = get_user_by_email(session=db_session, email="[email protected]")
user.site_group.sites = sites

db_session.commit()
Expand Down

0 comments on commit 3a5fed6

Please sign in to comment.