Esempio n. 1
0
 def infer(self):
     """Find a more specific representation of the variable content.
     """
     infereds = self.astng_element.infered()
     if infereds:
         return LanguageElement.create(infereds[0], context_string=self.context_string)
     log("Could not infer name: %s" % self.name())
     return LeNoneType(None)
Esempio n. 2
0
 def infer(self):
     """Find a more specific representation of the variable content.
     """
     infereds = self.astng_element.infered()
     if infereds:
         return LanguageElement.create(infereds[0],
                                       context_string=self.context_string)
     log("Could not infer name: %s" % self.name())
     return LeNoneType(None)
Esempio n. 3
0
def completion(file_state, base='', completion_builder=None):
    """Returns the completion.

    Use this function as entry point to this module.  See __init__.completion.
    """
    try:
        accessibles = file_state.accessibles()
        accessibles.sort()
        return [accessible.completion_entry(completion_builder, file_state)
                for accessible in accessibles if accessible.startswith(base)]
    except Exception, exc:
        log(exc)
        import traceback
        log(traceback.format_exc())
        return []
Esempio n. 4
0
def completion(file_state, base='', completion_builder=None):
    """Returns the completion.

    Use this function as entry point to this module.  See __init__.completion.
    """
    try:
        accessibles = file_state.accessibles()
        accessibles.sort()
        return [
            accessible.completion_entry(completion_builder, file_state)
            for accessible in accessibles if accessible.startswith(base)
        ]
    except Exception, exc:
        log(exc)
        import traceback
        log(traceback.format_exc())
        return []
Esempio n. 5
0
def vim_completion_builder(completionable, file_state):
    """Completion builder for a entry of the VIM omni completion.
    """
    try:
        complex_name = completionable.complex_name()
        if file_state:
            if file_state.is_import_path() or file_state.is_from_import():
                complex_name = completionable.name()
        return {
            'word': complex_name,
            'abbr': completionable.name(),
            'kind': completionable.kind(),
            'menu': str(completionable.linenumber() or ''),
            'dup': '1',
        }
    except Exception, exc:
        log(exc)
        import traceback
        log(traceback.format_exc())
        return completionable.name()