mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
refined docstr parsing for builtins, because psycopg2 didn't run, even so I thought it would.
This commit is contained in:
@@ -378,14 +378,15 @@ def parse_function_doc(func):
|
||||
end = 0
|
||||
param_str = ''
|
||||
|
||||
try:
|
||||
index = doc.index('-> ', end, end + 7)
|
||||
except (ValueError, AttributeError):
|
||||
if doc is not None:
|
||||
r = re.search('-[>-]* ', doc[end:end+7])
|
||||
if doc is None or r is None:
|
||||
ret = 'pass'
|
||||
else:
|
||||
index = end + r.end()
|
||||
# get result type, which can contain newlines
|
||||
pattern = re.compile(r'(,\n|[^\n-])+')
|
||||
ret_str = pattern.match(doc, index + 3).group(0).strip()
|
||||
ret_str = pattern.match(doc, index).group(0).strip()
|
||||
# New object -> object()
|
||||
ret_str = re.sub(r'[nN]ew (.*)', r'\1()', ret_str)
|
||||
|
||||
|
||||
2
test/completion/thirdparty/psycopg2_.py
vendored
2
test/completion/thirdparty/psycopg2_.py
vendored
@@ -1,3 +1,5 @@
|
||||
import psycopg2
|
||||
|
||||
conn = psycopg2.connect('dbname=test')
|
||||
|
||||
#? ['cursor']
|
||||
|
||||
Reference in New Issue
Block a user