fix: fix 'consider-using-dict-comprehension' for pylint

This commit is contained in:
Lance Edgar 2025-09-01 15:13:59 -05:00
parent 3ba57e3640
commit c3e262804c
3 changed files with 6 additions and 9 deletions

View file

@ -8,4 +8,3 @@ disable=fixme,
arguments-renamed, arguments-renamed,
attribute-defined-outside-init, attribute-defined-outside-init,
broad-exception-caught, broad-exception-caught,
consider-using-dict-comprehension,

View file

@ -1255,7 +1255,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met
] ]
# make order # make order
kw = dict([(field, getattr(batch, field)) for field in batch_fields]) kw = {field: getattr(batch, field) for field in batch_fields}
kw["order_id"] = batch.id kw["order_id"] = batch.id
kw["created_by"] = user kw["created_by"] = user
order = model.Order(**kw) order = model.Order(**kw)
@ -1265,7 +1265,7 @@ class NewOrderBatchHandler(BatchHandler): # pylint: disable=too-many-public-met
def convert(row, i): # pylint: disable=unused-argument def convert(row, i): # pylint: disable=unused-argument
# make order item # make order item
kw = dict([(field, getattr(row, field)) for field in row_fields]) kw = {field: getattr(row, field) for field in row_fields}
item = model.OrderItem(**kw) item = model.OrderItem(**kw)
order.items.append(item) order.items.append(item)

View file

@ -308,12 +308,10 @@ class OrderView(MasterView): # pylint: disable=too-many-public-methods
context["default_item_discount"] = self.app.render_quantity( context["default_item_discount"] = self.app.render_quantity(
self.batch_handler.get_default_item_discount() self.batch_handler.get_default_item_discount()
) )
context["dept_item_discounts"] = dict( context["dept_item_discounts"] = {
[ d["department_id"]: d["default_item_discount"]
(d["department_id"], d["default_item_discount"])
for d in self.get_dept_item_discounts() for d in self.get_dept_item_discounts()
] }
)
return self.render_to_response("create", context) return self.render_to_response("create", context)