Skip to content

Commit

Permalink
Merge a724a7d into 9b69f3a
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Aug 13, 2015
2 parents 9b69f3a + a724a7d commit d188d66
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
6 changes: 6 additions & 0 deletions jedi/evaluate/docstrings.py
Expand Up @@ -29,11 +29,13 @@
r'\s*:type\s+%s:\s*([^\n]+)', # Sphinx
r'\s*:param\s+(\w+)\s+%s:[^\n]+', # Sphinx param with type
r'\s*@type\s+%s:\s*([^\n]+)', # Epydoc
'\s*%s\s*\((.+?)\):.+', # Google param with type
]

DOCSTRING_RETURN_PATTERNS = [
re.compile(r'\s*:rtype:\s*([^\n]+)', re.M), # Sphinx
re.compile(r'\s*@rtype:\s*([^\n]+)', re.M), # Epydoc
re.compile(r'\s*Returns:\s*([^:]+):.*', re.M), # Google
]

REST_ROLE_PATTERN = re.compile(r':[^`]+:`([^`]+)`')
Expand Down Expand Up @@ -77,6 +79,10 @@ def _search_param_in_docstr(docstr, param_str):
False
>>> _search_param_in_docstr(':param int param: some description', 'param')
['int']
>>> _search_param_in_docstr('param (int): doc', 'param')
['int']
>>> _search_param_in_docstr('param: doc', 'param')
[]
"""
# look at #40 to see definitions of those params
Expand Down
38 changes: 35 additions & 3 deletions test/completion/docstring.py
Expand Up @@ -39,16 +39,48 @@ def sphinxy2(a, b, x):
:param x: Just something without type
:rtype:
"""
#?
#?
a
#?
#?
b
#?
x

#?
#?
sphinxy2()

# -----------------
# google style
# -----------------
def sphinx_google(a, b, c, d, x):
""" asdfasdf
Args:
a (str): blablabla
b (str, int): b
c (random.Random): c
d (random.Random): d
x: blablabla
Returns:
dict: Some dict
"""
#? str()
a
#? str()
b[0]
#? int()
b[1]
#? ['seed']
c.seed
#? ['seed']
d.seed
#?
x.lower

#? dict()
sphinx_google()

# local classes -> github #370
class ProgramNode():
pass
Expand Down

0 comments on commit d188d66

Please sign in to comment.