[PATCH 4 of 7 V3] statprof: use absolute_imports

Gregory Szorc gregory.szorc at gmail.com
Tue Nov 1 22:11:08 EDT 2016


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1478051730 25200
#      Tue Nov 01 18:55:30 2016 -0700
# Node ID 68386b992feb59ec53f4d86ae2a4fd57613d6e77
# Parent  4cd53260f947639e140a61b0698d9da1032d3794
statprof: use absolute_imports

As part of this, we modify import order to satisfy our import
checker.

diff --git a/mercurial/statprof.py b/mercurial/statprof.py
--- a/mercurial/statprof.py
+++ b/mercurial/statprof.py
@@ -102,12 +102,22 @@ significantly off if other threads' work
 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']
 
diff --git a/tests/test-check-py3-compat.t b/tests/test-check-py3-compat.t
--- a/tests/test-check-py3-compat.t
+++ b/tests/test-check-py3-compat.t
@@ -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


More information about the Mercurial-devel mailing list