Commit 9d339516 authored by Rafael Monnerat's avatar Rafael Monnerat

slapos_accounting: Make Pylint Happy

parent a0509207
...@@ -2,7 +2,7 @@ from zExceptions import Unauthorized ...@@ -2,7 +2,7 @@ from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
from erp5.component.module.DateUtils import addToDate, getClosestDate from erp5.component.module.DateUtils import getClosestDate
hosting_subscription = context hosting_subscription = context
portal = context.getPortalObject() portal = context.getPortalObject()
......
...@@ -7,7 +7,7 @@ from erp5.component.module.DateUtils import addToDate, getClosestDate ...@@ -7,7 +7,7 @@ from erp5.component.module.DateUtils import addToDate, getClosestDate
hosting_subscription = context hosting_subscription = context
portal = context.getPortalObject() portal = context.getPortalObject()
start_date = context.HostingSubscription_calculateSubscriptionStartDate() #start_date = context.HostingSubscription_calculateSubscriptionStartDate()
workflow_item_list = portal.portal_workflow.getInfoFor( workflow_item_list = portal.portal_workflow.getInfoFor(
ob=hosting_subscription, ob=hosting_subscription,
......
from erp5.component.module.DateUtils import addToDate, getClosestDate from erp5.component.module.DateUtils import addToDate
from DateTime import DateTime from DateTime import DateTime
portal = context.getPortalObject() portal = context.getPortalObject()
......
from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized("Unauthorized call script from URL") raise Unauthorized("Unauthorized call script from URL")
......
from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized("Unauthorized call script from URL") raise Unauthorized("Unauthorized call script from URL")
...@@ -10,25 +11,25 @@ def consumption_model_shuttle_ds61_i7(load): ...@@ -10,25 +11,25 @@ def consumption_model_shuttle_ds61_i7(load):
""" Expected consumed watts for the computer load """ Expected consumed watts for the computer load
""" """
if load <= 25: if load <= 25:
return 21.5 + 1.06*load return 21.5 + 1.06*load
else: else:
return 48 + 0.29*load return 48 + 0.29*load
def consumption_model_shuttle_nuc_i7(load): def consumption_model_shuttle_nuc_i7(load):
""" Expected consumed watts for the computer load """ Expected consumed watts for the computer load
""" """
if load <= 25: if load <= 25:
return 8.5 + 0.46*load return 8.5 + 0.46*load
else: else:
return 20 + 0.08*load return 20 + 0.08*load
def consumption_model_rikomagic_mk802iv(load): def consumption_model_rikomagic_mk802iv(load):
""" Expected consumed watts for the computer load """ Expected consumed watts for the computer load
""" """
if load <= 25: if load <= 25:
return 2.2 + 0.04*load return 2.2 + 0.04*load
else: else:
return 3.2 + 0.008*load return 3.2 + 0.008*load
def no_model(load): def no_model(load):
return 0 return 0
......
from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized("Unauthorized call script from URL") raise Unauthorized("Unauthorized call script from URL")
......
partition_co2_dict = {}
min_delta_co2 = 2000 min_delta_co2 = 2000
minimal_candidate = None minimal_candidate = None
......
from DateTime import DateTime from DateTime import DateTime
from Products.ZSQLCatalog.SQLCatalog import Query from Products.ERP5Type.Document import newTempBase
from Products.ERP5Type.Document import newTempDocument
portal = context.getPortalObject() portal = context.getPortalObject()
...@@ -136,7 +135,7 @@ for date in sorted(consumption_dict, reverse=True): ...@@ -136,7 +135,7 @@ for date in sorted(consumption_dict, reverse=True):
hosting_title, instance_dict, hs_url = consumption_dict[date][hosting_key] hosting_title, instance_dict, hs_url = consumption_dict[date][hosting_key]
for instance_value_list in instance_dict.values(): for instance_value_list in instance_dict.values():
instance_title, values, instance_url, computer_title = instance_value_list instance_title, values, instance_url, computer_title = instance_value_list
line = newTempDocument(portal, instance_url, uid="%s_%s" % (context.getUid(), i)) line = newTempBase(portal, instance_url, uid="%s_%s" % (context.getUid(), i))
line.edit( line.edit(
title=hosting_title, title=hosting_title,
start_date=date, start_date=date,
......
from Products.ZSQLCatalog.SQLCatalog import Query
portal = context.getPortalObject() portal = context.getPortalObject()
query_kw.update(query_kw['selection'].getParams()) query_kw.update(query_kw['selection'].getParams())
......
from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
......
from zExceptions import Unauthorized
if REQUEST is not None: if REQUEST is not None:
raise Unauthorized raise Unauthorized
......
...@@ -32,4 +32,4 @@ for movement in movement_list: ...@@ -32,4 +32,4 @@ for movement in movement_list:
if line is not None: if line is not None:
deliveries_keys[line.getExplanationValue()] = 1 deliveries_keys[line.getExplanationValue()] = 1
return filter(lambda x : x is not None, deliveries_keys.keys()) return [x for x in deliveries_keys if x is not None]
...@@ -170,7 +170,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin): ...@@ -170,7 +170,7 @@ class TestSlapOSAccounting(SlapOSTestCaseMixin):
def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_before(self): def test_OpenSaleOrder_reindexIfIndexedBeforeLine_line_indexed_before(self):
portal = self.portal portal = self.portal
order = self.createOpenSaleOrder() order = self.createOpenSaleOrder()
line = order.newContent(portal_type="Open Sale Order Line") order.newContent(portal_type="Open Sale Order Line")
self.tic() self.tic()
order.activate().immediateReindexObject() order.activate().immediateReindexObject()
# XXX One more kitten killed # XXX One more kitten killed
......
...@@ -45,9 +45,7 @@ ...@@ -45,9 +45,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:173, 4: Unused variable \'line\' (unused-variable)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
# #
############################################################################## ##############################################################################
import transaction
from erp5.component.test.SlapOSTestCaseMixin import \ from erp5.component.test.SlapOSTestCaseMixin import \
SlapOSTestCaseMixinWithAbort, SlapOSTestCaseMixin, simulate SlapOSTestCaseMixinWithAbort, SlapOSTestCaseMixin, simulate
from zExceptions import Unauthorized from zExceptions import Unauthorized
...@@ -267,7 +266,6 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration( ...@@ -267,7 +266,6 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
def createAllocatedComputer(self): def createAllocatedComputer(self):
# Create person # Create person
password = self.generateNewId()
reference = 'test_%s' % self.generateNewId() reference = 'test_%s' % self.generateNewId()
person = self.portal.person_module.newContent(portal_type='Person', person = self.portal.person_module.newContent(portal_type='Person',
title=reference, title=reference,
...@@ -275,7 +273,6 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration( ...@@ -275,7 +273,6 @@ class TestSlapOSComputerConsumptionTioXMLFile_solveInvoicingGeneration(
person.newContent(portal_type='Assignment', role='member').open() person.newContent(portal_type='Assignment', role='member').open()
# Create second person # Create second person
password = self.generateNewId()
reference = 'test_%s' % self.generateNewId() reference = 'test_%s' % self.generateNewId()
second_person = self.portal.person_module.newContent(portal_type='Person', second_person = self.portal.person_module.newContent(portal_type='Person',
title=reference, title=reference,
......
...@@ -45,10 +45,7 @@ ...@@ -45,10 +45,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:270, 4: Unused variable \'password\' (unused-variable)</string>
<string>W: 8, 0: Unused import transaction (unused-import)</string>
</tuple>
</value> </value>
</item> </item>
<item> <item>
......
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