sphinx-automodapi icon indicating copy to clipboard operation
sphinx-automodapi copied to clipboard

automodapi inheritance diagram self-looping arrow

Open pllim opened this issue 8 years ago • 5 comments

Most people probably won't encounter this but it does happen when you have a subclass that shares the same name as its parent class. Example:

from astropy.modeling import models as _models

class Box1D(_models.Box1D):
    """Extends the original Box1D with some special magic."""
    pass

The resultant inheritance diagram using automodapi makes a loop of the class on itself. It is harmless but appears quite funny and potentially confusing. I don't even know if a fix is possible or necessary. Just want to point it out.

untitled

pllim avatar Dec 09 '16 16:12 pllim

Oh interesting... I'm not sure this can be fixed exactly the way you might expect, because the underlying diagram code uses graphviz, which keys on names.

Before I try to fix, if there isn't a way to have them show the same name, what do you think would make sense @pllim ? Maybe something like Box1D (#2)?

eteq avatar Dec 16 '16 22:12 eteq

GitHub has spoiled the # for me as I associate it with issue number now. I am not sure what would be a less confusing representation. Box1D (2) (without the # maybe) might just be as good as any?

pllim avatar Dec 18 '16 02:12 pllim

Or maybe just leave it as Box1D -> Box1D? Since when you mouse over, you will get more info about where the class is coming from anyway, right?

pllim avatar Dec 18 '16 02:12 pllim

@pllim - don't think your second option here is possible because of the origin of ths issue (that graphviz keys on names.) But it might be that "Box1D" and "Box1D " (note the space in the second one) are considered different? That will acheive a very similar appearence, at least...

eteq avatar May 11 '17 14:05 eteq

@eteq , sure, I'm not picky on this.

pllim avatar May 11 '17 15:05 pllim