diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2015-08-18 17:28:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-19 18:05:51 +0100 |
commit | 98dfa27050e03fa6884b988f535168bbb6a80470 (patch) | |
tree | df3e0768dc17ab86c2d11489ade0b81ca73aaba5 /bitbake/lib | |
parent | c8df84777bc5283f54f71e5e76fafb5e766a1009 (diff) | |
download | poky-98dfa27050e03fa6884b988f535168bbb6a80470.tar.gz |
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>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | 3 | ||||
-rw-r--r-- | bitbake/lib/toaster/orm/models.py | 1 | ||||
-rwxr-xr-x | bitbake/lib/toaster/toastergui/views.py | 28 |
3 files changed, 12 insertions, 20 deletions
diff --git a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py index 9a508b43f4..508335f486 100644 --- a/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py +++ b/bitbake/lib/toaster/bldcontrol/management/commands/checksettings.py | |||
@@ -4,6 +4,7 @@ from bldcontrol.bbcontroller import getBuildEnvironmentController, ShellCmdExcep | |||
4 | from bldcontrol.models import BuildRequest, BuildEnvironment, BRError | 4 | from bldcontrol.models import BuildRequest, BuildEnvironment, BRError |
5 | from orm.models import ToasterSetting, Build | 5 | from orm.models import ToasterSetting, Build |
6 | import os | 6 | import os |
7 | import sys, traceback | ||
7 | 8 | ||
8 | def DN(path): | 9 | def DN(path): |
9 | if path is None: | 10 | if path is None: |
@@ -228,7 +229,7 @@ class Command(NoArgsCommand): | |||
228 | 229 | ||
229 | 230 | ||
230 | 231 | ||
231 | def handle(self, **options): | 232 | def handle_noargs(self, **options): |
232 | retval = 0 | 233 | retval = 0 |
233 | retval += self._verify_artifact_storage_dir() | 234 | retval += self._verify_artifact_storage_dir() |
234 | retval += self._verify_build_environment() | 235 | retval += self._verify_build_environment() |
diff --git a/bitbake/lib/toaster/orm/models.py b/bitbake/lib/toaster/orm/models.py index 4f07e37c52..b3f8db9750 100644 --- a/bitbake/lib/toaster/orm/models.py +++ b/bitbake/lib/toaster/orm/models.py | |||
@@ -807,7 +807,6 @@ class LayerIndexLayerSource(LayerSource): | |||
807 | Fetches layer, recipe and machine information from remote repository | 807 | Fetches layer, recipe and machine information from remote repository |
808 | """ | 808 | """ |
809 | assert self.apiurl is not None | 809 | assert self.apiurl is not None |
810 | from django.db import IntegrityError | ||
811 | from django.db import transaction, connection | 810 | from django.db import transaction, connection |
812 | 811 | ||
813 | import httplib, urlparse, json | 812 | import httplib, urlparse, json |
diff --git a/bitbake/lib/toaster/toastergui/views.py b/bitbake/lib/toaster/toastergui/views.py index d29ddd6099..03c7507762 100755 --- a/bitbake/lib/toaster/toastergui/views.py +++ b/bitbake/lib/toaster/toastergui/views.py | |||
@@ -102,8 +102,7 @@ def _project_recent_build_list(prj): | |||
102 | 102 | ||
103 | def objtojson(obj): | 103 | def objtojson(obj): |
104 | from django.db.models.query import QuerySet | 104 | from django.db.models.query import QuerySet |
105 | from django.db.models import Model, IntegerField | 105 | from django.db.models import Model |
106 | from django.db.models.fields.related import ForeignKey | ||
107 | 106 | ||
108 | if isinstance(obj, datetime): | 107 | if isinstance(obj, datetime): |
109 | return obj.isoformat() | 108 | return obj.isoformat() |
@@ -266,8 +265,8 @@ def _get_filtering_query(filter_string): | |||
266 | 265 | ||
267 | return reduce(operator.and_, [k for k in and_query]) | 266 | return reduce(operator.and_, [k for k in and_query]) |
268 | 267 | ||
269 | def _get_toggle_order(request, orderkey, reverse = False): | 268 | def _get_toggle_order(request, orderkey, toggle_reverse = False): |
270 | if reverse: | 269 | if toggle_reverse: |
271 | return "%s:+" % orderkey if request.GET.get('orderby', "") == "%s:-" % orderkey else "%s:-" % orderkey | 270 | return "%s:+" % orderkey if request.GET.get('orderby', "") == "%s:-" % orderkey else "%s:-" % orderkey |
272 | else: | 271 | else: |
273 | return "%s:-" % orderkey if request.GET.get('orderby', "") == "%s:+" % orderkey else "%s:+" % orderkey | 272 | 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): | |||
912 | 911 | ||
913 | except Exception as e: | 912 | except Exception as e: |
914 | print "Exception ", e | 913 | print "Exception ", e |
915 | import traceback | ||
916 | traceback.print_exc(e) | 914 | traceback.print_exc(e) |
917 | pass | ||
918 | 915 | ||
919 | # sort by directories first, then by name | 916 | # sort by directories first, then by name |
920 | rsorted = sorted(response, key=lambda entry : entry['name']) | 917 | rsorted = sorted(response, key=lambda entry : entry['name']) |
@@ -938,7 +935,7 @@ def dirinfo(request, build_id, target_id, file_path=None): | |||
938 | dir_list = [] | 935 | dir_list = [] |
939 | head = file_path | 936 | head = file_path |
940 | while head != sep: | 937 | while head != sep: |
941 | (head,tail) = os.path.split(head) | 938 | (head, tail) = os.path.split(head) |
942 | if head != sep: | 939 | if head != sep: |
943 | dir_list.insert(0, head) | 940 | dir_list.insert(0, head) |
944 | 941 | ||
@@ -1839,7 +1836,6 @@ def image_information_dir(request, build_id, target_id, packagefile_id): | |||
1839 | 1836 | ||
1840 | 1837 | ||
1841 | def managedcontextprocessor(request): | 1838 | def managedcontextprocessor(request): |
1842 | import subprocess | ||
1843 | ret = { | 1839 | ret = { |
1844 | "projects": Project.objects.all(), | 1840 | "projects": Project.objects.all(), |
1845 | "DEBUG" : toastermain.settings.DEBUG, | 1841 | "DEBUG" : toastermain.settings.DEBUG, |
@@ -1867,13 +1863,9 @@ if True: | |||
1867 | 1863 | ||
1868 | import traceback | 1864 | import traceback |
1869 | 1865 | ||
1870 | class BadParameterException(Exception): pass # error thrown on invalid POST requests | 1866 | class BadParameterException(Exception): |
1871 | 1867 | ''' The exception raised on invalid POST requests ''' | |
1872 | 1868 | pass | |
1873 | class InvalidRequestException(Exception): | ||
1874 | def __init__(self, response): | ||
1875 | self.response = response | ||
1876 | |||
1877 | 1869 | ||
1878 | # shows the "all builds" page for managed mode; it displays build requests (at least started!) instead of actual builds | 1870 | # shows the "all builds" page for managed mode; it displays build requests (at least started!) instead of actual builds |
1879 | @_template_renderer("builds.html") | 1871 | @_template_renderer("builds.html") |
@@ -2476,7 +2468,7 @@ if True: | |||
2476 | try: | 2468 | try: |
2477 | layer_version_id = request.POST["layer_version_id"] | 2469 | layer_version_id = request.POST["layer_version_id"] |
2478 | layer_version = Layer_Version.objects.get(id=layer_version_id) | 2470 | layer_version = Layer_Version.objects.get(id=layer_version_id) |
2479 | except: | 2471 | except Layer_Version.DoesNotExist: |
2480 | return error_response("Cannot find layer to update") | 2472 | return error_response("Cannot find layer to update") |
2481 | 2473 | ||
2482 | 2474 | ||
@@ -2505,8 +2497,8 @@ if True: | |||
2505 | try: | 2497 | try: |
2506 | layer_version.layer.save() | 2498 | layer_version.layer.save() |
2507 | layer_version.save() | 2499 | layer_version.save() |
2508 | except: | 2500 | except Exception as e: |
2509 | return error_response("Could not update layer version entry") | 2501 | return error_response("Could not update layer version entry: %s" % e) |
2510 | 2502 | ||
2511 | return HttpResponse(jsonfilter({"error": "ok",}), content_type = "application/json") | 2503 | return HttpResponse(jsonfilter({"error": "ok",}), content_type = "application/json") |
2512 | 2504 | ||