Commit 47b14fd4 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Preparation of erp5_base migration from FS: Fix pylint...

ZODB Components: Preparation of erp5_base migration from FS: Fix pylint unbalanced-tuple-unpacking warning.
parent e54124d4
Pipeline #7188 failed with stage
in 0 seconds
...@@ -477,7 +477,7 @@ class BuilderMixin(XMLObject, Amount, Predicate): ...@@ -477,7 +477,7 @@ class BuilderMixin(XMLObject, Amount, Predicate):
not self._isUpdated(x, 'delivery')] not self._isUpdated(x, 'delivery')]
if merge_delivery: if merge_delivery:
# We must have only one delivery to update in the case of merge # We must have only one delivery to update in the case of merge
delivery, = delivery_to_update_list delivery = delivery_to_update_list[0]
property_dict = {} property_dict = {}
else: else:
delivery, property_dict = self._findUpdatableObject( delivery, property_dict = self._findUpdatableObject(
......
  • We often do this on purpose so that it fails when there is more than one element in the list, especially in tests.

    How about adding a assert len(delivery_to_update_list) == 1 or something ?

  • I didn't know about that. I will commit your suggestion tomorrow unless somebody has a better idea. Thanks!

  • This is maybe a case where a line comment to disable the pylint check is acceptable.

    delivery, = delivery_to_update_list #pylint: disable=unbalanced-tuple-unpacking
  • Well, having an assert or something similar makes it clear that there must be only one element, whereas pylint disabling comment does not IMO.

  • mentioned in commit 187c6554

    Toggle commit list
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment