'Get a list of (completion, type) tuples using Rope'

def get_completions(self, info):

    if (self.project is None):
        return []
    filename = info['filename']
    source_code = info['source_code']
    offset = info['position']
    lines = sourcecode.split_source(source_code[:offset])
    last_line = lines[(-1)].lstrip()
    if ((last_line.startswith('import    ') or last_line.startswith('from    ')) and (not (';' in last_line))):
        return []
    if PY2:
        filename = filename.encode('utf-8')
    else:
        pass
    try:
        resource = rope.base.libutils.path_to_resource(self.project, filename)
    except Exception as _error:
        if DEBUG_EDITOR:
            log_last_error(LOG_FILENAME, ('path_to_resource:    %r' % filename))
        resource = None
    try:
        if DEBUG_EDITOR:
            t0 = time.time()
        proposals = rope.contrib.codeassist.code_assist(self.project, source_code, offset, resource, maxfixes=3)
        proposals = rope.contrib.codeassist.sorted_proposals(proposals)
        if DEBUG_EDITOR:
            log_dt(LOG_FILENAME, 'code_assist/sorted_proposals', t0)
        return [(proposal.name, proposal.type) for proposal in proposals]
    except Exception as _error:
        if DEBUG_EDITOR:
            log_last_error(LOG_FILENAME, 'get_completion_list')
    return []
