Commit 6d772bb0 authored by Neil Williams's avatar Neil Williams Committed by Senthil Kumaran S
Browse files

Update for pycodestyle pep8 failures

Fix missing newlines in functions not detected by pep8 in
jessie but found by the replacement package in unstable
and Stretch: pycodestyle.

Change-Id: Id15e863cfde91267f87117d26a9e6e6f1efd1a86
parent 376a8002
......@@ -128,6 +128,8 @@ def cleanup_bundle_stream_selected(modeladmin, request, queryset):
else:
my_queryset = my_queryset | bundle_stream.bundles.all()
return delete_selected(my_modeladmin, request, my_queryset)
cleanup_bundle_stream_selected.short_description = "Clean up selected %(verbose_name_plural)s"
......@@ -274,6 +276,7 @@ class TestDefinitionAdmin(admin.ModelAdmin):
'target_os', 'content')}),
)
admin.site.register(Attachment, AttachmentAdmin)
admin.site.register(Bundle, BundleAdmin)
admin.site.register(BundleDeserializationError, BundleDeserializationErrorAdmin)
......
......@@ -62,4 +62,5 @@ def do_call(parser, token):
parser.delete_first_token()
return CallNode(func, args, name, nodelist)
do_call = register.tag('call', do_call)
......@@ -58,4 +58,5 @@ def load_tests_from_submodules(_locals):
if isinstance(obj, type) and issubclass(obj, unittest.TestCase):
_locals[attr] = obj
load_tests_from_submodules(locals())
......@@ -47,6 +47,7 @@ class AttributesForm(forms.Form):
name = forms.CharField(max_length=1024)
value = forms.CharField(max_length=1024)
AttributesFormSet = formset_factory(AttributesForm, extra=0)
......
......@@ -955,6 +955,7 @@ class DashboardAPI(ExposedAPI):
matches = matches[:100]
return [match.serializable() for match in matches]
# Mapper used by the legacy URL
legacy_mapper = Mapper()
legacy_mapper.register_introspection_methods()
......
......@@ -83,6 +83,7 @@ def main():
listener = JobListener(options.publisher)
print listener.wait_for_job_end(options.job_id, options.timeout)
if __name__ == '__main__':
main()
......
......@@ -7,5 +7,6 @@ from google_analytics.models import Analytic
class AnalyticAdmin(admin.ModelAdmin):
list_display = ('site', 'analytics_code',)
if getattr(settings, 'GOOGLE_ANALYTICS_MODEL', False):
admin.site.register(Analytic, AnalyticAdmin)
......@@ -53,4 +53,5 @@ class AnalyticsNode(template.Node):
else:
return ''
register.tag('analytics', do_get_analytics)
......@@ -35,6 +35,7 @@ def expire_user_action(modeladmin, request, queryset): # pylint: disable=unused
user.user_permissions.remove(permission)
user.save()
expire_user_action.short_description = 'Expire user account'
......@@ -64,6 +65,8 @@ def online_action(modeladmin, request, queryset): # pylint: disable=unused-argu
for device in queryset.filter(status__in=[Device.OFFLINE, Device.OFFLINING]):
if device.can_admin(request.user):
device.put_into_online_mode(request.user, "admin action")
online_action.short_description = "take online"
......@@ -71,6 +74,8 @@ def online_action_without_health_check(modeladmin, request, queryset): # pylint
for device in queryset.filter(status__in=[Device.OFFLINE, Device.OFFLINING]):
if device.can_admin(request.user):
device.put_into_online_mode(request.user, "admin action", True)
online_action_without_health_check.short_description = \
"take online without manual health check"
......@@ -84,6 +89,8 @@ def retire_action(modeladmin, request, queryset): # pylint: disable=unused-argu
new_state=new_status, message="retiring", job=None).save()
device.status = new_status
device.save()
retire_action.short_description = "retire"
......@@ -91,6 +98,8 @@ def cancel_action(modeladmin, request, queryset): # pylint: disable=unused-argu
for testjob in queryset:
if testjob.can_cancel(request.user):
testjob.cancel(request.user)
cancel_action.short_description = 'cancel selected jobs'
......@@ -98,6 +107,8 @@ def health_unknown(modeladmin, request, queryset): # pylint: disable=unused-arg
for device in queryset.filter(health_status=Device.HEALTH_PASS):
device.health_status = Device.HEALTH_UNKNOWN
device.save()
health_unknown.short_description = "set health_status to unknown"
......@@ -336,6 +347,8 @@ def hide_worker_action(modeladmin, request, queryset): # pylint: disable=unused
for worker in queryset.filter(display=True):
worker.display = False
worker.save()
hide_worker_action.short_description = "Hide selected worker(s)"
......@@ -343,6 +356,8 @@ def show_worker_action(modeladmin, request, queryset): # pylint: disable=unused
for worker in queryset.filter(display=False):
worker.display = True
worker.save()
show_worker_action.short_description = "Show selected worker(s)"
......
......@@ -73,5 +73,6 @@ def main():
django_options.extend(options.command)
execute_from_command_line(django_options)
if __name__ == "__main__":
main()
......@@ -255,4 +255,5 @@ EVENT_TOPIC = distro_settings.get_setting("EVENT_TOPIC", EVENT_TOPIC)
def set_timeout(connection, **kw):
connection.cursor().execute("SET statement_timeout to 30000")
connection_created.connect(set_timeout)
......@@ -6,4 +6,5 @@ from linaro_django_xmlrpc.models import AuthToken
class AuthTokenAdmin(admin.ModelAdmin):
list_display = ('user', 'description', 'created_on', 'last_used_on')
admin.site.register(AuthToken, AuthTokenAdmin)
......@@ -39,6 +39,7 @@ default_mapper_urlpatterns = [
'help_view': 'linaro_django_xmlrpc.views.default_help'
})]
token_urlpatterns = [
url(r'^tokens/$', tokens, name='linaro_django_xmlrpc_tokens'),
url(r'^tokens/create/$', create_token, name='linaro_django_xmlrpc.views.create_token'),
......
......@@ -47,6 +47,7 @@ def find_data_files(srcdir, *wildcards):
[os.path.basename(f) for f in glob.glob(os.path.normpath(os.path.join(srcdir, '*')))])
return file_list
SRCDIR = os.path.join('.', 'lava_scheduler_app', 'tests', 'device-types')
DEVICE_TYPE_TEMPLATES = find_data_files(SRCDIR, '*.jinja2')
......
......@@ -222,6 +222,7 @@ def main(dt, name, options):
os.unlink(json)
return 0
if __name__ == '__main__':
usage = "Usage: %prog devicetype hostname [-p pduport] [-t telnetport]"
description = "LAVA device helper. Allows local admins to add devices to a " \
......
......@@ -169,5 +169,6 @@ def main():
uglify('debian', data, os.getcwd(), args.remove, args.simulate)
return 0
if __name__ == '__main__':
sys.exit(main())
......@@ -128,5 +128,6 @@ def main():
return 0
if __name__ == '__main__':
main()
......@@ -40,4 +40,6 @@ print(" - creating rollback function")
def rollback():
transaction.rollback()
print("=============================")
......@@ -66,5 +66,6 @@ def main():
else:
print(connection.scheduler.validate_pipeline_devices())
if __name__ == '__main__':
main()
......@@ -90,6 +90,7 @@ def main():
print(version_tag())
return 0
if __name__ == '__main__':
main()
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