[PATCH 1 of 7] doc: make check-seclevel use absolute_import

Pulkit Goyal 7895pulkit at gmail.com
Sat Apr 16 21:33:07 UTC 2016


# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1460832282 -19800
#      Sun Apr 17 00:14:42 2016 +0530
# Node ID 6b4778fa8c39b2d70ffb920e4ccf747f6c27e47d
# Parent  16390f4cccf05759c12693f2f0d55b8c2511ad9f
doc: make check-seclevel use absolute_import

Also fixed direct symbol imports even the tests were not complaining.

diff --git a/doc/check-seclevel.py b/doc/check-seclevel.py
--- a/doc/check-seclevel.py
+++ b/doc/check-seclevel.py
@@ -2,18 +2,26 @@
 #
 # checkseclevel - checking section title levels in each online help document
 
-import sys, os
+from __future__ import absolute_import
+
 import optparse
+import os
+import sys
 
 # import from the live mercurial repo
 os.environ['HGMODULEPOLICY'] = 'py'
 sys.path.insert(0, "..")
 from mercurial import demandimport; demandimport.enable()
-from mercurial.commands import table
-from mercurial.help import helptable
-from mercurial import extensions
-from mercurial import minirst
-from mercurial import ui as uimod
+from mercurial import (
+    commands,
+    extensions,
+    help,
+    minirst,
+    ui as uimod,
+)
+
+table = commands.table
+helptable = help.helptable
 
 level2mark = ['"', '=', '-', '.', '#']
 reservedmarks = ['"']
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
@@ -3,7 +3,6 @@
   $ cd "$TESTDIR"/..
 
   $ hg files 'set:(**.py)' | sed 's|\\|/|g' | xargs python contrib/check-py3-compat.py
-  doc/check-seclevel.py not using absolute_import
   doc/gendoc.py not using absolute_import
   doc/hgmanpage.py not using absolute_import
   hgext/color.py not using absolute_import


More information about the Mercurial-devel mailing list