File .deepsource.toml
not found in the default branch of the repository root. Please refer to the docs.
112 date = convert_to_date(date)
113 if date in per_day_dict:
114 per_day_dict[date]["revenue"] += earned_revenue
115 return_dict[f"earned_revenue_period_{num}"] = sum( 116 [x["revenue"] for x in per_day_dict.values()]
117 )
118 serializer = PeriodMetricRevenueResponseSerializer(data=return_dict)
275 else:
276 seen_dict[sub["customer_name"]] = sub["new"]
277 return_dict[f"period_{i+1}_total_subscriptions"] = len(seen_dict)
278 return_dict[f"period_{i+1}_new_subscriptions"] = sum( 279 [1 for k, v in seen_dict.items() if v]
280 )
281 serializer = PeriodSubscriptionsResponseSerializer(data=return_dict)
808 },
809 status=status.HTTP_400_BAD_REQUEST,
810 )
811 num = sum([len(v) for v in num.values()]) 812 return Response(
813 {
814 "status": "success",
954 .annotate(num_customers=Count("customer"))
955 .order_by("-num_customers")
956 )
957 tot_plans = sum([plan["num_customers"] for plan in plans]) 958 plans = [
959 {**plan, "percent_total": plan["num_customers"] / tot_plans}
960 for plan in plans
1118 data = super().validate(data)
1119 if data.get("status") == PLAN_STATUS.ARCHIVED:
1120 versions_count = self.instance.active_subs_by_version()
1121 cnt = sum([version.active_subscriptions for version in versions_count])1122 if cnt > 0:
1123 raise serializers.ValidationError(
1124 "Cannot archive a plan with active subscriptions"
Using a container in place of a generator for a calls that can accept both, slows down the performance. Consider using generators for all function calls which accept both containers and genertors.
# List comprehension is unnecessary here
set([student.name for student in student])
sum([y**2 for y in list(range(10))])
set(student.name for student in students)
sum(y**2 for y in list(range(10)))