fix some Python 3 linting issues

BUG=None
TEST=CQ passes

Change-Id: I3b298f795e01318420dc2bfc5051e3163fac4414
Reviewed-on: https://chromium-review.googlesource.com/1729849
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Alex Klein <saklein@chromium.org>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Alex Klein <saklein@chromium.org>
diff --git a/errors.py b/errors.py
index 95f5e72..35c0433 100644
--- a/errors.py
+++ b/errors.py
@@ -1,3 +1,4 @@
+# -*- coding: utf-8 -*-
 # Copyright (c) 2011 The Chromium OS Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
diff --git a/pre-upload.py b/pre-upload.py
index 9a842c8..b8ed460 100755
--- a/pre-upload.py
+++ b/pre-upload.py
@@ -1764,7 +1764,7 @@
   if not config.has_section(SECTION):
     return set(), set()
 
-  valid_keys = set(_HOOK_FLAGS.iterkeys())
+  valid_keys = set(_HOOK_FLAGS.keys())
   hooks = _HOOK_FLAGS.copy()
 
   enable_flags = []
diff --git a/pre-upload_unittest.py b/pre-upload_unittest.py
index 1e55864..c553651 100755
--- a/pre-upload_unittest.py
+++ b/pre-upload_unittest.py
@@ -163,7 +163,7 @@
     self.assertTrue(failure)
     self.assertEquals('Found a space in indentation (must be all tabs):',
                       failure.msg)
-    self.assertEquals(['x.ebuild, line %d' % line for line in xrange(1, 6)],
+    self.assertEquals(['x.ebuild, line %d' % line for line in range(1, 6)],
                       failure.items)