Skip to content

Commit

Permalink
Drop "deprecated" package #1594
Browse files Browse the repository at this point in the history
  • Loading branch information
dennissiemensma committed Jun 10, 2024
1 parent c220a9c commit b889232
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
10 changes: 0 additions & 10 deletions src/dsmr_consumption/models/consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _
from deprecated import deprecated

from dsmr_backend.mixins import ModelUpdateMixin


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
class ElectricityConsumption(ModelUpdateMixin, models.Model):
"""Point in time of electricity consumption (usage), extracted from reading(s)."""

Expand Down Expand Up @@ -165,9 +161,6 @@ class Meta:
verbose_name_plural = verbose_name


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
class GasConsumption(ModelUpdateMixin, models.Model):
"""Interpolated gas reading, containing the actual usage, based on the reading before (if any)."""

Expand Down Expand Up @@ -195,9 +188,6 @@ class Meta:
verbose_name_plural = verbose_name


@deprecated(
reason="Custom calculated quarter-hour peak consumption should eventually DROPPED in favor of DSMR P1 data (#1764)."
)
class QuarterHourPeakElectricityConsumption(ModelUpdateMixin, models.Model):
"""Average consumption calculated over a ~15 minute period."""

Expand Down
24 changes: 0 additions & 24 deletions src/dsmr_consumption/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from django.db.models import Avg, Min, Max, Count, Manager
from django.db.utils import IntegrityError
from django.utils import timezone, formats
from deprecated import deprecated

from dsmr_backend.models.schedule import ScheduledProcess
from dsmr_consumption.exceptions import CompactorNotReadyError
Expand All @@ -32,9 +31,6 @@
logger = logging.getLogger("dsmrreader")


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
def run(scheduled_process: ScheduledProcess) -> None:
"""Compacts all unprocessed readings, capped by a max to prevent hanging backend."""
for current_reading in DsmrReading.objects.unprocessed()[
Expand All @@ -50,9 +46,6 @@ def run(scheduled_process: ScheduledProcess) -> None:
scheduled_process.delay(seconds=1)


@deprecated(
reason="Custom calculated quarter-hour peak consumption should eventually DROPPED in favor of DSMR P1 data (#1764)."
)
def run_quarter_hour_peaks(scheduled_process: ScheduledProcess) -> None:
"""Calculates the quarter-hour peak consumption. For background info see issues #1084 / #1635."""
MINUTE_INTERVAL = 15
Expand Down Expand Up @@ -175,9 +168,6 @@ def run_quarter_hour_peaks(scheduled_process: ScheduledProcess) -> None:
)


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
def compact(dsmr_reading: DsmrReading) -> None:
"""Compacts/converts DSMR readings to consumption data. Optionally groups electricity by minute."""
consumption_settings = ConsumptionSettings.get_solo()
Expand Down Expand Up @@ -221,9 +211,6 @@ def compact(dsmr_reading: DsmrReading) -> None:
logger.debug("Compact: Processed reading: %s", dsmr_reading)


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
def _compact_electricity(
dsmr_reading: DsmrReading,
electricity_grouping_type: int,
Expand Down Expand Up @@ -318,9 +305,6 @@ def _compact_electricity(
)


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
def _compact_gas(dsmr_reading: DsmrReading, gas_grouping_type: int) -> None:
"""
Compacts any DSMR readings to gas consumption records, optionally grouped. Only when there is support for gas.
Expand Down Expand Up @@ -371,9 +355,6 @@ def _compact_gas(dsmr_reading: DsmrReading, gas_grouping_type: int) -> None:
)


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
def consumption_by_range(start, end) -> Tuple[Manager, Manager]:
"""Calculates the consumption of a range specified."""
electricity_readings = ElectricityConsumption.objects.filter(
Expand All @@ -389,9 +370,6 @@ def consumption_by_range(start, end) -> Tuple[Manager, Manager]:
return electricity_readings, gas_readings


@deprecated(
reason="Consumption data models should be DROPPED in the future in favor of the reading models."
)
def day_consumption(day: datetime.date) -> Dict:
"""Calculates the consumption of an entire day."""
consumption = {"day": day}
Expand Down Expand Up @@ -644,7 +622,6 @@ def round_decimal(value, decimal_count: int = 2) -> Decimal:
)


@deprecated(reason="Legacy calculate_slumber_consumption_watt() seems unused, drop it?")
def calculate_slumber_consumption_watt() -> Optional[int]:
"""Groups all electricity readings to find the most constant consumption."""
most_common = (
Expand All @@ -668,7 +645,6 @@ def calculate_slumber_consumption_watt() -> Optional[int]:
return round(usage / count * 1000)


@deprecated(reason="Legacy calculate_min_max_consumption_watt() seems unused, drop it?")
def calculate_min_max_consumption_watt() -> Dict:
"""Returns the lowest and highest Wattage consumed for each phase."""
FIELDS = {
Expand Down

0 comments on commit b889232

Please sign in to comment.