示例#1
0
def test_depth_first_walker_project():
    w = walker.DepthFirstWalker(
        mock.MagicMock(container_type='project', subjects=lambda: [],
                       files=[]))
    containers = list(w.walk())
    assert len(containers) == 1
    assert containers[0].container_type == 'project'
示例#2
0
def test_depth_first_walker_session():
    w = walker.DepthFirstWalker(
        mock.MagicMock(container_type='session',
                       acquisitions=lambda: [],
                       files=[]))
    containers = list(w.walk())
    assert len(containers) == 1
    assert containers[0].container_type == 'session'
示例#3
0
def test_depth_first_walker_children():
    subjects = lambda: [
        mock.MagicMock(container_type='subject', sessions=lambda: [], files=[])
    ]
    w = walker.DepthFirstWalker(
        mock.MagicMock(container_type='project', subjects=subjects, files=[]))

    containers = list(w.walk())
    assert len(containers) == 2
    assert containers[0].container_type == 'project'
    assert containers[1].container_type == 'subject'
示例#4
0
def main(client, project, curator):
    """Curates a flywheel project using a curator.

    Args:
        client (flywheel.Client): The flywheel sdk client
        project (flywheel.Project): The project to curate
        curator (Curator): The curator class to curate the project with
    """
    if curator.depth_first:
        project_walker = walker.DepthFirstWalker(project)
    else:
        project_walker = walker.BreadthFirstWalker(project)
    for container in project_walker.walk():
        curator.curate_container(container)