Beispiel #1
0
def scan_command(directory, tagfile='STAG.sqlite', verbose=False):
    """Scan a directory tree for definitions and references."""

    init_logging(verbose)

    with StorageManager(Storage(tagfile)) as s:
        s.clear_defs()

        storage = StorageActor.start(s)
        parser_map = [
            (list(p.patterns()),
             ParserActor.start(p.create_parser(), storage))
            for p in parser_plugins()]

        dispatcher = DispatcherActor.start(parser_map)

        def dispatch_file(args):
            "Send results of os.walk to the dispatcher."
            dirpath, _, filenames = args
            for fname in filenames:
                dispatcher.tell({
                    'command': 'dispatch',
                    'filename': os.path.join(dirpath, fname)
        })

        emap(dispatch_file, os.walk(directory))

        # Shut everything down.
        ActorRegistry.stop_all()
Beispiel #2
0
    def __init__(self, project_dir, cross_project_dirs=[]):
        super(Project, self).__init__()

        self.proj = rope.base.project.Project(project_dir)

        self.cross_projects = dict()

        cross_dirs = set(cross_project_dirs)
        cross_dirs.discard(project_dir)
        emap(self.add_cross_project, cross_dirs)
Beispiel #3
0
    def __init__(self, project_dir, cross_project_dirs=[]):
        super(Project, self).__init__()

        self.proj = rope.base.project.Project(project_dir)
        self.change_options = {}
        self.cross_projects = dict()

        cross_dirs = set(cross_project_dirs)
        cross_dirs.discard(project_dir)
        emap(self.add_cross_project, cross_dirs)
Beispiel #4
0
    def __init__(self, project_dir, cross_project_dirs=[]):
        self.proj = rope.base.project.Project(project_dir)

        self.cross_projects = dict()

        cross_dirs = set(cross_project_dirs)
        cross_dirs.discard(project_dir)
        emap(self.add_cross_project, cross_dirs)

        self._lock = threading.Lock()
Beispiel #5
0
    def _find_locations(self, func, path, offset):
        """Common implementation for occurrences and
        implementations.

        """
        results = func(self.root_project, self.get_resource(path), offset)
        return emap(location_to_tuple, results)
Beispiel #6
0
    def _find_locations(self, func, path, offset):
        """Common implementation for occurrences and
        implementations.

        """
        path = self.to_relative_path(path)
        results = func(self.proj, self.proj.get_resource(path), offset)
        return emap(location_to_tuple, results)
Beispiel #7
0
def _find_locations(project, func, path, offset):
    """Common implementation for occurrences and
    implementations.

    """
    path = project.to_relative_path(path)
    results = func(
        project.proj,
        project.proj.get_resource(path),
        offset)
    return emap(location_to_tuple, results)
Beispiel #8
0
def test_empty_input():
    assert emap(no_args, []) == []
Beispiel #9
0
def test_two_iters(xs, ys):
    assert emap(two_args, xs, ys) == list(map(two_args, xs, ys))
Beispiel #10
0
def test_one_iter(vals):
    assert emap(one_arg, vals) == list(map(one_arg, vals))