Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Rafael Monnerat
slapos.core
Commits
9d339516
Commit
9d339516
authored
Aug 05, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_accounting: Make Pylint Happy
parent
a0509207
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
20 additions
and
26 deletions
+20
-26
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStartDate.py
...ing/HostingSubscription_calculateSubscriptionStartDate.py
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStopDate.py
...ting/HostingSubscription_calculateSubscriptionStopDate.py
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
...ins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
+1
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_getLatestCPUPercentLoad.py
...ns/slapos_consumption/Computer_getLatestCPUPercentLoad.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_getWattConsumption.py
...l_skins/slapos_consumption/Computer_getWattConsumption.py
+7
-6
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_getZeroEmissionRatio.py
...skins/slapos_consumption/Computer_getZeroEmissionRatio.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getMostEcoEfficientSoftwareInstance.py
...ostingSubscription_getMostEcoEfficientSoftwareInstance.py
+0
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getResourceConsumptionDetailList.py
...n/HostingSubscription_getResourceConsumptionDetailList.py
+2
-3
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getStatForResource.py
...pos_consumption/HostingSubscription_getStatForResource.py
+0
-1
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SoftwareInstance_getCurrentDeltaCO2.py
...slapos_consumption/SoftwareInstance_getCurrentDeltaCO2.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SoftwareInstance_getFutureDeltaCO2.py
.../slapos_consumption/SoftwareInstance_getFutureDeltaCO2.py
+1
-0
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSInvoiceTransaction_selectDelivery.py
...pos_simulation/SlapOSInvoiceTransaction_selectDelivery.py
+1
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
.../portal_components/test.erp5.testSlapOSAccountingSkins.py
+1
-1
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.xml
...portal_components/test.erp5.testSlapOSAccountingSkins.xml
+1
-3
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSConsumptionSkins.py
...portal_components/test.erp5.testSlapOSConsumptionSkins.py
+0
-3
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSConsumptionSkins.xml
...ortal_components/test.erp5.testSlapOSConsumptionSkins.xml
+1
-4
No files found.
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStartDate.py
View file @
9d339516
...
@@ -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
()
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/HostingSubscription_calculateSubscriptionStopDate.py
View file @
9d339516
...
@@ -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
,
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_accounting/Person_storeOpenSaleOrderJournal.py
View file @
9d339516
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
()
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_getLatestCPUPercentLoad.py
View file @
9d339516
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"
)
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_getWattConsumption.py
View file @
9d339516
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
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/Computer_getZeroEmissionRatio.py
View file @
9d339516
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"
)
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getMostEcoEfficientSoftwareInstance.py
View file @
9d339516
partition_co2_dict
=
{}
min_delta_co2
=
2000
min_delta_co2
=
2000
minimal_candidate
=
None
minimal_candidate
=
None
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getResourceConsumptionDetailList.py
View file @
9d339516
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
=
newTemp
Document
(
portal
,
instance_url
,
uid
=
"%s_%s"
%
(
context
.
getUid
(),
i
))
line
=
newTemp
Base
(
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
,
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/HostingSubscription_getStatForResource.py
View file @
9d339516
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
())
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SoftwareInstance_getCurrentDeltaCO2.py
View file @
9d339516
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
raise
Unauthorized
raise
Unauthorized
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_consumption/SoftwareInstance_getFutureDeltaCO2.py
View file @
9d339516
from
zExceptions
import
Unauthorized
if
REQUEST
is
not
None
:
if
REQUEST
is
not
None
:
raise
Unauthorized
raise
Unauthorized
...
...
master/bt5/slapos_accounting/SkinTemplateItem/portal_skins/slapos_simulation/SlapOSInvoiceTransaction_selectDelivery.py
View file @
9d339516
...
@@ -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
]
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.py
View file @
9d339516
...
@@ -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
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSAccountingSkins.xml
View file @
9d339516
...
@@ -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>
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSConsumptionSkins.py
View file @
9d339516
...
@@ -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
,
...
...
master/bt5/slapos_accounting/TestTemplateItem/portal_components/test.erp5.testSlapOSConsumptionSkins.xml
View file @
9d339516
...
@@ -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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment