From b7c4d286ffa618be0e95b15f3883e2f6920a3fb1 Mon Sep 17 00:00:00 2001 From: Parker Berberian Date: Tue, 20 Nov 2018 11:19:55 -0500 Subject: Fix all flake8 errors The flake8 command in test.sh finds no longer finds any errors. This may form a basis of a jenkins verify job as a sort of 'weak compile-time checks' The flake8 command will not complain about line length, and will not complain about django's manage.py file Change-Id: Ic47cb4fc7ada55e64485661ab6881aef475018ff Signed-off-by: Parker Berberian --- src/resource_inventory/resource_manager.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src/resource_inventory/resource_manager.py') diff --git a/src/resource_inventory/resource_manager.py b/src/resource_inventory/resource_manager.py index cd70867..3380990 100644 --- a/src/resource_inventory/resource_manager.py +++ b/src/resource_inventory/resource_manager.py @@ -8,12 +8,17 @@ ############################################################################## -from django.core.exceptions import * from django.template.loader import render_to_string import booking -from dashboard.exceptions import * -from resource_inventory.models import * +from dashboard.exceptions import ( + ResourceExistenceException, + ResourceAvailabilityException, + ResourceProvisioningException, + ModelValidationException +) +from resource_inventory.models import Host, HostConfiguration, ResourceBundle + class ResourceManager: @@ -28,7 +33,7 @@ class ResourceManager: ResourceManager.instance = ResourceManager() return ResourceManager.instance - #public interface + # public interface def deleteResourceBundle(self, resourceBundle): for host in Host.objects.filter(bundle=resourceBundle): self.releaseHost(host) @@ -44,13 +49,13 @@ class ResourceManager: hosts = genericResourceBundle.getHosts() - #current supported case: user creating new booking - #currently unsupported: editing existing booking + # current supported case: user creating new booking + # currently unsupported: editing existing booking physical_hosts = [] for host in hosts: - host_config=None + host_config = None if config: host_config = HostConfiguration.objects.get(bundle=config, host=host) try: @@ -84,7 +89,7 @@ class ResourceManager: for vlan in generic_interface.vlans.all(): physical_interface.config.add(vlan) - #private interface + # private interface def acquireHost(self, genericHost, labName): host_full_set = Host.objects.filter(lab__name__exact=labName, profile=genericHost.profile) if not host_full_set.first(): @@ -135,7 +140,7 @@ class ResourceManager: booking_owner = booking.models.Booking.objects.get(resource=resource).owner owner = booking_owner.username email = booking_owner.userprofile.email_addr - except Exception as e: + except Exception: pass details['owner'] = owner @@ -159,7 +164,6 @@ class ResourceManager: return pdf_nodes - def get_pdf_host(self, host): host_info = {} host_info['name'] = host.template.resource.name -- cgit 1.2.3-korg