Feature: Add open close parentheses for attribute suggestions that are methods by rybarczykj · Pull Request #840 · bpython/bpython
def after_last_dot(name): """matches are stored as 'math.cos', 'math.sin', etc. This function returns just 'cos' or 'sin' """ return name.rstrip(".").rsplit(".")[-1]
def matches(self, cursor_offset, line, **kwargs): """Returns a list of possible matches given a line and cursor, or None if this completion type isn't applicable. if this completion type isn't applicable. Callable matches will end with open close parens "()", but when they are replaced, parens are removed.
ie, import completion doesn't make sense if there cursor isn't after an import or from statement, so it ought to return None.
def list_attributes(self, obj):
def _callable_postfix(value, word): """rlcompleter's _callable_postfix done right.""" if callable(value): word += "(" if inspection.is_callable(value): word += "()" return word