Bug 1396217 - resolve py2 and py3 lint errors r?jmaher draft pylint_fix3
authorIonut Goldan <ionut.goldan@softvision.ro>
Fri, 08 Sep 2017 11:27:26 +0300
changeset 662246 b45ae27e0a242960fa3f711f6f39a404b55172cf
parent 662089 a5f163da8a9be5d2e86138c57d59be69723b5457
child 730796 1f99b2613dd92720ca90e72eb53ced83f29b8020
push id79006
push userbmo:ionut.goldan@softvision.ro
push dateMon, 11 Sep 2017 09:10:39 +0000
reviewersjmaher
bugs1396217
milestone57.0a1
Bug 1396217 - resolve py2 and py3 lint errors r?jmaher MozReview-Commit-ID: LG332HzJKcw
testing/talos/INSTALL.py
testing/talos/setup.py
testing/talos/talos/cmanager.py
testing/talos/talos/cmanager_base.py
testing/talos/talos/cmanager_linux.py
testing/talos/talos/cmanager_mac.py
testing/talos/talos/cmanager_win32.py
testing/talos/talos/cmdline.py
testing/talos/talos/config.py
testing/talos/talos/ffsetup.py
testing/talos/talos/filter.py
testing/talos/talos/gecko_profile.py
testing/talos/talos/mainthreadio.py
testing/talos/talos/mitmproxy/alternate-server-replay.py
testing/talos/talos/mitmproxy/mitmproxy.py
testing/talos/talos/output.py
testing/talos/talos/profiler/profiling.py
testing/talos/talos/profiler/symFileManager.py
testing/talos/talos/profiler/symLogging.py
testing/talos/talos/profiler/symbolication.py
testing/talos/talos/profiler/symbolicationRequest.py
testing/talos/talos/results.py
testing/talos/talos/run_tests.py
testing/talos/talos/scripts/report.py
testing/talos/talos/talos_process.py
testing/talos/talos/talosconfig.py
testing/talos/talos/test.py
testing/talos/talos/ttest.py
testing/talos/talos/utils.py
testing/talos/talos/whitelist.py
testing/talos/talos/xtalos/__init__.py
testing/talos/talos/xtalos/etlparser.py
testing/talos/talos/xtalos/parse_xperf.py
testing/talos/talos/xtalos/start_xperf.py
testing/talos/talos/xtalos/xtalos.py
testing/talos/talos_from_code.py
testing/talos/tests/test_browser_output.py
testing/talos/tests/test_filter.py
testing/talos/tests/test_results.py
testing/talos/tests/test_talosconfig.py
testing/talos/tests/test_urlsplit.py
testing/talos/tests/test_utils.py
testing/talos/tests/test_xrestop.py
tools/lint/py2.yml
tools/lint/py3.yml
--- a/testing/talos/INSTALL.py
+++ b/testing/talos/INSTALL.py
@@ -1,21 +1,23 @@
 #!/usr/bin/env python
 
 """
 installation script for talos. This script:
 - creates a virtualenv in the current directory
 - sets up talos in development mode: `python setup.py develop`
 - downloads pageloader and packages to talos/page_load_test/pageloader.xpi
 """
+from __future__ import absolute_import
 
 import os
 import subprocess
 import sys
 import urllib2
+
 try:
     from subprocess import check_call as call
 except:
     from subprocess import call
 
 # globals
 here = os.path.dirname(os.path.abspath(__file__))
 VIRTUALENV = 'https://raw.github.com/pypa/virtualenv/1.10/virtualenv.py'
--- a/testing/talos/setup.py
+++ b/testing/talos/setup.py
@@ -1,10 +1,12 @@
+from __future__ import absolute_import
 
 import os
+
 from setuptools import setup, find_packages
 
 try:
     here = os.path.dirname(os.path.abspath(__file__))
     description = open(os.path.join(here, 'README')).read()
 except OSError:
     description = ''
 
--- a/testing/talos/talos/cmanager.py
+++ b/testing/talos/talos/cmanager.py
@@ -1,40 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import
 
-import mozinfo
 import threading
 
-
-class CounterManager(object):
-
-    counterDict = {}
-
-    def __init__(self):
-        self.allCounters = {}
-        self.registeredCounters = {}
-
-    def _loadCounters(self):
-        """Loads all of the counters defined in the counterDict"""
-        for counter in self.counterDict.keys():
-            self.allCounters[counter] = self.counterDict[counter]
-
-    def registerCounters(self, counters):
-        """Registers a list of counters that will be monitoring.
-        Only counters whose names are found in allCounters will be added
-        """
-        for counter in counters:
-            if counter in self.allCounters:
-                self.registeredCounters[counter] = \
-                    [self.allCounters[counter], []]
-
-    def getCounterValue(self, counterName):
-        """Returns the last value of the counter 'counterName'"""
+import mozinfo
 
 
 if mozinfo.os == 'linux':
     from talos.cmanager_linux import LinuxCounterManager \
         as DefaultCounterManager
 elif mozinfo.os == 'win':
     from talos.cmanager_win32 import WinCounterManager \
         as DefaultCounterManager
new file mode 100644
--- /dev/null
+++ b/testing/talos/talos/cmanager_base.py
@@ -0,0 +1,27 @@
+from __future__ import absolute_import
+
+
+class CounterManager(object):
+
+    counterDict = {}
+
+    def __init__(self):
+        self.allCounters = {}
+        self.registeredCounters = {}
+
+    def _loadCounters(self):
+        """Loads all of the counters defined in the counterDict"""
+        for counter in self.counterDict.keys():
+            self.allCounters[counter] = self.counterDict[counter]
+
+    def registerCounters(self, counters):
+        """Registers a list of counters that will be monitoring.
+        Only counters whose names are found in allCounters will be added
+        """
+        for counter in counters:
+            if counter in self.allCounters:
+                self.registeredCounters[counter] = \
+                    [self.allCounters[counter], []]
+
+    def getCounterValue(self, counterName):
+        """Returns the last value of the counter 'counterName'"""
--- a/testing/talos/talos/cmanager_linux.py
+++ b/testing/talos/talos/cmanager_linux.py
@@ -1,15 +1,17 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import re
 import subprocess
-from cmanager import CounterManager
+
+from cmanager_base import CounterManager
 
 
 def xrestop(binary='xrestop'):
     """
     python front-end to running xrestop:
     http://www.freedesktop.org/wiki/Software/xrestop
 
     For each monitored process, `xrestop -m 1 -b` produces output like:
--- a/testing/talos/talos/cmanager_mac.py
+++ b/testing/talos/talos/cmanager_mac.py
@@ -1,18 +1,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """CounterManager for Mac OSX"""
+from __future__ import absolute_import, print_function
 
 import subprocess
-from cmanager import CounterManager
 import sys
 
+from cmanager_base import CounterManager
+
 
 def GetProcessData(pid):
     """Runs a ps on the process identified by pid and returns the output line
       as a list (pid, vsz, rss)
     """
     command = ['ps -o pid,vsize,rss -p'+str(pid)]
     try:
         handle = subprocess.Popen(command, stdout=subprocess.PIPE,
--- a/testing/talos/talos/cmanager_win32.py
+++ b/testing/talos/talos/cmanager_win32.py
@@ -1,20 +1,23 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import
 
-from cmanager import CounterManager
+import struct
+from ctypes import byref, create_string_buffer, memmove, Union, c_double, \
+    c_longlong
 from ctypes import windll
 from ctypes.wintypes import DWORD, HANDLE, LPSTR, LPCSTR, LPCWSTR, Structure, \
     pointer, LONG
-from ctypes import byref, create_string_buffer, memmove, Union, c_double, \
-    c_longlong
-import struct
+
+from cmanager_base import CounterManager
 from utils import TalosError
+
 pdh = windll.pdh
 
 _LONGLONG = c_longlong
 
 
 class _PDH_COUNTER_PATH_ELEMENTS_A(Structure):
     _fields_ = [("szMachineName", LPSTR),
                 ("szObjectName", LPSTR),
--- a/testing/talos/talos/cmdline.py
+++ b/testing/talos/talos/cmdline.py
@@ -1,11 +1,12 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import argparse
 import os
 
 from mozlog.commandline import add_logging_group
 
 
 class _StopAction(argparse.Action):
--- a/testing/talos/talos/config.py
+++ b/testing/talos/talos/config.py
@@ -1,18 +1,18 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
+import copy
+import os
 import sys
-import os
-import copy
 
 from mozlog.commandline import setup_logging
-
 from talos import utils, test
 from talos.cmdline import parse_args
 
 
 class ConfigurationError(Exception):
     pass
 
 
--- a/testing/talos/talos/ffsetup.py
+++ b/testing/talos/talos/ffsetup.py
@@ -1,30 +1,29 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """
 Set up a browser environment before running a test.
 """
+from __future__ import absolute_import, print_function
 
 import os
 import tempfile
+
 import mozfile
 import mozinfo
 import mozrunner
-
+from mozlog import get_proxy_logger
 from mozprocess import ProcessHandlerMixin
 from mozprofile.profile import Profile
-from mozlog import get_proxy_logger
-
 from talos import utils
+from talos.gecko_profile import GeckoProfile
 from talos.utils import TalosError
-from talos.gecko_profile import GeckoProfile
-
 
 LOG = get_proxy_logger()
 
 
 class FFSetup(object):
     """
     Initialize the browser environment before running a test.
 
@@ -160,19 +159,19 @@ class FFSetup(object):
             self.gecko_profile = GeckoProfile(upload_dir,
                                               self.browser_config,
                                               self.test_config)
             self.gecko_profile.update_env(self.env)
 
     def clean(self):
         try:
             mozfile.remove(self._tmp_dir)
-        except Exception, e:
-            print "Exception while removing profile directory: %s" % self._tmp_dir
-            print e
+        except Exception as e:
+            print("Exception while removing profile directory: %s" % self._tmp_dir)
+            print(e)
 
         if self.gecko_profile:
             self.gecko_profile.clean()
 
     def __enter__(self):
         LOG.info('Initialising browser for %s test...'
                  % self.test_config['name'])
         self._init_env()
--- a/testing/talos/talos/filter.py
+++ b/testing/talos/talos/filter.py
@@ -1,8 +1,10 @@
+from __future__ import absolute_import
+
 import math
 
 """
 data filters:
 takes a series of run data and applies statistical transforms to it
 
 Each filter is a simple function, but it also have attached a special
 `prepare` method that create a tuple with one instance of a
--- a/testing/talos/talos/gecko_profile.py
+++ b/testing/talos/talos/gecko_profile.py
@@ -1,24 +1,24 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """
 module to handle Gecko profilling.
 """
+from __future__ import absolute_import
 
+import json
 import os
 import tempfile
 import zipfile
-import json
+
 import mozfile
-
 from mozlog import get_proxy_logger
-
 from talos.profiler import symbolication, profiling
 
 LOG = get_proxy_logger()
 
 
 class GeckoProfile(object):
     """
     Handle Gecko profilling.
--- a/testing/talos/talos/mainthreadio.py
+++ b/testing/talos/talos/mainthreadio.py
@@ -1,13 +1,14 @@
 # -*- Mode: python; tab-width: 8; indent-tabs-mode: nil -*-
 # vim: set ts=8 sts=4 et sw=4 tw=80:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import os
 import re
 import utils
 import whitelist
 
 from collections import OrderedDict
 
--- a/testing/talos/talos/mitmproxy/alternate-server-replay.py
+++ b/testing/talos/talos/mitmproxy/alternate-server-replay.py
@@ -1,26 +1,27 @@
 # This file was copied from mitmproxy/addons/serverplayback.py release tag 2.0.2 and modified by
 # Benjamin Smedberg
 
 # Altered features:
 # * --kill returns 404 rather than dropping the whole HTTP/2 connection on the floor
 # * best-match response handling is used to improve success rates
+from __future__ import absolute_import, print_function
 
 import hashlib
+import sys
 import urllib
-import sys
 from collections import defaultdict
-from typing import Any  # noqa
-from typing import List  # noqa
 
 from mitmproxy import ctx
 from mitmproxy import exceptions
+from mitmproxy import http
 from mitmproxy import io
-from mitmproxy import http
+from typing import Any  # noqa
+from typing import List  # noqa
 
 
 class ServerPlayback:
     def __init__(self, replayfiles):
         self.options = None
         self.replayfiles = replayfiles
         self.flowmap = {}
 
--- a/testing/talos/talos/mitmproxy/mitmproxy.py
+++ b/testing/talos/talos/mitmproxy/mitmproxy.py
@@ -1,20 +1,21 @@
 '''This helps loading mitmproxy's cert and change proxy settings for Firefox.'''
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import
+
 import os
-import psutil
+import subprocess
 import sys
-import subprocess
 import time
 
 import mozinfo
-
+import psutil
 from mozlog import get_proxy_logger
 
 here = os.path.dirname(os.path.realpath(__file__))
 LOG = get_proxy_logger()
 
 # path for mitmproxy certificate, generated auto after mitmdump is started
 # on local machine it is 'HOME', however it is different on production machines
 try:
--- a/testing/talos/talos/output.py
+++ b/testing/talos/talos/output.py
@@ -1,39 +1,39 @@
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """output formats for Talos"""
+from __future__ import absolute_import
 
 import filter
+# NOTE: we have a circular dependency with output.py when we import results
 import simplejson as json
 import utils
-
 from mozlog import get_proxy_logger
 
-# NOTE: we have a circular dependency with output.py when we import results
-import results as TalosResults
-
 LOG = get_proxy_logger()
 
 
 class Output(object):
     """abstract base class for Talos output"""
 
     @classmethod
     def check(cls, urls):
         """check to ensure that the urls are valid"""
 
-    def __init__(self, results):
+    def __init__(self, results, tsresult_class):
         """
         - results : TalosResults instance
+        - tsresult_class : Results class
         """
         self.results = results
+        self.tsresult_class = tsresult_class
 
     def __call__(self):
         suites = []
         test_results = {
             'framework': {
                 'name': self.results.results[0].framework,
             },
             'suites': suites,
@@ -57,17 +57,17 @@ class Output(object):
                 # TODO: counters!!!! we don't have any, but they suffer the same
                 for result in test.results:
                     # XXX this will not work for manifests which list
                     # the same page name twice. It also ignores cycles
                     for page, val in result.raw_values():
                         if page == 'NULL':
                             page = test.name()
                             if tsresult is None:
-                                tsresult = r = TalosResults.Results()
+                                tsresult = r = self.tsresult_class()
                                 r.results = [{'index': 0, 'page': test.name(),
                                               'runs': val}]
                             else:
                                 r = tsresult.results[0]
                                 if r['page'] == test.name():
                                     r['runs'].extend(val)
                         replicates.setdefault(page, []).extend(val)
 
--- a/testing/talos/talos/profiler/profiling.py
+++ b/testing/talos/talos/profiler/profiling.py
@@ -1,10 +1,11 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import
 
 import json
 
 
 def save_profile(profile, filename):
     with open(filename, "w") as f:
         json.dump(profile, f)
--- a/testing/talos/talos/profiler/symFileManager.py
+++ b/testing/talos/talos/profiler/symFileManager.py
@@ -1,21 +1,22 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from symLogging import LogTrace, LogError, LogMessage
+from __future__ import absolute_import
 
 import itertools
 import os
 import re
 import threading
 import time
 from bisect import bisect
 
+from .symLogging import LogTrace, LogError, LogMessage
+
 # Libraries to keep prefetched
 PREFETCHED_LIBS = ["xul.pdb", "firefox.pdb"]
 
 
 class SymbolInfo:
 
     def __init__(self, addressMap):
         self.sortedAddresses = sorted(addressMap.keys())
--- a/testing/talos/talos/profiler/symLogging.py
+++ b/testing/talos/talos/profiler/symLogging.py
@@ -1,29 +1,27 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import sys
 import threading
 import time
 
 gEnableTracing = False
 
 
 def LogTrace(string):
     global gEnableTracing
     if gEnableTracing:
         threadName = threading.currentThread().getName().ljust(12)
-        print >> sys.stdout, time.asctime() + " " + threadName + " TRACE " + \
-            string
+        print(time.asctime() + " " + threadName + " TRACE " + string, file=sys.stdout)
 
 
 def LogError(string):
     threadName = threading.currentThread().getName().ljust(12)
-    print >> sys.stderr, time.asctime() + " " + threadName + " ERROR " + \
-        string
+    print(time.asctime() + " " + threadName + " ERROR " + string, file=sys.stderr)
 
 
 def LogMessage(string):
     threadName = threading.currentThread().getName().ljust(12)
-    print >> sys.stdout, time.asctime() + " " + threadName + "       " + \
-        string
+    print(time.asctime() + " " + threadName + "       " + string, file=sys.stdout)
--- a/testing/talos/talos/profiler/symbolication.py
+++ b/testing/talos/talos/profiler/symbolication.py
@@ -1,23 +1,25 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import
 
 import cStringIO
 import hashlib
 import os
 import platform
 import subprocess
 import urllib2
 import zipfile
 from distutils import spawn
-from symFileManager import SymFileManager
-from symbolicationRequest import SymbolicationRequest
-from symLogging import LogMessage
+
+from .symFileManager import SymFileManager
+from .symLogging import LogMessage
+from .symbolicationRequest import SymbolicationRequest
 
 """
 Symbolication is broken when using type 'str' in python 2.7, so we use 'basestring'.
 But for python 3.0 compatibility, 'basestring' isn't defined, but the 'str' type works.
 So we force 'basestring' to 'str'.
 """
 try:
     basestring
--- a/testing/talos/talos/profiler/symbolicationRequest.py
+++ b/testing/talos/talos/profiler/symbolicationRequest.py
@@ -1,18 +1,19 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-from symLogging import LogTrace, LogError
+from __future__ import absolute_import
 
+import json
 import re
-import json
 import urllib2
 
+from .symLogging import LogTrace, LogError
+
 # Precompiled regex for validating lib names
 # Empty lib name means client couldn't associate frame with any lib
 gLibNameRE = re.compile("[0-9a-zA-Z_+\-\.]*$")
 
 # Maximum number of times a request can be forwarded to a different server
 # for symbolication. Also prevents loops.
 MAX_FORWARDED_REQUESTS = 3
 
--- a/testing/talos/talos/results.py
+++ b/testing/talos/talos/results.py
@@ -3,21 +3,23 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """
 objects and methods for parsing and serializing Talos results
 see https://wiki.mozilla.org/Buildbot/Talos/DataFormat
 """
+from __future__ import absolute_import, print_function
 
+import csv
 import json
 import os
 import re
-import csv
+
 from talos import output, utils, filter
 
 
 class TalosResults(object):
     """Container class for Talos results"""
 
     def __init__(self):
         self.results = []
@@ -32,17 +34,17 @@ class TalosResults(object):
     def output(self, output_formats):
         """
         output all results to appropriate URLs
         - output_formats: a dict mapping formats to a list of URLs
         """
         try:
 
             for key, urls in output_formats.items():
-                _output = output.Output(self)
+                _output = output.Output(self, Results)
                 results = _output()
                 for url in urls:
                     _output.output(results, url)
         except utils.TalosError as e:
             # print to results.out
             try:
                 _output = output.GraphserverOutput(self)
                 results = _output()
--- a/testing/talos/talos/run_tests.py
+++ b/testing/talos/talos/run_tests.py
@@ -1,31 +1,31 @@
 #!/usr/bin/env python
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import copy
-import mozversion
 import os
 import sys
 import time
 import traceback
 import urllib
-import utils
+
 import mozhttpd
-
+import mozversion
+import utils
 from mozlog import get_proxy_logger
-
+from talos.config import get_configs, ConfigurationError
 from talos.mitmproxy import mitmproxy
 from talos.results import TalosResults
 from talos.ttest import TTest
 from talos.utils import TalosError, TalosRegression
-from talos.config import get_configs, ConfigurationError
 
 # directory of this file
 here = os.path.dirname(os.path.realpath(__file__))
 LOG = get_proxy_logger()
 
 
 def useBaseTestDefaults(base, tests):
     for test in tests:
--- a/testing/talos/talos/scripts/report.py
+++ b/testing/talos/talos/scripts/report.py
@@ -1,17 +1,20 @@
-from datetime import datetime
+from __future__ import absolute_import
+
+import argparse
+import collections
+import csv
+import os
 import sys
-import os
-import csv
+from calendar import day_name
+from datetime import datetime
+
+import compare
 import numpy
-import collections
-import argparse
-import compare
-from calendar import day_name
 
 sys.path.insert(1, os.path.join(sys.path[0], '..'))
 
 
 def get_branch(platform):
     if platform.startswith('OSX'):
         return compare.branch_map['Inbound']['pgo']['id']
     return compare.branch_map['Inbound']['nonpgo']['id']
--- a/testing/talos/talos/talos_process.py
+++ b/testing/talos/talos/talos_process.py
@@ -1,22 +1,22 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this file,
 # You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import
 
-import time
 import pprint
-import psutil
-import mozcrash
+import time
 import traceback
-from mozprocess import ProcessHandler
 from threading import Event
 
+import mozcrash
+import psutil
 from mozlog import get_proxy_logger
-
+from mozprocess import ProcessHandler
 from utils import TalosError
 
 LOG = get_proxy_logger()
 
 
 class ProcessContext(object):
     """
     Store useful results of the browser execution.
--- a/testing/talos/talos/talosconfig.py
+++ b/testing/talos/talos/talosconfig.py
@@ -1,10 +1,12 @@
+from __future__ import absolute_import, print_function
+
+import json
 import os
-import json
 
 
 def writeConfigFile(obj, vals):
     data = dict((opt, obj[opt]) for opt in (vals or obj.keys()))
     return json.dumps(data)
 
 
 def generateTalosConfig(command_line, browser_config, test_config, pid=None):
--- a/testing/talos/talos/test.py
+++ b/testing/talos/talos/test.py
@@ -1,9 +1,12 @@
+from __future__ import absolute_import
+
 import os
+
 from talos import filter
 
 """
 test definitions for Talos
 """
 
 _TESTS = {}  # internal dict of Talos test classes
 
--- a/testing/talos/talos/ttest.py
+++ b/testing/talos/talos/ttest.py
@@ -6,34 +6,34 @@
    follows the following steps
      - creates a profile
      - tests the profile
      - gets metrics for the current test environment
      - loads the url
      - collects info on any counters while test runs
      - waits for a 'dump' from the browser
 """
+from __future__ import absolute_import, print_function
 
 import os
-import sys
 import platform
-import results
-import subprocess
-import utils
-import mozcrash
-import talosconfig
 import shutil
-import mozfile
-
-from mozlog import get_proxy_logger
+import subprocess
+import sys
 
-from talos.utils import TalosCrash, TalosError, TalosRegression
+import mozcrash
+import mozfile
+import results
+import talosconfig
+import utils
+from mozlog import get_proxy_logger
+from talos.cmanager import CounterManagement
+from talos.ffsetup import FFSetup
 from talos.talos_process import run_browser
-from talos.ffsetup import FFSetup
-from talos.cmanager import CounterManagement
+from talos.utils import TalosCrash, TalosError, TalosRegression
 
 LOG = get_proxy_logger()
 
 
 class TTest(object):
     def check_for_crashes(self, browser_config, minidump_dir, test_name):
         # check for minidumps
         found = mozcrash.check_for_crashes(minidump_dir,
--- a/testing/talos/talos/utils.py
+++ b/testing/talos/talos/utils.py
@@ -1,22 +1,23 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """Utility functions for Talos"""
+from __future__ import absolute_import
 
+import json
 import os
-import time
-import urlparse
+import platform
+import re
 import string
+import time
 import urllib
-import json
-import re
-import platform
+import urlparse
 
 from mozlog import get_proxy_logger
 
 # directory of this file for use with interpolatePath()
 here = os.path.dirname(os.path.realpath(__file__))
 LOG = get_proxy_logger()
 
 
--- a/testing/talos/talos/whitelist.py
+++ b/testing/talos/talos/whitelist.py
@@ -1,13 +1,14 @@
 # -*- Mode: python; tab-width: 8; indent-tabs-mode: nil -*-
 # vim: set ts=8 sts=4 et sw=4 tw=80:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import json
 import os
 import re
 import utils
 
 KEY_XRE = '{xre}'
 DEFAULT_DURATION = 100.0
--- a/testing/talos/talos/xtalos/__init__.py
+++ b/testing/talos/talos/xtalos/__init__.py
@@ -1,5 +1,6 @@
 # xtalos: talos + xperf
+from __future__ import absolute_import
 
 from start_xperf import start  # noqa
 from start_xperf import start_from_config  # noqa
 import etlparser  # noqa
--- a/testing/talos/talos/xtalos/etlparser.py
+++ b/testing/talos/talos/xtalos/etlparser.py
@@ -1,24 +1,25 @@
 #!/usr/bin/env python
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import csv
-import re
+import json
 import os
-import sys
-import xtalos
+import re
+import shutil
 import subprocess
-import json
+import sys
+
 import mozfile
-import shutil
-
+import xtalos
 
 EVENTNAME_INDEX = 0
 PROCESS_INDEX = 2
 THREAD_ID_INDEX = 3
 DISKBYTES_COL = "Size"
 FNAME_COL = "FileName"
 IMAGEFUNC_COL = "Image!Function"
 EVENTGUID_COL = "EventGuid"
--- a/testing/talos/talos/xtalos/parse_xperf.py
+++ b/testing/talos/talos/xtalos/parse_xperf.py
@@ -1,19 +1,21 @@
 #!/usr/bin/env python
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import os
+import subprocess
 import sys
+
+import etlparser
 import xtalos
-import subprocess
-import etlparser
 
 
 def stop(xperf_path, debug=False):
     xperf_cmd = [xperf_path, '-stop', '-stop', 'talos_ses']
     if debug:
         print("executing '%s'" % subprocess.list2cmdline(xperf_cmd))
     subprocess.call(xperf_cmd)
 
--- a/testing/talos/talos/xtalos/start_xperf.py
+++ b/testing/talos/talos/xtalos/start_xperf.py
@@ -1,18 +1,20 @@
 #!/usr/bin/env python
 
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
 import os
+import subprocess
 import sys
+
 import xtalos
-import subprocess
 
 
 def start(xperf_path, xperf_providers, xperf_stackwalk, xperf_user_providers,
           etl_filename, debug=False):
 
     xperf_cmd = [xperf_path,
                  '-on', '+'.join(xperf_providers),
                  '-stackwalk', '+'.join(xperf_stackwalk),
--- a/testing/talos/talos/xtalos/xtalos.py
+++ b/testing/talos/talos/xtalos/xtalos.py
@@ -1,15 +1,16 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+from __future__ import absolute_import, print_function
 
-import os
 import argparse
 import json
+import os
 
 DEBUG_CRITICAL = 0
 DEBUG_ERROR = 1
 DEBUG_WARNING = 2
 DEBUG_INFO = 3
 DEBUG_VERBOSE = 4
 
 
--- a/testing/talos/talos_from_code.py
+++ b/testing/talos/talos_from_code.py
@@ -4,23 +4,25 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #
 # Script name:   talos_from_code.py
 # Purpose:       Read from a talos.json file the different files to download for a talos job
 # Author(s):     Zambrano Gasparnian, Armen <armenzg@mozilla.com>
 # Target:        Python 2.5
 #
-from optparse import OptionParser
+from __future__ import absolute_import, print_function
+
 import json
+import os
 import re
+import sys
 import urllib2
 import urlparse
-import sys
-import os
+from optparse import OptionParser
 
 
 def main():
     '''
     This script downloads a talos.json file which indicates which files to download
     for a talos job.
     See a talos.json file for a better understand:
     http://hg.mozilla.org/mozilla-central/raw-file/default/testing/talos/talos.json
--- a/testing/talos/tests/test_browser_output.py
+++ b/testing/talos/tests/test_browser_output.py
@@ -1,13 +1,14 @@
 #!/usr/bin/env python
 
 """
 test talos browser output parsing
 """
+from __future__ import absolute_import
 
 import os
 import unittest
 
 from talos.results import BrowserLogResults
 from talos.results import PageloaderResults
 from talos.utils import TalosError
 
--- a/testing/talos/tests/test_filter.py
+++ b/testing/talos/tests/test_filter.py
@@ -1,17 +1,19 @@
 #!/usr/bin/env python
 
 """
 test talos' filter module:
 
 http://hg.mozilla.org/build/talos/file/tip/talos/filter.py
 """
+from __future__ import absolute_import
 
 import unittest
+
 import talos.filter
 
 
 class TestFilter(unittest.TestCase):
 
     data = range(30)  # test data
 
     def test_ignore(self):
--- a/testing/talos/tests/test_results.py
+++ b/testing/talos/tests/test_results.py
@@ -4,18 +4,20 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """
 test talos results parsing
 
 http://hg.mozilla.org/build/talos/file/tip/talos/results.py
 """
+from __future__ import absolute_import
 
 import unittest
+
 import talos.filter
 import talos.results
 
 # example page load test results string
 results_string = """_x_x_mozilla_page_load
 _x_x_mozilla_page_load_details
 |i|pagename|runs|
 |0;gearflowers.svg;74;65;68;66;62
--- a/testing/talos/tests/test_talosconfig.py
+++ b/testing/talos/tests/test_talosconfig.py
@@ -1,13 +1,15 @@
+from __future__ import absolute_import, print_function
+
+import json
+import unittest
+
 from talos import talosconfig
 from talos.configuration import YAML
-import unittest
-import json
-
 
 # globals
 ffox_path = 'test/path/to/firefox'
 command_args = [ffox_path,
                 '-profile',
                 'pathtoprofile',
                 '-tp',
                 'pathtotpmanifest',
--- a/testing/talos/tests/test_urlsplit.py
+++ b/testing/talos/tests/test_urlsplit.py
@@ -3,18 +3,20 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 """
 test URL parsing; see
 https://bugzilla.mozilla.org/show_bug.cgi?id=793875
 """
+from __future__ import absolute_import
 
 import unittest
+
 import talos.utils
 
 
 class TestURLParsing(unittest.TestCase):
 
     def test_http_url(self):
         """test parsing an HTTP URL"""
 
--- a/testing/talos/tests/test_utils.py
+++ b/testing/talos/tests/test_utils.py
@@ -1,11 +1,14 @@
-from talos import utils
+from __future__ import absolute_import
+
+import os
 import unittest
-import os
+
+from talos import utils
 
 
 class TestTimer(unittest.TestCase):
     def test_timer(self):
         timer = utils.Timer()
         timer._start_time -= 3  # remove three seconds for the test
         self.assertEquals(timer.elapsed(), '00:00:03')
 
--- a/testing/talos/tests/test_xrestop.py
+++ b/testing/talos/tests/test_xrestop.py
@@ -1,17 +1,19 @@
 #!/usr/bin/env python
 
 """
 Tests for talos.xrestop
 """
+from __future__ import absolute_import
 
 import os
 import subprocess
 import unittest
+
 from talos.cmanager_linux import xrestop
 
 here = os.path.dirname(os.path.abspath(__file__))
 xrestop_output = os.path.join(here, 'xrestop_output.txt')
 
 
 class TestXrestop(unittest.TestCase):
 
--- a/tools/lint/py2.yml
+++ b/tools/lint/py2.yml
@@ -43,17 +43,16 @@ py2:
         - testing/instrumentation/runinstrumentation.py
         - testing/marionette
         - testing/mochitest
         - testing/mozbase
         - testing/mozharness
         - testing/remotecppunittests.py
         - testing/runcppunittests.py
         - testing/runtimes
-        - testing/talos
         - testing/tools
         - testing/tps
         - testing/web-platform
         - testing/xpcshell
         - third_party
         - toolkit
         - tools/docs
         - tools/git/eslintvalidate.py
--- a/tools/lint/py3.yml
+++ b/tools/lint/py3.yml
@@ -31,17 +31,16 @@ py3:
         - servo
         - testing/awsy
         - testing/firefox-ui/harness/firefox_ui_harness/runners/update.py
         - testing/gtest
         - testing/marionette
         - testing/mochitest
         - testing/mozbase
         - testing/mozharness
-        - testing/talos
         - testing/tools/iceserver
         - testing/tps
         - testing/xpcshell
         - testing/web-platform
         - third_party
         - toolkit
         - tools/git
         - tools/jprof