*.py: Import only modules

Fix linter errors regarding imports.

BUG=none
TEST=pack_firmware_unittest.py
TEST=pack_firmware_functest.py

Change-Id: Ia2a892a6ff17dcad739a8f804fac0beb97a305f9
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/firmware/+/4970730
Tested-by: Yu-Ping Wu <yupingso@chromium.org>
Auto-Submit: Yu-Ping Wu <yupingso@chromium.org>
Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Commit-Queue: Yu-Ping Wu <yupingso@chromium.org>
Commit-Queue: Hung-Te Lin <hungte@chromium.org>
diff --git a/pack_firmware.py b/pack_firmware.py
index 997371e..3c190af 100755
--- a/pack_firmware.py
+++ b/pack_firmware.py
@@ -10,8 +10,7 @@
 - pack/sfx?.sh as the self extraction (and installation) script
 """
 
-from collections import namedtuple
-from collections import OrderedDict
+import collections
 import glob
 import hashlib
 import io
@@ -48,14 +47,14 @@
 EC_RW_CBFS_NAME = "ecrw"
 MODELS_DIR = "models"
 IMG_DIR = "images"
-Section = namedtuple("Section", ["offset", "size"])
-ImageFile = namedtuple(
+Section = collections.namedtuple("Section", ["offset", "size"])
+ImageFile = collections.namedtuple(
     "ImageFile", ["filename", "build_target", "firmware_ids"]
 )
-FirmwareIds = namedtuple("FirmwareIds", ["ro_id", "rw_id"])
+FirmwareIds = collections.namedtuple("FirmwareIds", ["ro_id", "rw_id"])
 
 # Source locations for all firmware images.
-FirmwareSource = namedtuple(
+FirmwareSource = collections.namedtuple(
     "FirmwareSource", ["bios", "bios_rw", "ec", "ec_rw"]
 )
 
@@ -64,7 +63,7 @@
 #   key: Image name (e.g. 'BIOS (RW)' or 'EC').
 #   value: ImageFile, containing filename and version.
 # key_id: key ID to use to sign the image for this model
-ModelDetails = namedtuple(
+ModelDetails = collections.namedtuple(
     "ModelDetails", ["image_files", "key_id", "brand_code"]
 )
 
@@ -1168,7 +1167,7 @@
         old and new formats, then push the change here.
 
         Args:
-            model_details: OrderedDict:
+            model_details: collections.OrderedDict:
                 key: Model name (in the order that information is wanted in the
                     instruction file).
                 value: ModelDetails object for that model.
@@ -1224,7 +1223,7 @@
                 raise PackError("Missing output file")
             self._basedir = self._CreateTmpDir()
             self._tmpdir = self._CreateTmpDir()
-            model_details = OrderedDict()
+            model_details = collections.OrderedDict()
             if not args.legacy:
                 # Most of the arguments are meaningless with unified builds
                 # since we get the information from the model configuration.
@@ -1252,7 +1251,7 @@
                 # for testing.
                 if args.models:
                     # tests depend on exact ordering
-                    devices_fw_target = OrderedDict(
+                    devices_fw_target = collections.OrderedDict(
                         (model, devices_fw_target[model])
                         for model in args.models
                     )
diff --git a/pack_firmware_functest.py b/pack_firmware_functest.py
index 82d4f42..5ffb303 100755
--- a/pack_firmware_functest.py
+++ b/pack_firmware_functest.py
@@ -17,7 +17,7 @@
 import sys
 import tarfile
 
-from pack_firmware import FirmwarePacker
+import pack_firmware
 import pack_firmware_utils
 
 
@@ -90,7 +90,7 @@
         osutils.SafeMakedirs(self.unpackdir)
 
         pack_firmware_utils.MakeTestFiles()
-        self.packer = FirmwarePacker("test")
+        self.packer = pack_firmware.FirmwarePacker("test")
         with tarfile.open("functest/Reef.9042.50.0.tbz2") as tar:
             tar.extractall(self.indir)
         with tarfile.open("functest/Reef_EC.9042.50.0.tbz2") as tar:
diff --git a/pack_firmware_unittest.py b/pack_firmware_unittest.py
index c21188e..3e2f14b 100755
--- a/pack_firmware_unittest.py
+++ b/pack_firmware_unittest.py
@@ -8,7 +8,7 @@
 This mocks out all tools so it can run fairly quickly.
 """
 
-from contextlib import contextmanager
+import contextlib
 import glob
 import io
 import os
@@ -138,7 +138,7 @@
 # Use this to suppress stdout/stderr output:
 # with capture_sys_output() as (stdout, stderr)
 #   ...do something...
-@contextmanager
+@contextlib.contextmanager
 def capture_sys_output():
     capture_out, capture_err = io.StringIO(), io.StringIO()
     old_out, old_err = sys.stdout, sys.stderr