summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandru Damian <alexandru.damian@intel.com>2015-08-18 17:28:57 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-19 18:04:08 +0100
commit1c71955c416fb68455f7f70669aba4202c411807 (patch)
treebb00854539e40d267d5205deb9f5100fb34c6395
parenta740c17efc0ccc9f89a428ead08f9739af3c6de4 (diff)
toaster: fix pylint errors
Prompted by issues discovered during running pylint on the toaster sources, this patch fixes: * missing import in toaster ui * improper call of function in toaster ui (logger.debug) * improper function definitions in bbcontroller * invalid references to objects in bldcontrol.models * proper initialization of object fields in ToasterTables Also inhibiting specific pylint errors in files where the problems are mis-identified. Signed-off-by: Alexandru Damian <alexandru.damian@intel.com> Signed-off-by: Michael Wood <michael.g.wood@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/ui/toasterui.py5
-rw-r--r--lib/toaster/bldcontrol/bbcontroller.py2
-rw-r--r--lib/toaster/orm/models.py2
-rwxr-xr-xlib/toaster/toastergui/views.py4
-rw-r--r--lib/toaster/toastergui/widgets.py3
-rw-r--r--lib/toaster/toastermain/management/commands/perf.py7
6 files changed, 18 insertions, 5 deletions
diff --git a/lib/bb/ui/toasterui.py b/lib/bb/ui/toasterui.py
index f30f89e4..767bfabe 100644
--- a/lib/bb/ui/toasterui.py
+++ b/lib/bb/ui/toasterui.py
@@ -21,6 +21,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
from __future__ import division
+import sys
try:
import bb
except RuntimeError as exc:
@@ -255,10 +256,10 @@ def main(server, eventHandler, params ):
# we start a new build info
if buildinfohelper.brbe is not None:
- logger.debug(1, "ToasterUI under BuildEnvironment management - exiting after the build")
+ logger.debug("ToasterUI under BuildEnvironment management - exiting after the build")
server.terminateServer()
else:
- logger.debug(1, "ToasterUI prepared for new build")
+ logger.debug("ToasterUI prepared for new build")
errors = 0
warnings = 0
taskfailures = []
diff --git a/lib/toaster/bldcontrol/bbcontroller.py b/lib/toaster/bldcontrol/bbcontroller.py
index 9dd01e0d..ad70ac8b 100644
--- a/lib/toaster/bldcontrol/bbcontroller.py
+++ b/lib/toaster/bldcontrol/bbcontroller.py
@@ -177,7 +177,7 @@ class BuildEnvironmentController(object):
return BitbakeController(self.connection)
- def getArtifact(path):
+ def getArtifact(self, path):
""" This call returns an artifact identified by the 'path'. How 'path' is interpreted as
up to the implementing BEC. The return MUST be a REST URL where a GET will actually return
the content of the artifact, e.g. for use as a "download link" in a web UI.
diff --git a/lib/toaster/orm/models.py b/lib/toaster/orm/models.py
index de007027..92fcaa7a 100644
--- a/lib/toaster/orm/models.py
+++ b/lib/toaster/orm/models.py
@@ -81,7 +81,7 @@ class ProjectManager(models.Manager):
for rdl in release.releasedefaultlayer_set.all():
try:
- lv =Layer_Version.objects.filter(layer__name = rdl.layer_name, up_branch__name = release.branch_name)[0].get_equivalents_wpriority(prj)[0]
+ lv = Layer_Version.objects.filter(layer__name = rdl.layer_name, up_branch__name = release.branch_name)[0].get_equivalents_wpriority(prj)[0]
ProjectLayer.objects.create( project = prj,
layercommit = lv,
optional = False )
diff --git a/lib/toaster/toastergui/views.py b/lib/toaster/toastergui/views.py
index 2aadc75b..586a69c3 100755
--- a/lib/toaster/toastergui/views.py
+++ b/lib/toaster/toastergui/views.py
@@ -19,6 +19,10 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# pylint: disable=method-hidden
+# Gives E:848, 4: An attribute defined in json.encoder line 162 hides this method (method-hidden)
+# which is an invalid warning
+
import operator,re
from django.db.models import F, Q, Sum, Count, Max
diff --git a/lib/toaster/toastergui/widgets.py b/lib/toaster/toastergui/widgets.py
index 2adf5747..eb2914d8 100644
--- a/lib/toaster/toastergui/widgets.py
+++ b/lib/toaster/toastergui/widgets.py
@@ -334,6 +334,9 @@ class ToasterTemplateView(TemplateView):
# renders a instance in a template, or returns the context as json
# the class-equivalent of the _template_renderer decorator for views
+ def __init__(self, *args, **kwargs):
+ super(ToasterTemplateView, self).__init__(*args, **kwargs)
+ self.context_entries = []
def get(self, *args, **kwargs):
if self.request.GET.get('format', None) == 'json':
diff --git a/lib/toaster/toastermain/management/commands/perf.py b/lib/toaster/toastermain/management/commands/perf.py
index d28f26ab..71a48e95 100644
--- a/lib/toaster/toastermain/management/commands/perf.py
+++ b/lib/toaster/toastermain/management/commands/perf.py
@@ -2,7 +2,12 @@ from django.core.management.base import BaseCommand
from django.test.client import Client
import os, sys, re
import requests
-import toastermain.settings as settings
+from django.conf import settings
+
+# pylint: disable=E1103
+# Instance of 'WSGIRequest' has no 'status_code' member
+# (but some types could not be inferred) (maybe-no-member)
+
class Command(BaseCommand):
help = "Test the response time for all toaster urls"