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'
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'
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'
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)