Fix files to make test can pass linting check

Change-Id: Id13a108f20937b542733c5ec9fbf82ee8f004801
diff --git a/scripts/edgeconfig.py b/scripts/edgeconfig.py
index 2faf9de..2baa9a3 100644
--- a/scripts/edgeconfig.py
+++ b/scripts/edgeconfig.py
@@ -12,9 +12,7 @@
 
 import argparse
 import nbhelper
-import json
 import os
-import pprint
 
 from ruamel import yaml
 
diff --git a/scripts/nbhelper.py b/scripts/nbhelper.py
index 8b540dd..d0aa8fa 100644
--- a/scripts/nbhelper.py
+++ b/scripts/nbhelper.py
@@ -174,14 +174,15 @@
         target = None
 
         if not name:
-            target = next(
-                filter(
-                    lambda m: m.data["device_role"]["name"] == "Router",
-                    self.devices + self.vms,
-                )
-            )
+            for machine in self.devices + self.vms:
+                if machine.data["device_role"]["name"] == "Router":
+                    target = machine
+                    break
         else:
-            target = next(filter(lambda m: m.name == name, self.devices + self.vms))
+            for machine in self.devices + self.vms:
+                if machine.name == name:
+                    target = machine
+                    break
 
         return target.generate_netplan()
 
@@ -510,18 +511,12 @@
 
         primary_ip = self.data.primary_ip.address if self.data.primary_ip else None
         primary_if = self.interfaces_by_ip[primary_ip] if primary_ip else None
-        physical_ifs = filter(
-            lambda i: str(i.type) != "Virtual"
-            and i != primary_if
-            and i.mgmt_only == False,
-            self.interfaces,
-        )
 
         self.netplan_config["ethernets"] = dict()
 
         if self.data.device_role.name == "Router":
             for address, interface in self.interfaces_by_ip.items():
-                if interface.mgmt_only == True or str(interface.type) == "Virtual":
+                if interface.mgmt_only is True or str(interface.type) == "Virtual":
                     continue
 
                 self.netplan_config["ethernets"].setdefault(interface.name, {})
@@ -536,7 +531,12 @@
                     "dhcp4-overrides": {"route-metric": 100},
                 }
 
-            for physical_if in physical_ifs:
+            for physical_if in filter(
+                lambda i: str(i.type) != "Virtual"
+                and i != primary_if
+                and i.mgmt_only is False,
+                self.interfaces,
+            ):
                 self.netplan_config["ethernets"][physical_if.name] = {
                     "dhcp4": "yes",
                     "dhcp4-overrides": {"route-metric": 200},
@@ -546,9 +546,7 @@
             return None
 
         # Get interfaces own by AssignedObject and is virtual (VLAN interface)
-        virtual_ifs = filter(lambda i: str(i.type) == "Virtual", self.interfaces)
-
-        for virtual_if in virtual_ifs:
+        for virtual_if in filter(lambda i: str(i.type) == "Virtual", self.interfaces):
             if "vlans" not in self.netplan_config:
                 self.netplan_config["vlans"] = dict()
 
@@ -995,7 +993,7 @@
 
             if mac_addr and mac_addr.strip():  # if exists and not blank
                 self.hosts.append(
-                    {"name": name, "ip_addr": target_ip, "mac_addr": mac_addr.lower(),}
+                    {"name": name, "ip_addr": target_ip, "mac_addr": mac_addr.lower()}
                 )
 
         # add dns servers
diff --git a/scripts/netbox_hosts.py b/scripts/netbox_hosts.py
index 9e085f8..e968e8e 100644
--- a/scripts/netbox_hosts.py
+++ b/scripts/netbox_hosts.py
@@ -143,7 +143,8 @@
 
             continue
 
-        # require DNS names to only use ASCII characters (alphanumeric, lowercase, with dash/period)
+        # require DNS names to only use ASCII characters
+        # (alphanumeric, lowercase, with dash/period)
         # _'s are used in SRV/TXT records, but in general use aren't recommended
         dns_name = re.sub("[^a-z0-9.-]", "-", name.lower(), 0, re.ASCII)
 
@@ -170,7 +171,8 @@
 
             elif "." in value["dns_name"]:
                 logger.warning(
-                    "Device '%s' has a IP assigned DNS name '%s' outside the prefix extension: '%s', ignoring",
+                    "Device '%s' has a IP assigned DNS name '%s' outside "
+                    + "the prefix extension: '%s', ignoring",
                     name,
                     value["dns_name"],
                     extension,
diff --git a/scripts/pxeconfig.py b/scripts/pxeconfig.py
index 34e45a0..9f77f9e 100644
--- a/scripts/pxeconfig.py
+++ b/scripts/pxeconfig.py
@@ -11,8 +11,6 @@
 from __future__ import absolute_import
 
 import nbhelper
-import json
-import pprint
 
 from ruamel import yaml
 
diff --git a/scripts/tenant_validator.py b/scripts/tenant_validator.py
index baa4a79..86c9702 100644
--- a/scripts/tenant_validator.py
+++ b/scripts/tenant_validator.py
@@ -6,11 +6,13 @@
 # tenant_validator.py
 # Grab the data from Tenant and check if the information is invalidate
 
+from __future__ import absolute_import
+
 import re
+import sys
 import yaml
 import logging
 import argparse
-import nbhelper
 import pynetbox
 import requests
 import netaddr
@@ -30,7 +32,8 @@
 
 # A Regex rule to identify if device name is a valid domain
 fqdn_regex = re.compile(
-    "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"
+    r"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*"
+    + r"([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$"
 )