On Mon, Dec 15, 2014 at 6:27 PM, Anne Mulhern <amulh...@redhat.com> wrote: > Hi! > > Pretend I have classes: > > class A(object): > pass > > class B(object): > pass > > class C(A,B): > pass > > class D(object): > pass > > The MRO linearizations are: > > L(object) = [object] > L(A) = [A, object] > L(B) = [B, object] > L(C) = [C, A, B, object] > L(D) = [D, object] > > I'll say that L(X) > L(Y) if every > c in L(Y) occurs in L(X). By that rule > L(C) and L(D) are maximal linearizations. > > I want to write an analysis which would > work best if I could gather up all the > linearization of all classes in a possibly > large package distributed over possibly > many files and find only > the maximal linearizations. > > This is really a kind of whole-program analysis. > > I don't believe that this fits the pylint model > very well, since it is reasonable to expect that > pylint would be run separately on each individual > file in a library. > > Are there other analyses around that make use of > astroid and are more whole-program like? > > Thanks!
Hi, Anne. I'm currently working on adding mro support in astroid (need it to solve a false positive in Pylint). After this, it will be easy to use astroid for your task, by walking each file in your package, build an astroid.module with AstroidBuilder.file_build, get all the classes using Module.nodes_of_class and finally calling .mro for each one. I'll push the change to astroid tonight. _______________________________________________ code-quality mailing list code-quality@python.org https://mail.python.org/mailman/listinfo/code-quality