summaryrefslogtreecommitdiff
path: root/python/bncompleter.py
diff options
context:
space:
mode:
authorJordan Wiens <jordan@psifertex.com>2019-09-03 17:15:21 -0400
committerJordan Wiens <jordan@psifertex.com>2019-09-03 17:15:21 -0400
commit5f1d62a23606928f8ffcb4b4bd03f6eb45ed9f26 (patch)
treec91bf4497d0658a3b7609077d6257d1cd729fce2 /python/bncompleter.py
parent3ccd563f68ab9b19edfe8e79d592e59645a44d36 (diff)
python2 support for completion through arrays, also add parenthesis for function calls
Diffstat (limited to 'python/bncompleter.py')
-rw-r--r--python/bncompleter.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/python/bncompleter.py b/python/bncompleter.py
index b80cabca..fabb7fc2 100644
--- a/python/bncompleter.py
+++ b/python/bncompleter.py
@@ -39,7 +39,8 @@ Notes:
"""
import atexit
-import builtins
+from six.moves import builtins
+from six import class_types
import __main__
__all__ = ["Completer"]
@@ -99,7 +100,7 @@ class Completer:
return None
def _callable_postfix(self, val, word):
- if callable(val):
+ if callable(val) and not isinstance(val, class_types):
word = word + "("
return word
@@ -144,7 +145,7 @@ class Completer:
"""
import re
- m = re.match(r"([\w\[\]]+(\.[\w\[\]]+)*)\.(\w*)", text)
+ m = re.match(r"([\w\[\]]+(\.[\w\[\]]+)*)\.([\w\[\]]*)", text)
if not m:
return []
expr, attr = m.group(1, 3)