Giter Site home page Giter Site logo

bug: python return annotations about neogen HOT 11 CLOSED

danymat avatar danymat commented on August 17, 2024
bug: python return annotations

from neogen.

Comments (11)

danymat avatar danymat commented on August 17, 2024 4
  • None should now be hidden
  • reference to self is now removed

from neogen.

danymat avatar danymat commented on August 17, 2024 1

Last commit should fix it, a single line that did this lol. Is everything ok ?

from neogen.

quantum-booty avatar quantum-booty commented on August 17, 2024 1

nice xD good work!

from neogen.

danymat avatar danymat commented on August 17, 2024

Related: #41 (comment)

from neogen.

danymat avatar danymat commented on August 17, 2024

I think I just added support for type hints, and fixed the bug at the same time
Can you try it out ?

from neogen.

quantum-booty avatar quantum-booty commented on August 17, 2024

Thanks a lot @danymat!
This is what I'm getting, I think self should not be a parameter

    def __str__(self) -> str:
        """

        Parameters
        ----------
        self: 
        	

        Returns
        -------
        str
        	
        """
        config_str = ""
        for row in self.tile:
            row_str = "".join(row)
            config_str += row_str + "\n"
        return config_str.strip()

from neogen.

quantum-booty avatar quantum-booty commented on August 17, 2024

I think the point about self should also apply to classmethods

    @classmethod
    def test(cls) -> None:
        """

        Parameters
        ----------
        cls: 
        	

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

I expect that cls should not be a parameter.

from neogen.

quantum-booty avatar quantum-booty commented on August 17, 2024

Also I think -> None should not generate a return type, because that is the default value thats being returned by a function.
So rather than this:

def test(a: int) -> None:
    """

    Parameters
    ----------
    a: int
    	

    Returns
    -------
    int
    	
    None
    	
    """
    pass

I don't expect it to generate a doc for None returns.

def test(a: int) -> None:
    """

    Parameters
    ----------
    a: int

    """
    pass

from neogen.

danymat avatar danymat commented on August 17, 2024

I think the point about self should also apply to classmethods

    @classmethod
    def test(cls) -> None:
        """

        Parameters
        ----------
        cls: 
        	

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

I expect that cls should not be a parameter.

This seems to be a little bit difficult to do, I don't think I will do it tonight

from neogen.

danymat avatar danymat commented on August 17, 2024

Hello, I think that commit d46c438 did provide a very great handling of such self, clscases. Can you take a look and try again ?

from neogen.

quantum-booty avatar quantum-booty commented on August 17, 2024
class Test:
    @staticmethod
    def test2(a: int, b: str):
        """

        Parameters
        ----------
        a: int
            
        b: str
            

        Returns
        -------
        int
            
        str
            
        """
        pass
        

    @classmethod
    def test(cls, a: int, b: str):
        """

        Parameters
        ----------
        a: int
            
        b: str
            

        Returns
        -------
        int
            
        str
            
        """
        pass
        

    def test1(self, a: int, b: str):
        """

        Parameters
        ----------
        a: int
            
        b: str
            

        Returns
        -------
        int
            
        str
            
        """
        pass
       

Thanks @danymat I think that did fix the self and cls cases.
I think I've found another bug, some how its generating return int and str types.

from neogen.

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.