changeset 30256:2ed0b3f9f79e

statprof: use absolute_imports As part of this, we modify import order to satisfy our import checker.
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 01 Nov 2016 18:55:30 -0700
parents f42cd5434cc2
children 7428223ed7c2
files mercurial/statprof.py tests/test-check-py3-compat.t
diffstat 2 files changed, 14 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/statprof.py	Sun Aug 14 19:14:05 2016 -0700
+++ b/mercurial/statprof.py	Tue Nov 01 18:55:30 2016 -0700
@@ -102,12 +102,22 @@
 main thread's work patterns.
 """
 # no-check-code
-from __future__ import division
+from __future__ import absolute_import, division
 
-import inspect, json, os, signal, tempfile, sys, getopt, threading
+import collections
+import contextlib
+import getopt
+import inspect
+import json
+import os
+import signal
+import sys
+import tempfile
+import threading
 import time
-from collections import defaultdict
-from contextlib import contextmanager
+
+defaultdict = collections.defaultdict
+contextmanager = contextlib.contextmanager
 
 __all__ = ['start', 'stop', 'reset', 'display', 'profile']
 
--- a/tests/test-check-py3-compat.t	Sun Aug 14 19:14:05 2016 -0700
+++ b/tests/test-check-py3-compat.t	Tue Nov 01 18:55:30 2016 -0700
@@ -9,7 +9,6 @@
   hgext/fsmonitor/pywatchman/capabilities.py not using absolute_import
   hgext/fsmonitor/pywatchman/pybser.py not using absolute_import
   i18n/check-translation.py not using absolute_import
-  mercurial/statprof.py not using absolute_import
   mercurial/statprof.py requires print_function
   setup.py not using absolute_import
   tests/test-demandimport.py not using absolute_import