Show More
@@ -139,7 +139,7 b' def verify_stdlib_on_own_line(source):' | |||
|
139 | 139 | http://bugs.python.org/issue19510. |
|
140 | 140 | |
|
141 | 141 | >>> list(verify_stdlib_on_own_line('import sys, foo')) |
|
142 |
['mixed stdlib |
|
|
142 | ['mixed imports\\n stdlib: sys\\n relative: foo'] | |
|
143 | 143 | >>> list(verify_stdlib_on_own_line('import sys, os')) |
|
144 | 144 | [] |
|
145 | 145 | >>> list(verify_stdlib_on_own_line('import foo, bar')) |
@@ -147,13 +147,13 b' def verify_stdlib_on_own_line(source):' | |||
|
147 | 147 | """ |
|
148 | 148 | for node in ast.walk(ast.parse(source)): |
|
149 | 149 | if isinstance(node, ast.Import): |
|
150 | from_stdlib = {} | |
|
150 | from_stdlib = {False: [], True: []} | |
|
151 | 151 | for n in node.names: |
|
152 |
from_stdlib[n.name |
|
|
153 | num_std = len([x for x in from_stdlib.values() if x]) | |
|
154 | if num_std not in (len(from_stdlib.values()), 0): | |
|
155 | yield ('mixed stdlib and relative imports:\n %s' % | |
|
156 |
', '.join(sorted(from_stdlib |
|
|
152 | from_stdlib[n.name in stdlib_modules].append(n.name) | |
|
153 | if from_stdlib[True] and from_stdlib[False]: | |
|
154 | yield ('mixed imports\n stdlib: %s\n relative: %s' % | |
|
155 | (', '.join(sorted(from_stdlib[True])), | |
|
156 | ', '.join(sorted(from_stdlib[False])))) | |
|
157 | 157 | |
|
158 | 158 | class CircularImport(Exception): |
|
159 | 159 | pass |
@@ -23,16 +23,21 b' hidden by deduplication algorithm in the' | |||
|
23 | 23 | these may expose other cycles. |
|
24 | 24 | |
|
25 | 25 | $ hg locate 'mercurial/**.py' | xargs python "$import_checker" |
|
26 |
mercurial/dispatch.py mixed |
|
|
27 | commands, error, extensions, fancyopts, hg, hook, util | |
|
28 | mercurial/fileset.py mixed stdlib and relative imports: | |
|
29 | error, merge, parser, util | |
|
30 | mercurial/revset.py mixed stdlib and relative imports: | |
|
31 | discovery, error, hbisect, parser, phases, util | |
|
32 |
mercurial/ |
|
|
33 | config, error, parser, templatefilters, util | |
|
34 | mercurial/ui.py mixed stdlib and relative imports: | |
|
35 | config, error, formatter, scmutil, util | |
|
26 | mercurial/dispatch.py mixed imports | |
|
27 | stdlib: commands | |
|
28 | relative: error, extensions, fancyopts, hg, hook, util | |
|
29 | mercurial/fileset.py mixed imports | |
|
30 | stdlib: parser | |
|
31 | relative: error, merge, util | |
|
32 | mercurial/revset.py mixed imports | |
|
33 | stdlib: parser | |
|
34 | relative: discovery, error, hbisect, phases, util | |
|
35 | mercurial/templater.py mixed imports | |
|
36 | stdlib: parser | |
|
37 | relative: config, error, templatefilters, util | |
|
38 | mercurial/ui.py mixed imports | |
|
39 | stdlib: formatter | |
|
40 | relative: config, error, scmutil, util | |
|
36 | 41 | Import cycle: mercurial.cmdutil -> mercurial.subrepo -> mercurial.cmdutil |
|
37 | 42 | Import cycle: mercurial.repoview -> mercurial.revset -> mercurial.repoview |
|
38 | 43 | Import cycle: mercurial.fileset -> mercurial.merge -> mercurial.subrepo -> mercurial.match -> mercurial.fileset |
General Comments 0
You need to be logged in to leave comments.
Login now