GithubHelp home page GithubHelp logo

Class Docstring about autodocstring HOT 12 OPEN

nilsjpwerner avatar nilsjpwerner commented on June 12, 2024 30
Class Docstring

from autodocstring.

Comments (12)

NilsJPWerner avatar NilsJPWerner commented on June 12, 2024 12

It's in the works :)

from autodocstring.

MohamedAliRashad avatar MohamedAliRashad commented on June 12, 2024 7

Is this still being developed or the idea died ?

I see this format to be nice for classes

class Person:
    """
    A class to represent a person.

    ...

    Attributes
    ----------
    name : str
        first name of the person
    surname : str
        family name of the person
    age : int
        age of the person

    Methods
    -------
    info(additional=""):
        Prints the person's name and age.
    """

    def __init__(self, name, surname, age):
        """
        Constructs all the necessary attributes for the person object.

        Parameters
        ----------
            name : str
                first name of the person
            surname : str
                family name of the person
            age : int
                age of the person
        """

        self.name = name
        self.surname = surname
        self.age = age

    def info(self, additional=""):
        """
        Prints the person's name and age.

        If the argument 'additional' is passed, then it is appended after the main info.

        Parameters
        ----------
        additional : str, optional
            More info to be displayed (default is None)

        Returns
        -------
        None
        """

        print(f'My name is {self.name} {self.surname}. I am {self.age} years old.' + additional)

from autodocstring.

jss367 avatar jss367 commented on June 12, 2024 3

I really like this idea. @NilsJPWerner is this still in development? Thanks for writing a great extension!

from autodocstring.

tracetidwell avatar tracetidwell commented on June 12, 2024 3

I submitted a PR a while back, and Nils made some comments. I need to incorporate his suggestions and then resubmit. I have been super busy lately, but I will try to get this done within the next week or two. Thanks for inquiring guys. Hopefully it will provide the motivation to wrap this thing up.

from autodocstring.

zgoda-mobica avatar zgoda-mobica commented on June 12, 2024 1

The docstring as inserted for the class is inconsistent at least. If the class has superclass:

class Pipeline(PackageAwareObjectMixin):
    """[summary]

    :param PackageAwareObjectMixin: [description]
    :type PackageAwareObjectMixin: [type]
    """

If not it's fine but:

class Something:
    """[summary]
    
    :raises ValueError: [description]
    """

    def __init__(self, a, b=None):
        raise ValueError('OMG!')

from autodocstring.

aaronsmith1234 avatar aaronsmith1234 commented on June 12, 2024 1

Interested in this as well!

from autodocstring.

remidinishanth-ntnx avatar remidinishanth-ntnx commented on June 12, 2024 1

Any update on this?

from autodocstring.

tracetidwell avatar tracetidwell commented on June 12, 2024 1

Hello, Nils. I actually added class docstrings and module docstrings. It seems to be working, but I haven't been able to get the original tests running. I had never used TypeScript before (or created an extension for that matter), so I'd like to get things tested. Should I just go ahead and create a PR?

from autodocstring.

NilsJPWerner avatar NilsJPWerner commented on June 12, 2024 1

I'm happy to go over it again @tracetidwell

from autodocstring.

mobiusklein avatar mobiusklein commented on June 12, 2024

I have a fork where I had this feature working for the previous version. I was still trying to debug some unreliable function detection when indented. It involved a modest re-write of the code parsing machinery. Is there any progress on similar features for the updated version, or should I update my fork and re-implement it against the new parsing and rendering machinery?

from autodocstring.

mrajancsr avatar mrajancsr commented on June 12, 2024

Has this been addressed? Having trouble generating docstring for classes unless it's within the constructor. Thanks

from autodocstring.

matsuobasho avatar matsuobasho commented on June 12, 2024

I second this. I'm specifically looking for the feature for classes so that the docstring includes attributes as defined in init. What is the status of this?

from autodocstring.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.