• Re: Tool that can document private inner class?

    From Weatherby,Gerard@21:1/5 to All on Tue Feb 7 20:53:30 2023
    Yes.

    Inspect module

    import inspect


    class Mine:

    def __init__(self):
    self.__value = 7

    def __getvalue(self):
    """Gets seven"""
    return self.__value


    mine = Mine()
    data = inspect.getdoc(mine)
    for m in inspect.getmembers(mine):
    if '__getvalue' in m[0]:
    d = inspect.getdoc(m[1])
    print(d)


    From: Python-list <python-list-bounces+gweatherby=uchc.edu@python.org> on behalf of Ian Pilcher <arequipeno@gmail.com>
    Date: Tuesday, February 7, 2023 at 3:34 PM
    To: python-list@python.org <python-list@python.org>
    Subject: Tool that can document private inner class?
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    I've been banging my head on Sphinx for a couple of days now, trying to
    get it to include the docstrings of a private (name starts with two underscores) inner class. All I've managed to do is convince myself
    that it really can't do it.

    See https://urldefense.com/v3/__https://github.com/sphinx-doc/sphinx/issues/11181__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh9C4AH_g$<https://urldefense.com/v3/__https:/github.com/sphinx-doc/sphinx/issues/
    11181__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh9C4AH_g$> .

    Is there a tool out there that can do this?

    --
    ========================================================================
    Google Where SkyNet meets Idiocracy ========================================================================
    -- https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh_9Xz7jg$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/
    python-list__;!!Cn_UX_p3!nTY5lSlEetgdaUdvelXo0VuYFt8-2nTnGIxK5whhkN8wXilJfeWOjyS9RJfSLbu9R6cwmmtjxYYDCfh_9Xz7jg$>

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ian Pilcher@21:1/5 to All on Tue Feb 7 14:32:39 2023
    I've been banging my head on Sphinx for a couple of days now, trying to
    get it to include the docstrings of a private (name starts with two underscores) inner class. All I've managed to do is convince myself
    that it really can't do it.

    See https://github.com/sphinx-doc/sphinx/issues/11181.

    Is there a tool out there that can do this?

    --
    ========================================================================
    Google Where SkyNet meets Idiocracy ========================================================================

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ian Pilcher@21:1/5 to Gerard on Tue Feb 7 15:01:23 2023
    On 2/7/23 14:53, Weatherby,Gerard wrote:
    Yes.

    Inspect module

    import inspect


    class Mine:

    def __init__(self):
    self.__value = 7

    def __getvalue(self):
    /"""Gets seven"""
    /return self.__value


    mine = Mine()
    data = inspect.getdoc(mine)
    for m in inspect.getmembers(mine):
    if '__getvalue' in m[0]:
            d = inspect.getdoc(m[1])
    print(d)


    Can inspect generate HTML documentation, à la Sphinx and other tools?

    --
    ========================================================================
    Google Where SkyNet meets Idiocracy ========================================================================

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Stefan Ram@21:1/5 to Ian Pilcher on Tue Feb 7 21:19:20 2023
    Ian Pilcher <arequipeno@gmail.com> writes:
    Can inspect generate HTML documentation, à la Sphinx and other tools?

    You could use inspect to generate HTML documentation by manually
    programming the conversion to HTML, but maybe it would be more
    appropriate to use inspect to generate a file in the reStructuredText
    format, which then possibly could be processed by Sphinx just as
    Sphinx would process a reStructuredText file that has been written
    manually. But I don't know whether this can be intergrated in every
    existing Sphinx process. I have no experience with Sphinx.

    However, I find Sphinx very interesting! I am planing a program
    that will convert a text file with markup into HTML, and recently
    discovered that Sphinx is very much like the system I want to create.
    However, I still want to write my own implementation as I like to
    be able to incorporate my own ideas and language design.

    Right now, I am writing a prototype implementation that already
    should be useful but only contains "low-hanging fruits" which
    are easy for me to implement. I hope to finish it this month.
    Then I am planning a rewrite with all my ideas, even those that
    are harder to implement, to be finished within about three years.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Weatherby,Gerard@21:1/5 to Gerard on Wed Feb 8 14:25:59 2023
    No.

    I interpreted your query as is there something that can read docstrings of dunder methods?

    Have you tried the Sphinx specific support forums? https://www.sphinx-doc.org/en/master/support.html

    From: Ian Pilcher <arequipeno@gmail.com>
    Date: Tuesday, February 7, 2023 at 4:01 PM
    To: Weatherby,Gerard <gweatherby@uchc.edu>, python-list@python.org <python-list@python.org>
    Subject: Re: Tool that can document private inner class?
    *** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

    On 2/7/23 14:53, Weatherby,Gerard wrote:
    Yes.

    Inspect module

    import inspect


    class Mine:

    def __init__(self):
    self.__value = 7

    def __getvalue(self):
    /"""Gets seven"""
    /return self.__value


    mine = Mine()
    data = inspect.getdoc(mine)
    for m in inspect.getmembers(mine):
    if '__getvalue' in m[0]:
    d = inspect.getdoc(m[1])
    print(d)


    Can inspect generate HTML documentation, la Sphinx and other tools?

    --
    ========================================================================
    Google Where SkyNet meets Idiocracy ========================================================================

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ian Pilcher@21:1/5 to Gerard on Wed Feb 8 13:22:16 2023
    On 2/8/23 08:25, Weatherby,Gerard wrote:
    No.

    I interpreted your query as “is there something that can read docstrings
    of dunder methods?”

    Have you tried the Sphinx specific support forums? https://www.sphinx-doc.org/en/master/support.html

    Yes. I've posted to both the -user and -dev groups, and I've also filed
    an issue[1]. I haven't received a response.

    Thus my conclusion that Sphinx, specifically autodoc, simply can't do
    this.

    [1] https://github.com/sphinx-doc/sphinx/issues/11181

    --
    ========================================================================
    Google Where SkyNet meets Idiocracy ========================================================================

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)