From c9fb4824807b4dc0b2e554bee69d4eee398e19cc Mon Sep 17 00:00:00 2001 From: David Halter Date: Mon, 3 Sep 2012 01:02:38 +0200 Subject: [PATCH] psycopg2 fix for github issue 4 --- builtin.py | 3 +++ test/completion/thirdparty/psycopg.py | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/completion/thirdparty/psycopg.py diff --git a/builtin.py b/builtin.py index 056b015f..ce467c20 100644 --- a/builtin.py +++ b/builtin.py @@ -386,6 +386,9 @@ def parse_function_doc(func): # get result type, which can contain newlines pattern = re.compile(r'(,\n|[^\n-])+') ret_str = pattern.match(doc, index + 3).group(0).strip() + # New object -> object() + ret_str = re.sub(r'[nN]ew (.*)', r'\1()', ret_str) + ret = Parser.map_types.get(ret_str, ret_str) if ret == ret_str and ret not in ['None', 'object', 'tuple', 'set']: debug.dbg('not working', ret_str) diff --git a/test/completion/thirdparty/psycopg.py b/test/completion/thirdparty/psycopg.py new file mode 100644 index 00000000..89e6f050 --- /dev/null +++ b/test/completion/thirdparty/psycopg.py @@ -0,0 +1,9 @@ +conn = psycopg2.connect('dbname=test') + +#? ['cursor'] +conn.cursor + +cur = conn.cursor() + +#? ['fetchall'] +cur.fetchall