contrib/import-checker.py
changeset 48879 9987d14ad63f
parent 48875 6000f5b25c9b
child 48961 8dec9abf2669
equal deleted inserted replaced
48878:0583d7f0fdff 48879:9987d14ad63f
   624 def find_cycles(imports):
   624 def find_cycles(imports):
   625     """Find cycles in an already-loaded import graph.
   625     """Find cycles in an already-loaded import graph.
   626 
   626 
   627     All module names recorded in `imports` should be absolute one.
   627     All module names recorded in `imports` should be absolute one.
   628 
   628 
   629     >>> from __future__ import print_function
       
   630     >>> imports = {'top.foo': ['top.bar', 'os.path', 'top.qux'],
   629     >>> imports = {'top.foo': ['top.bar', 'os.path', 'top.qux'],
   631     ...            'top.bar': ['top.baz', 'sys'],
   630     ...            'top.bar': ['top.baz', 'sys'],
   632     ...            'top.baz': ['top.foo'],
   631     ...            'top.baz': ['top.foo'],
   633     ...            'top.qux': ['top.foo']}
   632     ...            'top.qux': ['top.foo']}
   634     >>> print('\\n'.join(sorted(find_cycles(imports))))
   633     >>> print('\\n'.join(sorted(find_cycles(imports))))