[PATCH 8 of 8] import-checker: handle iter/iterkeys+iteritems python3 divergence
timeless
timeless at mozdev.org
Wed Mar 30 05:24:08 EDT 2016
# HG changeset patch
# User timeless <timeless at mozdev.org>
# Date 1459325737 0
# Wed Mar 30 08:15:37 2016 +0000
# Node ID 482080eea4493ba6616f30b5c38ce5d659bda513
# Parent b0d9bcd93d81e0683d8c980273055f9f4289a9b4
import-checker: handle iter/iterkeys+iteritems python3 divergence
diff --git a/contrib/import-checker.py b/contrib/import-checker.py
--- a/contrib/import-checker.py
+++ b/contrib/import-checker.py
@@ -702,7 +702,7 @@
top.foo -> top.qux -> top.foo
"""
cycles = set()
- for mod in sorted(imports.iterkeys()):
+ for mod in sorted(imports.keys()):
try:
checkmod(mod, imports)
except CircularImport as e:
@@ -726,7 +726,7 @@
for source_path in argv[1:]:
modname = dotted_name_of_path(source_path, trimpure=True)
localmods[modname] = source_path
- for modname, source_path in sorted(localmods.iteritems()):
+ for modname, source_path in sorted(localmods.items()):
f = open(source_path)
src = f.read()
used_imports[modname] = sorted(
diff --git a/tests/test-check-module-imports.t b/tests/test-check-module-imports.t
--- a/tests/test-check-module-imports.t
+++ b/tests/test-check-module-imports.t
@@ -141,6 +141,113 @@
hidden by deduplication algorithm in the cycle detector, so fixing
these may expose other cycles.
+#if no-py3k
$ hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python "$import_checker" -
Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
[1]
+#else
+ $ hg locate 'mercurial/**.py' 'hgext/**.py' | sed 's-\\-/-g' | python "$import_checker" -
+ hgext/eol.py:95: imports from mercurial not lexically sorted: config < util
+ hgext/eol.py:95: imports from mercurial not lexically sorted: error < match
+ hgext/eol.py:96: multiple imported names: re, os
+ hgext/eol.py:96: stdlib import "re" follows local import: mercurial
+ hgext/extdiff.py:64: imports from mercurial.node not lexically sorted: nullid < short
+ hgext/extdiff.py:65: imports from mercurial not lexically sorted: commands < util
+ hgext/extdiff.py:67: multiple imported names: os, shlex, shutil, tempfile, re
+ hgext/extdiff.py:67: stdlib import "os" follows local import: mercurial
+ hgext/factotum.py:49: direct symbol import passwordmgr from mercurial.url
+ hgext/factotum.py:50: imports from mercurial not lexically sorted: error < httpconnection
+ hgext/factotum.py:51: multiple imported names: os, urllib2
+ hgext/factotum.py:51: stdlib import "os" follows local import: mercurial
+ hgext/fetch.py:12: imports from mercurial not lexically sorted: cmdutil < commands
+ hgext/fetch.py:12: imports from mercurial not lexically sorted: error < util
+ hgext/fetch.py:13: direct symbol import release from mercurial.lock
+ hgext/fsmonitor/pywatchman/__init__.py:30: imports not lexically sorted: errno < os
+ hgext/fsmonitor/pywatchman/__init__.py:43: imports not lexically sorted: capabilities < time
+ hgext/gpg.py:8: multiple imported names: os, tempfile, binascii
+ hgext/gpg.py:9: imports from mercurial not lexically sorted: commands < util
+ hgext/gpg.py:9: imports from mercurial not lexically sorted: cmdutil < match
+ hgext/hgcia.py:46: imports from mercurial not lexically sorted: mail < util
+ hgext/hgcia.py:46: imports from mercurial not lexically sorted: error < mail
+ hgext/hgcia.py:47: stdlib import "email.Parser" follows local import: mercurial
+ hgext/hgcia.py:49: multiple imported names: socket, xmlrpclib
+ hgext/hgcia.py:49: stdlib import "socket" follows local import: mercurial
+ hgext/hgcia.py:50: relative import of stdlib module
+ hgext/hgcia.py:50: direct symbol import saxutils from xml.sax
+ hgext/hgk.py:38: imports from mercurial not lexically sorted: obsolete < scmutil
+ hgext/highlight/__init__.py:30: imports from mercurial.hgweb not lexically sorted: common < webutil
+ hgext/highlight/__init__.py:31: imports from mercurial not lexically sorted: encoding < extensions
+ hgext/highlight/highlight.py:13: imports from mercurial not lexically sorted: encoding < util
+ hgext/highlight/highlight.py:15: direct symbol import highlight from pygments
+ hgext/highlight/highlight.py:16: direct symbol import ClassNotFound from pygments.util
+ hgext/highlight/highlight.py:17: direct symbol import guess_lexer, guess_lexer_for_filename, TextLexer from pygments.lexers
+ hgext/highlight/highlight.py:17: imports from pygments.lexers not lexically sorted: TextLexer < guess_lexer_for_filename
+ hgext/highlight/highlight.py:18: direct symbol import HtmlFormatter from pygments.formatters
+ hgext/histedit.py:173: imports not lexically sorted: errno < pickle
+ hgext/histedit.py:193: direct symbol import release from mercurial.lock
+ hgext/largefiles/__init__.py:114: imports not lexically sorted: overrides < uisetup
+ hgext/largefiles/basestore.py:13: imports from mercurial not lexically sorted: node < util
+ hgext/largefiles/basestore.py:13: imports from mercurial not lexically sorted: hg < node
+ hgext/largefiles/basestore.py:13: imports from mercurial not lexically sorted: error < hg
+ hgext/largefiles/basestore.py:16: imports not lexically sorted: lfutil < re
+ hgext/largefiles/basestore.py:163: multiple imported names: localstore, wirestore
+ hgext/largefiles/lfcommands.py:11: multiple imported names: os, errno
+ hgext/largefiles/lfcommands.py:14: imports from mercurial not lexically sorted: match < util
+ hgext/largefiles/lfcommands.py:14: imports from mercurial not lexically sorted: hg < match
+ hgext/largefiles/lfcommands.py:14: imports from mercurial not lexically sorted: context < node
+ hgext/largefiles/lfcommands.py:14: imports from mercurial not lexically sorted: cmdutil < error
+ hgext/largefiles/lfcommands.py:14: imports from mercurial not lexically sorted: commands < scmutil
+ hgext/largefiles/lfcommands.py:17: direct symbol import release from mercurial.lock
+ hgext/largefiles/lfcommands.py:19: import should be relative: hgext.convert
+ hgext/largefiles/lfcommands.py:20: import should be relative: hgext.convert
+ hgext/largefiles/lfcommands.py:22: imports not lexically sorted: lfutil < shutil
+ hgext/largefiles/lfcommands.py:23: imports not lexically sorted: basestore < lfutil
+ hgext/largefiles/lfutil.py:14: imports not lexically sorted: copy < stat
+ hgext/largefiles/lfutil.py:16: imports from mercurial not lexically sorted: scmutil < util
+ hgext/largefiles/lfutil.py:18: imports from mercurial not lexically sorted: error < node
+ hgext/largefiles/localstore.py:14: imports not lexically sorted: basestore < lfutil
+ hgext/largefiles/overrides.py:12: imports not lexically sorted: copy < os
+ hgext/largefiles/overrides.py:14: imports from mercurial not lexically sorted: cmdutil < util
+ hgext/largefiles/overrides.py:14: imports from mercurial not lexically sorted: match < scmutil
+ hgext/largefiles/overrides.py:14: imports from mercurial not lexically sorted: archival < match
+ hgext/largefiles/overrides.py:14: imports from mercurial not lexically sorted: error < revset
+ hgext/largefiles/overrides.py:19: imports not lexically sorted: lfcommands < lfutil
+ hgext/largefiles/overrides.py:20: imports not lexically sorted: basestore < lfcommands
+ hgext/largefiles/proto.py:19: imports not lexically sorted: lfutil < re
+ hgext/largefiles/remotestore.py:18: imports from mercurial not lexically sorted: error < wireproto
+ hgext/largefiles/remotestore.py:22: imports not lexically sorted: basestore < lfutil
+ hgext/largefiles/reposetup.py:13: imports from mercurial not lexically sorted: error < match
+ hgext/largefiles/reposetup.py:15: imports from mercurial not lexically sorted: localrepo < scmutil
+ hgext/largefiles/reposetup.py:17: imports not lexically sorted: lfcommands < os
+ hgext/largefiles/uisetup.py:11: imports from mercurial not lexically sorted: subrepo < wireproto
+ hgext/largefiles/uisetup.py:11: imports from mercurial not lexically sorted: copies < subrepo
+ hgext/mq.py:66: imports from mercurial.node not lexically sorted: nullid < short
+ hgext/mq.py:67: direct symbol import release from mercurial.lock
+ hgext/mq.py:68: imports from mercurial not lexically sorted: cmdutil < commands
+ hgext/mq.py:68: imports from mercurial not lexically sorted: revset < util
+ hgext/mq.py:70: imports from mercurial not lexically sorted: error < extensions
+ hgext/mq.py:76: multiple imported names: os, re, errno, shutil
+ hgext/mq.py:76: stdlib import "os" follows local import: mercurial
+ hgext/rebase.py:17: imports from mercurial not lexically sorted: repair < util
+ hgext/rebase.py:17: imports from mercurial not lexically sorted: merge < repair
+ hgext/rebase.py:17: imports from mercurial not lexically sorted: cmdutil < merge
+ hgext/rebase.py:17: imports from mercurial not lexically sorted: bookmarks < commands
+ hgext/rebase.py:18: imports from mercurial not lexically sorted: phases < scmutil
+ hgext/rebase.py:18: imports from mercurial not lexically sorted: obsolete < phases
+ hgext/rebase.py:18: imports from mercurial not lexically sorted: error < obsolete
+ hgext/rebase.py:19: imports from mercurial not lexically sorted: registrar < repoview
+ hgext/rebase.py:20: direct symbol import templateopts from mercurial.commands
+ hgext/rebase.py:21: imports from mercurial.node not lexically sorted: nullid < nullrev
+ hgext/rebase.py:21: imports from mercurial.node not lexically sorted: hex < nullid
+ hgext/rebase.py:22: direct symbol import release from mercurial.lock
+ hgext/rebase.py:24: multiple imported names: os, errno
+ hgext/rebase.py:24: stdlib import "os" follows local import: mercurial.i18n
+ hgext/share.py:41: imports from mercurial not lexically sorted: extensions < util
+ hgext/share.py:41: imports from mercurial not lexically sorted: bookmarks < extensions
+ hgext/share.py:42: direct symbol import repository, parseurl from mercurial.hg
+ hgext/share.py:42: imports from mercurial.hg not lexically sorted: parseurl < repository
+ hgext/share.py:43: stdlib import "errno" follows local import: mercurial.hg
+ hgext/win32text.py:47: stdlib import "re" follows local import: mercurial
+ Import cycle: hgext.largefiles.basestore -> hgext.largefiles.localstore -> hgext.largefiles.basestore
+ [1]
+#endif
More information about the Mercurial-devel
mailing list