From 5f1d62a23606928f8ffcb4b4bd03f6eb45ed9f26 Mon Sep 17 00:00:00 2001 From: Jordan Wiens Date: Tue, 3 Sep 2019 17:15:21 -0400 Subject: python2 support for completion through arrays, also add parenthesis for function calls --- python/bncompleter.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'python') 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) -- cgit v1.3.1