From 5242831443f85240d8a0d7183a7009ce0a2cabc5 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Apr 2023 19:48:22 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pvoutput/mapscraper.py | 2 +- pvoutput/prcoess.py | 1 - pvoutput/pvoutput.py | 4 +--- scripts/fetch_pv_timeseries.py | 11 ++++++----- scripts/scrape_country_codes.py | 2 -- tests/test_process.py | 1 - 6 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pvoutput/mapscraper.py b/pvoutput/mapscraper.py index c64f1f1..8243adb 100644 --- a/pvoutput/mapscraper.py +++ b/pvoutput/mapscraper.py @@ -273,7 +273,6 @@ def _convert_metadata_cols_to_numeric(df: pd.DataFrame) -> pd.DataFrame: def _process_output_col(soup: BeautifulSoup, index: Optional[Iterable] = None) -> pd.Series: - # get all data outputs_col = soup.find_all(text=re.compile(r"\d Days")) @@ -350,6 +349,7 @@ def clean_soup(soup): """Function to clean scraped soup object. Note that the downloaded soup could change over time. + Args: soup: bs4.BeautifulSoup diff --git a/pvoutput/prcoess.py b/pvoutput/prcoess.py index 435a96f..c83e52d 100644 --- a/pvoutput/prcoess.py +++ b/pvoutput/prcoess.py @@ -44,7 +44,6 @@ def process_system_status(pv_system_status_text, date) -> pd.DataFrame: ).sort_index() except Exception as e: - # this can happen if there is only one data value and it doesnt contain all 5 columns. # if there is many rows of data, then it seems fine if pv_system_status_text.count(";") != 0: diff --git a/pvoutput/pvoutput.py b/pvoutput/pvoutput.py index 0e4ea35..b7e7f76 100644 --- a/pvoutput/pvoutput.py +++ b/pvoutput/pvoutput.py @@ -340,7 +340,6 @@ def get_system_status( pv_system_status = [] for pv_system_status_text in pv_systems_status_text: - try: one_pv_system_status = process_system_status( pv_system_status_text=pv_system_status_text, date=date @@ -924,7 +923,7 @@ def _download_multiple_worker( ) else: total_rows += len(timeseries) - _LOG.info(f'Adding timezone {timezone} to {total_rows} rows') + _LOG.info(f"Adding timezone {timezone} to {total_rows} rows") timeseries = timeseries.tz_localize(timezone) _LOG.info( "system_id: %d: %d rows retrieved: %s to %s", @@ -1193,7 +1192,6 @@ def check_pv_system_status(pv_system_status: pd.DataFrame, requested_date: date) def _append_missing_date_range( output_filename, pv_system_id, missing_start_date, missing_end_date, datetime_of_api_request ): - data = { "missing_start_date_PV_localtime": pd.Timestamp(missing_start_date), "missing_end_date_PV_localtime": pd.Timestamp(missing_end_date), diff --git a/scripts/fetch_pv_timeseries.py b/scripts/fetch_pv_timeseries.py index ac7d4a6..39b6eda 100644 --- a/scripts/fetch_pv_timeseries.py +++ b/scripts/fetch_pv_timeseries.py @@ -21,14 +21,15 @@ or create and use a ~/.pvoutput.yml file as described in the PVOutput library documentation """ -from pvoutput import * - -import click as cl import datetime as dt +import logging +import pathlib import sys + +import click as cl import pandas as pd -import pathlib -import logging + +from pvoutput import * @cl.command() diff --git a/scripts/scrape_country_codes.py b/scripts/scrape_country_codes.py index 5dd3ec2..fd66178 100644 --- a/scripts/scrape_country_codes.py +++ b/scripts/scrape_country_codes.py @@ -13,7 +13,6 @@ def get_country_name(manager: urllib3.PoolManager, code: int) -> str: - country_url = f"{COUNTRY_PAGES}{code}" response = manager.request("GET", country_url) @@ -25,7 +24,6 @@ def get_country_name(manager: urllib3.PoolManager, code: int) -> str: def get_all_countries() -> None: - output_dict = {} manager = urllib3.PoolManager() diff --git a/tests/test_process.py b/tests/test_process.py index 0efaf22..6dabf22 100644 --- a/tests/test_process.py +++ b/tests/test_process.py @@ -28,7 +28,6 @@ def test_process_system_status_2(): def test_process_system_status_none(): - one_status = process_system_status( pv_system_status_text="no status found", date=date(2022, 1, 1) )