##// END OF EJS Templates
import-checker: don't treat modules as relative one if not found...
FUJIWARA Katsunori -
r25175:10e6c4b7 default
parent child Browse files
Show More
@@ -293,8 +293,6 b' def checkmod(mod, imports):'
293 293 while visit:
294 294 path = visit.pop(0)
295 295 for i in sorted(imports.get(path[-1], [])):
296 if i not in stdlib_modules and not i.startswith('mercurial.'):
297 i = mod.rsplit('.', 1)[0] + '.' + i
298 296 if len(path) < shortest.get(i, 1000):
299 297 shortest[i] = len(path)
300 298 if i in path:
@@ -316,10 +314,12 b' def rotatecycle(cycle):'
316 314 def find_cycles(imports):
317 315 """Find cycles in an already-loaded import graph.
318 316
319 >>> imports = {'top.foo': ['bar', 'os.path', 'qux'],
320 ... 'top.bar': ['baz', 'sys'],
321 ... 'top.baz': ['foo'],
322 ... 'top.qux': ['foo']}
317 All module names recorded in `imports` should be absolute one.
318
319 >>> imports = {'top.foo': ['top.bar', 'os.path', 'top.qux'],
320 ... 'top.bar': ['top.baz', 'sys'],
321 ... 'top.baz': ['top.foo'],
322 ... 'top.qux': ['top.foo']}
323 323 >>> print '\\n'.join(sorted(find_cycles(imports)))
324 324 top.bar -> top.baz -> top.foo -> top.bar
325 325 top.foo -> top.qux -> top.foo
General Comments 0
You need to be logged in to leave comments. Login now