1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 05:29:32 +00:00

bitbake: toaster: pylint fixes

This patch fixes imports, default parameters to functions,
incorrect overloading and exception handling issues
highlighted by pylint. There are no functional changes.

(Bitbake rev: 066e096b80dcb0e93e1a088acf5d914184361769)

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>
This commit is contained in:
Alexandru DAMIAN
2015-08-18 17:28:47 +01:00
committed by Richard Purdie
parent c8df84777b
commit 98dfa27050
3 changed files with 12 additions and 20 deletions
@@ -4,6 +4,7 @@ from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdExcep
from bldcontrol.models import BuildRequest, BuildEnvironment, BRError
from orm.models import ToasterSetting, Build
import os
import sys, traceback
def DN(path):
if path is None:
@@ -228,7 +229,7 @@ class Command(NoArgsCommand):
def handle(self, **options):
def handle_noargs(self, **options):
retval = 0
retval += self._verify_artifact_storage_dir()
retval += self._verify_build_environment()
-1
View File
@@ -807,7 +807,6 @@ class LayerIndexLayerSource(LayerSource):
Fetches layer, recipe and machine information from remote repository
"""
assert self.apiurl is not None
from django.db import IntegrityError
from django.db import transaction, connection
import httplib, urlparse, json
+10 -18
View File
@@ -102,8 +102,7 @@ def _project_recent_build_list(prj):
def objtojson(obj):
from django.db.models.query import QuerySet
from django.db.models import Model, IntegerField
from django.db.models.fields.related import ForeignKey
from django.db.models import Model
if isinstance(obj, datetime):
return obj.isoformat()
@@ -266,8 +265,8 @@ def _get_filtering_query(filter_string):
return reduce(operator.and_, [k for k in and_query])
def _get_toggle_order(request, orderkey, reverse = False):
if reverse:
def _get_toggle_order(request, orderkey, toggle_reverse = False):
if toggle_reverse:
return "%s:+" % orderkey if request.GET.get('orderby', "") == "%s:-" % orderkey else "%s:-" % orderkey
else:
return "%s:-" % orderkey if request.GET.get('orderby', "") == "%s:+" % orderkey else "%s:+" % orderkey
@@ -912,9 +911,7 @@ def _get_dir_entries(build_id, target_id, start):
except Exception as e:
print "Exception ", e
import traceback
traceback.print_exc(e)
pass
# sort by directories first, then by name
rsorted = sorted(response, key=lambda entry : entry['name'])
@@ -938,7 +935,7 @@ def dirinfo(request, build_id, target_id, file_path=None):
dir_list = []
head = file_path
while head != sep:
(head,tail) = os.path.split(head)
(head, tail) = os.path.split(head)
if head != sep:
dir_list.insert(0, head)
@@ -1839,7 +1836,6 @@ def image_information_dir(request, build_id, target_id, packagefile_id):
def managedcontextprocessor(request):
import subprocess
ret = {
"projects": Project.objects.all(),
"DEBUG" : toastermain.settings.DEBUG,
@@ -1867,13 +1863,9 @@ if True:
import traceback
class BadParameterException(Exception): pass # error thrown on invalid POST requests
class InvalidRequestException(Exception):
def __init__(self, response):
self.response = response
class BadParameterException(Exception):
''' The exception raised on invalid POST requests '''
pass
# shows the "all builds" page for managed mode; it displays build requests (at least started!) instead of actual builds
@_template_renderer("builds.html")
@@ -2476,7 +2468,7 @@ if True:
try:
layer_version_id = request.POST["layer_version_id"]
layer_version = Layer_Version.objects.get(id=layer_version_id)
except:
except Layer_Version.DoesNotExist:
return error_response("Cannot find layer to update")
@@ -2505,8 +2497,8 @@ if True:
try:
layer_version.layer.save()
layer_version.save()
except:
return error_response("Could not update layer version entry")
except Exception as e:
return error_response("Could not update layer version entry: %s" % e)
return HttpResponse(jsonfilter({"error": "ok",}), content_type = "application/json")