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
class Consumption(XMLObject, XMLMatrix, VariatedMixin):
"""
A matrix which provides default quantities
for a given quantity
"""
"""
A matrix which provides default quantities
for a given quantity
"""
meta_type = 'ERP5 Consumption'
portal_type = 'Consumption'
meta_type = 'ERP5 Consumption'
portal_type = 'Consumption'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.VariationRange
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.VariationRange
)
security.declareProtected(Permissions.ModifyPortalContent,
'_setVariationCategoryList')
def _setVariationCategoryList(self,value):
"""
Set consumption variation category list.
Set matrix cell range.
"""
self._setCategoryMembership(self.getVariationRangeBaseCategoryList(),
value, base=1)
# XXX Must use in futur this method, but it failed today
#VariatedMixin._setVariationCategoryList(self, value)
# XXX FIXME: Use a interaction workflow instead
# Kept for compatibility.
self.updateCellRange(base_id='quantity')
security.declareProtected(Permissions.ModifyPortalContent,
'_setVariationCategoryList')
def _setVariationCategoryList(self, value, base_category_list=()):
"""
Set consumption variation category list.
Set matrix cell range.
"""
self._setCategoryMembership(self.getVariationRangeBaseCategoryList(),
value, base=1)
# XXX Must use in futur this method, but it failed today
#VariatedMixin._setVariationCategoryList(self, value)
# XXX FIXME: Use a interaction workflow instead
# Kept for compatibility.
self.updateCellRange(base_id='quantity')
security.declareProtected(Permissions.ModifyPortalContent,
'setVariationCategoryList')
def setVariationCategoryList(self,value):
"""
Set consumption variation category list.
Reindex Object.
"""
self._setVariationCategoryList(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent,
'setVariationCategoryList')
def setVariationCategoryList(self, value, base_category_list=()):
"""
Set consumption variation category list.
Reindex Object.
"""
self._setVariationCategoryList(value)
self.reindexObject()
security.declareProtected(Permissions.ModifyPortalContent,
'getVariationRangeBaseCategoryItemList')
def getVariationRangeBaseCategoryItemList(self):
"""
Return range of base variation item
Left display
"""
# XXX get TitleOrId
return map( lambda x: (x,x) , self.getVariationRangeBaseCategoryList() )
security.declareProtected(Permissions.ModifyPortalContent,
'getVariationRangeBaseCategoryItemList')
def getVariationRangeBaseCategoryItemList(
self,
base=1,
display_id='getTitle',
current_category=None):
"""
Return range of base variation item
Left display
"""
# XXX get TitleOrId
return [(x, x) for x in self.getVariationRangeBaseCategoryList()]
security.declareProtected(Permissions.ModifyPortalContent,
'getQuantityRatio')
def getQuantityRatio(self, variation_category_line,
variation_category_column):
"""
Return quantity ratio for a virtual cell.
Return None if not result can be return.
"""
cell_quantity_ratio_list = []
security.declareProtected(Permissions.ModifyPortalContent,
'getQuantityRatio')
def getQuantityRatio(self, variation_category_line,
variation_category_column):
"""
Return quantity ratio for a virtual cell.
Return None if not result can be return.
"""
cell_quantity_ratio_list = []
for variation_category in (variation_category_line,
variation_category_column):
cell = self.getCell(variation_category, base_id='quantity')
if cell is None:
for variation_category in (variation_category_line,
variation_category_column):
cell = self.getCell(variation_category, base_id='quantity')
if cell is None:
return None
else:
cell_quantity_ratio = cell.getProperty('quantity')
if cell_quantity_ratio in [None, 0, '']:
return None
else:
cell_quantity_ratio = cell.getProperty('quantity')
if cell_quantity_ratio in [None, 0, '']:
return None
else:
cell_quantity_ratio_list.append( cell_quantity_ratio )
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 @@
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_recorded_property_dict</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
<item>
<key> <string>default_reference</string> </key>
<value> <string>Consumption</string> </value>
......@@ -14,6 +20,12 @@
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.Document.Consumption</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>document.erp5.Consumption</string> </value>
......@@ -37,47 +49,7 @@
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<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>
<tuple/>
</value>
</item>
<item>
......@@ -87,13 +59,28 @@
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<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>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
......@@ -106,7 +93,7 @@
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
<persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent>
</value>
</item>
</dictionary>
......@@ -115,7 +102,7 @@
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<record id="4" aka="AAAAAAAAAAQ=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</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