Skip to content

Commit

Permalink
Black reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Jun 10, 2024
1 parent 4262e81 commit 04f9e47
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 31 deletions.
30 changes: 15 additions & 15 deletions src/dsmr_consumption/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -485,22 +485,22 @@ def day_consumption(day: datetime.date) -> Dict:
consumption["total_cost"] = round_decimal(consumption["total_cost"])

# Current prices as well.
consumption[
"energy_supplier_price_electricity_delivered_1"
] = daily_energy_price.electricity_delivered_1_price
consumption[
"energy_supplier_price_electricity_delivered_2"
] = daily_energy_price.electricity_delivered_2_price
consumption[
"energy_supplier_price_electricity_returned_1"
] = daily_energy_price.electricity_returned_1_price
consumption[
"energy_supplier_price_electricity_returned_2"
] = daily_energy_price.electricity_returned_2_price
consumption["energy_supplier_price_electricity_delivered_1"] = (
daily_energy_price.electricity_delivered_1_price
)
consumption["energy_supplier_price_electricity_delivered_2"] = (
daily_energy_price.electricity_delivered_2_price
)
consumption["energy_supplier_price_electricity_returned_1"] = (
daily_energy_price.electricity_returned_1_price
)
consumption["energy_supplier_price_electricity_returned_2"] = (
daily_energy_price.electricity_returned_2_price
)
consumption["energy_supplier_price_gas"] = daily_energy_price.gas_price
consumption[
"energy_supplier_price_fixed_daily_cost"
] = daily_energy_price.fixed_daily_cost
consumption["energy_supplier_price_fixed_daily_cost"] = (
daily_energy_price.fixed_daily_cost
)

# Any notes of that day.
consumption["notes"] = Note.objects.filter(day=day).values_list(
Expand Down
6 changes: 3 additions & 3 deletions src/dsmr_datalogger/services/datalogger.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ def _map_telegram_to_model(parsed_telegram: Dict, data: str):
"dsmr_version"
].startswith("5")

model_fields[
"extra_device_timestamp"
] = calculate_fake_gas_reading_timestamp(now=now, is_dsmr_v5=is_v5)
model_fields["extra_device_timestamp"] = (
calculate_fake_gas_reading_timestamp(now=now, is_dsmr_v5=is_v5)
)

# Fix for rare smart meters with a timestamp in the far future. We should disallow that.
discard_after = timezone.now() + timezone.timedelta(hours=24)
Expand Down
6 changes: 3 additions & 3 deletions src/dsmr_frontend/views/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class About(ConfigurableLoginRequiredMixin, TemplateView):

def get_context_data(self, **kwargs):
context_data = super(About, self).get_context_data(**kwargs)
context_data[
"monitoring_issues"
] = dsmr_backend.services.backend.request_monitoring_status()
context_data["monitoring_issues"] = (
dsmr_backend.services.backend.request_monitoring_status()
)
context_data["frontend_settings"] = FrontendSettings.get_solo()
return context_data

Expand Down
6 changes: 3 additions & 3 deletions src/dsmr_frontend/views/energy_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ def get_context_data(self, **kwargs):

context_data["capabilities"] = dsmr_backend.services.backend.get_capabilities()
context_data["frontend_settings"] = FrontendSettings.get_solo()
context_data[
"energy_contracts"
] = dsmr_consumption.services.summarize_energy_contracts()
context_data["energy_contracts"] = (
dsmr_consumption.services.summarize_energy_contracts()
)

return context_data
6 changes: 3 additions & 3 deletions src/dsmr_frontend/views/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ class Statistics(ConfigurableLoginRequiredMixin, TemplateView):
def get_context_data(self, **kwargs):
context_data = super(Statistics, self).get_context_data(**kwargs)
context_data["capabilities"] = dsmr_backend.services.backend.get_capabilities()
context_data[
"electricity_statistics"
] = ElectricityStatistics.get_solo().export()
context_data["electricity_statistics"] = (
ElectricityStatistics.get_solo().export()
)
context_data["frontend_settings"] = FrontendSettings.get_solo()

try:
Expand Down
6 changes: 3 additions & 3 deletions src/dsmr_frontend/views/support.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class Support(LoginRequiredMixin, TemplateView):

def get_context_data(self, **kwargs):
context_data = super(Support, self).get_context_data(**kwargs)
context_data[
"monitoring_issues"
] = dsmr_backend.services.backend.request_monitoring_status()
context_data["monitoring_issues"] = (
dsmr_backend.services.backend.request_monitoring_status()
)
context_data["frontend_settings"] = FrontendSettings.get_solo()
return context_data

Expand Down
1 change: 1 addition & 0 deletions src/dsmr_plugins/modules/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""

from django.utils.version import get_version


Expand Down
5 changes: 4 additions & 1 deletion src/dsmr_stats/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,10 @@ def clear_statistics() -> None:

def electricity_tariff_percentage(start: date, end: date) -> Optional[Dict]:
"""Returns the total electricity consumption percentage by tariff (high/low tariff)."""
totals = DayStatistics.objects.filter(day__gte=start, day__lte=end,).aggregate(
totals = DayStatistics.objects.filter(
day__gte=start,
day__lte=end,
).aggregate(
electricity1=Sum("electricity1"),
electricity2=Sum("electricity2"),
)
Expand Down

0 comments on commit 04f9e47

Please sign in to comment.