fix: fix 'consider-using-dict-comprehension' for pylint
This commit is contained in:
parent
11ec57387e
commit
d6f7c19f71
4 changed files with 8 additions and 11 deletions
|
@ -5,7 +5,6 @@ disable=fixme,
|
||||||
arguments-differ,
|
arguments-differ,
|
||||||
arguments-renamed,
|
arguments-renamed,
|
||||||
attribute-defined-outside-init,
|
attribute-defined-outside-init,
|
||||||
consider-using-dict-comprehension,
|
|
||||||
consider-using-dict-items,
|
consider-using-dict-items,
|
||||||
consider-using-generator,
|
consider-using-generator,
|
||||||
consider-using-get,
|
consider-using-get,
|
||||||
|
|
|
@ -248,7 +248,7 @@ class GridFilter: # pylint: disable=too-many-instance-attributes
|
||||||
Returns a dict of all defined verb labels.
|
Returns a dict of all defined verb labels.
|
||||||
"""
|
"""
|
||||||
# TODO: should traverse hierarchy
|
# 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)
|
labels.update(self.default_verb_labels)
|
||||||
return labels
|
return labels
|
||||||
|
|
||||||
|
|
|
@ -235,13 +235,11 @@ class BatchMasterView(MasterView):
|
||||||
batch = schema.objectify(form.validated, context=form.model_instance)
|
batch = schema.objectify(form.validated, context=form.model_instance)
|
||||||
|
|
||||||
# then we collect attributes from the new batch
|
# then we collect attributes from the new batch
|
||||||
kw = dict(
|
kw = {
|
||||||
[
|
key: getattr(batch, key)
|
||||||
(key, getattr(batch, key))
|
for key in form.validated
|
||||||
for key in form.validated
|
if hasattr(batch, key)
|
||||||
if hasattr(batch, key)
|
}
|
||||||
]
|
|
||||||
)
|
|
||||||
|
|
||||||
# and set attribute for user creating the batch
|
# and set attribute for user creating the batch
|
||||||
kw["created_by"] = self.request.user
|
kw["created_by"] = self.request.user
|
||||||
|
|
|
@ -2248,9 +2248,9 @@ class MasterView(View): # pylint: disable=too-many-public-methods
|
||||||
:returns: The dict of route kwargs for the object.
|
:returns: The dict of route kwargs for the object.
|
||||||
"""
|
"""
|
||||||
try:
|
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:
|
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):
|
def get_action_url(self, action, obj, **kwargs):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue