Skip to content

Commit

Permalink
Fix code style issues with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
lint-action committed Jan 27, 2024
1 parent 702df0f commit 0fe67d0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 21 deletions.
1 change: 1 addition & 0 deletions examples/main.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test-module for pyCheckwatt."""

import argparse
import json
import os
Expand Down
51 changes: 30 additions & 21 deletions pycheckwatt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@

_LOGGER = logging.getLogger(__name__)


Check failure on line 34 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L34

Expected 2 blank lines, found 1 (E302)
class CheckwattManager:
"""CheckWatt manager."""

Expand Down Expand Up @@ -288,7 +289,6 @@ async def get_customer_details(self):
except (ClientResponseError, ClientError) as error:
return await self.handle_client_error(endpoint, headers, error)


async def get_battery_peak_data(self):

Check failure on line 292 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L292

Too many blank lines (2) (E303)
"""Fetch battery peak data from CheckWatt."""
try:
Expand Down Expand Up @@ -332,8 +332,12 @@ async def get_battery_peak_data(self):
self.battery_charge_peak_ac = charging_meter.get("PeakAcKw")
print(self.battery_charge_peak_ac)
self.battery_charge_peak_dc = charging_meter.get("PeakDcKw")
self.battery_discharge_peak_ac = discharging_meter.get("PeakAcKw")
self.battery_discharge_peak_dc = discharging_meter.get("PeakDcKw")
self.battery_discharge_peak_ac = discharging_meter.get(

Check failure on line 335 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L335

Line too long (90 > 88 characters) (E501)
"PeakAcKw"

Check failure on line 336 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L336

Line too long (90 > 88 characters) (E501)
)
self.battery_discharge_peak_dc = discharging_meter.get(
"PeakDcKw"
)

return True

Expand All @@ -347,26 +351,25 @@ async def get_battery_peak_data(self):
except (ClientResponseError, ClientError) as error:
return await self.handle_client_error(endpoint, headers, error)

Check failure on line 353 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L353

Too many blank lines (4) (E303)



async def get_fcrd_month_net_revenue(self):
"""Fetch FCR-D revenues from checkwatt."""
misseddays = 0
try:
from_date = datetime.now().strftime("%Y-%m-01")
to_date = datetime.now() + timedelta(days=1)
# to_date = datetime.now()
# to_date = datetime.now()
to_date = to_date.strftime("%Y-%m-%d")
lastday_date = datetime.now() + relativedelta(months=1)

Check failure on line 362 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L362

Line too long (92 > 88 characters) (E501)
lastday_date = datetime(year=lastday_date.year, month=lastday_date.month, day=1)
lastday_date = datetime(
year=lastday_date.year, month=lastday_date.month, day=1
)

lastday_date = lastday_date - timedelta(days=1)

lastday = lastday_date.strftime("%d")

dayssofar = datetime.now()
# dayssofar = datetime.now() + timedelta(days=1)
# dayssofar = datetime.now() + timedelta(days=1)
dayssofar = dayssofar.strftime("%d")

daysleft = int(lastday) - int(dayssofar)
Expand All @@ -391,8 +394,9 @@ async def get_fcrd_month_net_revenue(self):
dayswithmoney = int(dayssofar) - int(misseddays)
if response.status == 200:

Check failure on line 395 in pycheckwatt/__init__.py

View check run for this annotation

GitHub Actions / Flake8

pycheckwatt/__init__.py#L395

Continuation line under-indented for visual indent (E128)
self.dailyaverage = self.revenuemonth / int(dayswithmoney)
self.monthestimate = ((self.dailyaverage * daysleft)
+ self.revenuemonth)
self.monthestimate = (
self.dailyaverage * daysleft
) + self.revenuemonth
return True

_LOGGER.error(
Expand Down Expand Up @@ -790,7 +794,12 @@ def battery_peak_data(self):
if self.battery_discharge_peak_dc is not None:
battery_discharge_peak_dc = self.battery_discharge_peak_dc

return battery_charge_peak_ac,battery_charge_peak_dc,battery_discharge_peak_ac,battery_discharge_peak_dc
return (
battery_charge_peak_ac,
battery_charge_peak_dc,
battery_discharge_peak_ac,
battery_discharge_peak_dc,
)

@property
def electricity_provider(self):
Expand Down Expand Up @@ -864,16 +873,16 @@ def fcrd_today_net_revenue(self):

return revenue

# @property
# def tomorrow_revenue(self):
# """Property for tomorrow's revenue."""
# revenue = 0
# if self.revenue is not None:
# if len(self.revenue) > 1:
# if "NetRevenue" in self.revenue[1]:
# revenue = self.revenue[1]["NetRevenue"]
# @property
# def tomorrow_revenue(self):
# """Property for tomorrow's revenue."""
# revenue = 0
# if self.revenue is not None:
# if len(self.revenue) > 1:
# if "NetRevenue" in self.revenue[1]:
# revenue = self.revenue[1]["NetRevenue"]

# return revenue
# return revenue

def _get_meter_total(self, meter_type):
"""Solar, Charging, Discharging, EDIEL_E17, EDIEL_E18, Soc meter summary."""
Expand Down
1 change: 1 addition & 0 deletions pycheckwatt/const.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Docstring."""

SENSOR = "SENSOR"


Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Setup script for pyCheckwatt module."""

from setuptools import find_packages, setup

MIN_PY_VERSION = "3.10"
Expand Down

0 comments on commit 0fe67d0

Please sign in to comment.