uselotus / lotus

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

Consider using in PYL-R1714
Performance
Major
a year agoa year old
Consider merging these comparisons with 'in' by using 'granularity in (USAGE_CALC_GRANULARITY.DAILY, METRIC_GRANULARITY.DAY)'. Use a set instead if elements are hashable.
151            normalize_rd = relativedelta(minute=0, second=0, microsecond=0)
152            rd = relativedelta(hours=+1)
153        elif (
154            granularity == USAGE_CALC_GRANULARITY.DAILY155            or granularity == METRIC_GRANULARITY.DAY
156        ):
157            normalize_rd = relativedelta(hour=0, minute=0, second=0, microsecond=0)
Consider merging these comparisons with 'in' by using 'self.secret_key not in ('', None)'. Use a set instead if elements are hashable.
125            self.redirect_url = ""
126
127    def working(self) -> bool:
128        return self.secret_key != "" and self.secret_key != None129
130    def customer_connected(self, customer) -> bool:
131        pp_ids = customer.integrations
Consider merging these comparisons with 'in' by using 'self.secret_key not in ('', None)'. Use a set instead if elements are hashable.
135
136    def organization_connected(self, organization) -> bool:
137        if self.self_hosted:
138            return self.secret_key != "" and self.secret_key != None139        else:
140            return (
141                organization.payment_provider_ids.get(PAYMENT_PROVIDERS.STRIPE, "")
Consider merging these comparisons with 'in' by using 'METRIC_GRANULARITY.SECOND in (self.granularity, proration)'. Use a set instead if elements are hashable.
 158            kind = None
 159            granularity = None
 160            if (
 161                self.granularity == METRIC_GRANULARITY.SECOND 162                or proration == METRIC_GRANULARITY.SECOND
 163            ):
 164                kind = "second"
Consider merging these comparisons with 'in' by using 'METRIC_GRANULARITY.MINUTE in (self.granularity, proration)'. Use a set instead if elements are hashable.
 164                kind = "second"
 165                granularity = METRIC_GRANULARITY.SECOND
 166            elif (
 167                self.granularity == METRIC_GRANULARITY.MINUTE 168                or proration == METRIC_GRANULARITY.MINUTE
 169            ):
 170                kind = "minute"