uselotus / lotus

File .deepsource.toml not found in the default branch of the repository root. Please refer to the docs.

Dangerous default argument PYL-W0102
Bug risk
Critical
a year agoa year old
Dangerous default value [] as argument
 411        end_date,
 412        granularity,
 413        customer=None,
 414        group_by=[], 415        proration=None,
 416    ) -> dict[Customer.customer_name, dict[datetime.datetime, float]]:
 417        from metering_billing.billable_metrics import METRIC_HANDLER_MAP
Dangerous default value [] as argument
 444        return usage
 445
 446    def get_earned_usage_per_day(
 447        self, start, end, customer, group_by=[], proration=None 448    ):
 449        from metering_billing.billable_metrics import METRIC_HANDLER_MAP
 450
Dangerous default value [] as argument
  75    def get_current_usage(
  76        self,
  77        subscription: Subscription,
  78        group_by: list[str] = [],  79    ) -> float:
  80        """This method will be used to calculate how much usage a customer currently has on a subscription. THough there are cases where get_usage and get_current_usage will be the same, there are cases where they will not. For example, if your billable metric is Stateful with a Max aggregation, then your usage over some period will be the max over past readings, but your current usage will be the latest reading."""
  81        pass
Dangerous default value [] as argument
  86        start: datetime.date,
  87        end: datetime.date,
  88        customer: Customer,
  89        group_by: list[str] = [],  90        proration: Optional[METRIC_GRANULARITY] = None,
  91    ) -> dict[datetime.datetime, float]:
  92        """This method will be used when calculating a concept known as "earned revenue" which is very important in accounting. It essentially states that revenue is "earned" not when someone pays, but when you deliver the goods/services at a previously agreed upon price. To accurately calculate accounting metrics, we will need to be able to tell for a given susbcription, where each cent of revenue came from, and the first step for that is to calculate how much billable usage was delivered each day. This method will be used to calculate that.
Dangerous default value [] as argument
  95        pass
  96
  97    @abc.abstractmethod
  98    def _build_filter_kwargs(self, start, end, customer, group_by=[]):  99        """This method will be used to build the filter args for the get_usage and get_earned_usage_per_day methods. You should build the filter args for the Event model, and return them as a dictionary. You should also handle the case where customer is None, which means that you should return the usage for all customers."""
 100        now = now_utc()
 101        filter_kwargs = {