Commit c3305bad authored by Jérome Perrin's avatar Jérome Perrin

pdm: fix pylint messages on document.erp5.Consumption

- fix indentation
- make overloaded methods accept same arguments as on parent class
- use list comprehension instead of map()
parent 30001f17
...@@ -37,81 +37,85 @@ from Products.ERP5.mixin.variated import VariatedMixin ...@@ -37,81 +37,85 @@ from Products.ERP5.mixin.variated import VariatedMixin
class Consumption(XMLObject, XMLMatrix, VariatedMixin): class Consumption(XMLObject, XMLMatrix, VariatedMixin):
""" """
A matrix which provides default quantities A matrix which provides default quantities
for a given quantity for a given quantity
""" """
meta_type = 'ERP5 Consumption' meta_type = 'ERP5 Consumption'
portal_type = 'Consumption' portal_type = 'Consumption'
# Declarative security # Declarative security
security = ClassSecurityInfo() security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject , PropertySheet.XMLObject
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.DublinCore , PropertySheet.DublinCore
, PropertySheet.VariationRange , PropertySheet.VariationRange
) )
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'_setVariationCategoryList') '_setVariationCategoryList')
def _setVariationCategoryList(self,value): def _setVariationCategoryList(self, value, base_category_list=()):
""" """
Set consumption variation category list. Set consumption variation category list.
Set matrix cell range. Set matrix cell range.
""" """
self._setCategoryMembership(self.getVariationRangeBaseCategoryList(), self._setCategoryMembership(self.getVariationRangeBaseCategoryList(),
value, base=1) value, base=1)
# XXX Must use in futur this method, but it failed today # XXX Must use in futur this method, but it failed today
#VariatedMixin._setVariationCategoryList(self, value) #VariatedMixin._setVariationCategoryList(self, value)
# XXX FIXME: Use a interaction workflow instead # XXX FIXME: Use a interaction workflow instead
# Kept for compatibility. # Kept for compatibility.
self.updateCellRange(base_id='quantity') self.updateCellRange(base_id='quantity')
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'setVariationCategoryList') 'setVariationCategoryList')
def setVariationCategoryList(self,value): def setVariationCategoryList(self, value, base_category_list=()):
""" """
Set consumption variation category list. Set consumption variation category list.
Reindex Object. Reindex Object.
""" """
self._setVariationCategoryList(value) self._setVariationCategoryList(value)
self.reindexObject() self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'getVariationRangeBaseCategoryItemList') 'getVariationRangeBaseCategoryItemList')
def getVariationRangeBaseCategoryItemList(self): def getVariationRangeBaseCategoryItemList(
""" self,
Return range of base variation item base=1,
Left display display_id='getTitle',
""" current_category=None):
# XXX get TitleOrId """
return map( lambda x: (x,x) , self.getVariationRangeBaseCategoryList() ) Return range of base variation item
Left display
"""
# XXX get TitleOrId
return [(x, x) for x in self.getVariationRangeBaseCategoryList()]
security.declareProtected(Permissions.ModifyPortalContent, security.declareProtected(Permissions.ModifyPortalContent,
'getQuantityRatio') 'getQuantityRatio')
def getQuantityRatio(self, variation_category_line, def getQuantityRatio(self, variation_category_line,
variation_category_column): variation_category_column):
""" """
Return quantity ratio for a virtual cell. Return quantity ratio for a virtual cell.
Return None if not result can be return. Return None if not result can be return.
""" """
cell_quantity_ratio_list = [] cell_quantity_ratio_list = []
for variation_category in (variation_category_line, for variation_category in (variation_category_line,
variation_category_column): variation_category_column):
cell = self.getCell(variation_category, base_id='quantity') cell = self.getCell(variation_category, base_id='quantity')
if cell is None: if cell is None:
return None
else:
cell_quantity_ratio = cell.getProperty('quantity')
if cell_quantity_ratio in [None, 0, '']:
return None return None
else: else:
cell_quantity_ratio = cell.getProperty('quantity') cell_quantity_ratio_list.append( cell_quantity_ratio )
if cell_quantity_ratio in [None, 0, '']:
return None
else:
cell_quantity_ratio_list.append( cell_quantity_ratio )
return cell_quantity_ratio_list[1] / cell_quantity_ratio_list[0] return cell_quantity_ratio_list[1] / cell_quantity_ratio_list[0]
...@@ -6,6 +6,12 @@ ...@@ -6,6 +6,12 @@
</pickle> </pickle>
<pickle> <pickle>
<dictionary> <dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item> <item>
<key> <string>default_reference</string> </key> <key> <string>default_reference</string> </key>
<value> <string>Consumption</string> </value> <value> <string>Consumption</string> </value>
...@@ -14,6 +20,12 @@ ...@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key> <key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.Consumption</string> </value> <value> <string>Products.ERP5.Document.Consumption</string> </value>
</item> </item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item> <item>
<key> <string>id</string> </key> <key> <string>id</string> </key>
<value> <string>document.erp5.Consumption</string> </value> <value> <string>document.erp5.Consumption</string> </value>
...@@ -37,47 +49,7 @@ ...@@ -37,47 +49,7 @@
<item> <item>
<key> <string>text_content_warning_message</string> </key> <key> <string>text_content_warning_message</string> </key>
<value> <value>
<tuple> <tuple/>
<string>W: 40, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 45, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 46, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 49, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 50, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 53, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 60, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 62, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 63, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 67, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 73, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 75, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 77, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 78, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 82, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 83, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 85, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 87, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 88, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 93, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 95, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 97, 0: Bad indentation. Found 4 spaces, expected 2 (bad-indentation)</string>
<string>W: 99, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:103, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:105, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W:107, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W:108, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W:109, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)</string>
<string>W:110, 0: Bad indentation. Found 8 spaces, expected 6 (bad-indentation)</string>
<string>W:111, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)</string>
<string>W:112, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)</string>
<string>W:113, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)</string>
<string>W:114, 0: Bad indentation. Found 10 spaces, expected 8 (bad-indentation)</string>
<string>W:115, 0: Bad indentation. Found 12 spaces, expected 10 (bad-indentation)</string>
<string>W:117, 0: Bad indentation. Found 6 spaces, expected 4 (bad-indentation)</string>
<string>W: 62, 4: Arguments number differs from overridden \'_setVariationCategoryList\' method (arguments-differ)</string>
<string>W: 77, 4: Arguments number differs from overridden \'setVariationCategoryList\' method (arguments-differ)</string>
<string>W: 87, 4: Arguments number differs from overridden \'getVariationRangeBaseCategoryItemList\' method (arguments-differ)</string>
<string>W: 93, 13: map/filter on lambda could be replaced by comprehension (deprecated-lambda)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
...@@ -87,13 +59,28 @@ ...@@ -87,13 +59,28 @@
<item> <item>
<key> <string>workflow_history</string> </key> <key> <string>workflow_history</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="2" aka="AAAAAAAAAAI="> <record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary/>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle> <pickle>
<global name="PersistentMapping" module="Persistence.mapping"/> <global name="PersistentMapping" module="Persistence.mapping"/>
</pickle> </pickle>
...@@ -106,7 +93,7 @@ ...@@ -106,7 +93,7 @@
<item> <item>
<key> <string>component_validation_workflow</string> </key> <key> <string>component_validation_workflow</string> </key>
<value> <value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value> </value>
</item> </item>
</dictionary> </dictionary>
...@@ -115,7 +102,7 @@ ...@@ -115,7 +102,7 @@
</dictionary> </dictionary>
</pickle> </pickle>
</record> </record>
<record id="3" aka="AAAAAAAAAAM="> <record id="4" aka="AAAAAAAAAAQ=">
<pickle> <pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/> <global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle> </pickle>
......
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