def get_proposals(project, source, offset=None, **kwargs): head = 'from scopetest import *\n\n' source = head + source if offset is None: offset = len(source) else: offset += len(head) resource = NoProject().get_file(join_to_file_dir(__file__, 'module.py')) resource.read = lambda: '' return code_assist(project, source, offset, resource=resource, **kwargs)
def get_rope_resource(self, project, uri=None): from rope.base import libutils, exceptions uri = uri or self.editor.uri if not hasattr(project, 'address'): return project.get_file(uri) else: try: return libutils.path_to_resource(project, uri) except exceptions.ResourceNotFoundError: from rope.base.project import NoProject resource = NoProject().get_file(uri) resource.read = lambda: '' return resource
def get_proposals(project, source, offset=None, **kwargs): head = ( 'class Window(object):\n' ' """glade-file: sample.glade"""\n' '\n' ' def func(self):\n' ' ' ) source = head + source if offset is None: offset = len(source) else: offset += len(head) resource = NoProject().get_file(join_to_file_dir(__file__, 'pygtktest', 'module.py')) resource.read = lambda: '' return code_assist(project, source, offset, resource=resource, **kwargs)