File .deepsource.toml
not found in the default branch of the repository root. Please refer to the docs.
440 plan_dict[plan_obj["id"]] = set()
441 plan_dict[plan_obj["id"]].add(plan_obj["external_id"])
442
443 lotus_plans = [444 (plan_id, external_plan_ids)
445 for plan_id, external_plan_ids in plan_dict.items()
446 ]
706 elif self.event_type == EVENT_TYPE.DELTA:
707 last_pre_query_grouped = (
708 pre_query_all_events.filter(*filter_args, **grouping_filter)
709 .values(*[x for x in grouping_filter.keys()]) 710 .annotate(last_qty=Sum(Cast(F("property_value"), FloatField())))
711 )
712 last_pre_query_actual_events = pre_query_all_events.annotate(
It is unnecessary to use a comprehension just to loop over the iterable
and create a list
/set
/dict
out of it.
Python has a specialized set of tools for this task: the list
/set
/dict
constructors, which are faster and more readable.
states = [
('AL', 'Alabama'),
('AK', 'Alaska'),
('AZ', 'Arizona'),
('AR', 'Arkansas'),
('CA', 'California'),
# ...
]
abbreviations_to_names = {
abbreviation: name
for abbreviation, name in states
}
states = [
('AL', 'Alabama'),
('AK', 'Alaska'),
('AZ', 'Arizona'),
('AR', 'Arkansas'),
('CA', 'California'),
# ...
]
abbreviations_to_names = dict(states)