Skip to content

Instantly share code, notes, and snippets.

@ssbarnea
Created December 16, 2011 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssbarnea/1486122 to your computer and use it in GitHub Desktop.
Save ssbarnea/1486122 to your computer and use it in GitHub Desktop.
pycharm-auto-complete-test.py
#!/usr/bin/env python
class MyClass():
def alpha(self):
pass
def beta(self):
pass
def getProxy(self):
"""This is description...
:return: MyClass -- bla bla
"""
return "" # imagine that here you have a function that returns you an XMLRPC proxy object of type MyClass
if __name__ == '__main__':
x = getProxy()
x.alpha() # this doen't AUTOCOMPLETE
x.capitalize() # this does autocomplete
@ssbarnea
Copy link
Author

This example is inspired from how xmlrpclib works.

@vlasovskikh
Copy link

@ssbarnea Types from docstrings already have precedence over inferred return types. Your type annotation just doesn't follow Sphinx annotation conventions.

The correct way of annotating this function in Sphinx is:

def getProxy(self):
    """This is description...

    :return: bla bla
    :rtype: MyClass
    """
    return "" # imagine that here you have a function that returns you an XMLRPC proxy object of type MyClass

See also PY-7277.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment