On Sat, Aug 21, 2021 at 3:35 PM Dan Stromberg <drsali...@gmail.com> wrote:
> On Tue, Aug 17, 2021 at 11:20 AM Chris Angelico <ros...@gmail.com> wrote: > >> The main advantage of ast.parse() is that it no longer cares about >> code layout, and it won't be fooled by an import statement inside a >> docstring, or anything like that. It's also pretty easy to handle >> multiple variants (note how "import bar, baz" just has two things in >> the names list). >> > > I put together something to detect importcycles using the ast module. > It's at https://stromberg.dnsalias.org/svn/cycles/trunk for now - no > pypi, no homepage. I've only run it on some test inputs, nothing > substantial. Usage example is in the Makefile. > > Imports are kind of complicated. Am I missing any important cases? > > Sample output looks like: > Detected 2 cycles: > ('mutual_1', 'mutual_2') > ('directory.mutual_a', 'directory.mutual_b', 'directory.mutual_c') > > Thanks! > BTW, "readline0.py" is in the project as a Subversion external reference, so just going to the URL above in a browser won't show it. But you can install an svn binary and then: svn checkout https://stromberg.dnsalias.org/svn/cycles/trunk That should get all of it, including readline0.py -- https://mail.python.org/mailman/listinfo/python-list