comparison contrib/import-checker.py @ 48879:9987d14ad63f

py2: drop some more from __future__ statements These are no longer needed after dropping support for Python 2. Differential Revision: https://phab.mercurial-scm.org/D12258
author Gregory Szorc <gregory.szorc@gmail.com>
date Sun, 20 Feb 2022 15:35:09 -0700
parents 6000f5b25c9b
children 8dec9abf2669
comparison
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))))