Patchwork [4,of,7,V3] statprof: use absolute_imports

login
register
mail settings
Submitter Gregory Szorc
Date Nov. 2, 2016, 2:11 a.m.
Message ID <68386b992feb59ec53f4.1478052668@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/17267/
State Accepted
Headers show

Comments

Gregory Szorc - Nov. 2, 2016, 2:11 a.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@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.

Patch

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