3
0
Fork 0

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

This commit is contained in:
Lance Edgar 2025-09-01 10:15:23 -05:00
parent 11ec57387e
commit d6f7c19f71
4 changed files with 8 additions and 11 deletions

View file

@ -5,7 +5,6 @@ disable=fixme,
arguments-differ,
arguments-renamed,
attribute-defined-outside-init,
consider-using-dict-comprehension,
consider-using-dict-items,
consider-using-generator,
consider-using-get,

View file

@ -248,7 +248,7 @@ class GridFilter: # pylint: disable=too-many-instance-attributes
Returns a dict of all defined verb labels.
"""
# TODO: should traverse hierarchy
labels = dict([(verb, verb) for verb in self.get_verbs()])
labels = {verb: verb for verb in self.get_verbs()}
labels.update(self.default_verb_labels)
return labels

View file

@ -235,13 +235,11 @@ class BatchMasterView(MasterView):
batch = schema.objectify(form.validated, context=form.model_instance)
# then we collect attributes from the new batch
kw = dict(
[
(key, getattr(batch, key))
for key in form.validated
if hasattr(batch, key)
]
)
kw = {
key: getattr(batch, key)
for key in form.validated
if hasattr(batch, key)
}
# and set attribute for user creating the batch
kw["created_by"] = self.request.user

View file

@ -2248,9 +2248,9 @@ class MasterView(View): # pylint: disable=too-many-public-methods
:returns: The dict of route kwargs for the object.
"""
try:
return dict([(key, obj[key]) for key in self.get_model_key()])
return {key: obj[key] for key in self.get_model_key()}
except TypeError:
return dict([(key, getattr(obj, key)) for key in self.get_model_key()])
return {key: getattr(obj, key) for key in self.get_model_key()}
def get_action_url(self, action, obj, **kwargs):
"""