def init(module_paths, work_db, config):
    """Clear and initialize a work-db with work items.

    Any existing data in the work-db will be cleared and replaced with entirely
    new work orders. In particular, this means that any results in the db are
    removed.

    Args:
      module_paths: iterable of pathlib.Paths of modules to mutate.
      work_db: A `WorkDB` instance into which the work orders will be saved.
      config: The configuration for the new session.
    """
    operator_names = cosmic_ray.plugins.operator_names()
    work_db.set_config(config=config)

    work_db.clear()

    for module_path in module_paths:
        module_ast = get_ast(
            module_path, python_version=config.python_version)

        for op_name in operator_names:
            operator = get_operator(op_name)(config.python_version)
            visitor = WorkDBInitVisitor(module_path, op_name, work_db,
                                        operator)
            visitor.walk(module_ast)

    apply_interceptors(work_db, config.sub('interceptors').get('enabled', ()))
Clear and initialize a work-db with work items.

    Any existing data in the work-db will be cleared and replaced with entirely
    new work orders. In particular, this means that any results in the db are
    removed.

    Args:
      module_paths: iterable of pathlib.Paths of modules to mutate.
      work_db: A `WorkDB` instance into which the work orders will be saved.
      config: The configuration for the new session.