def _map_roles_to_roles(graph, dirs, git_dir, key, type_1, type_2):
 Node = namedtuple('Node', ['name', 'type'])
 for d in dirs:
  d = pathlib2.Path(git_dir, d)
  for item in d.iterdir():
   roles = {f for f in item.glob('meta/*.yml')}
   if roles:
    for role in roles:
     yaml_file = _open_yaml_file(role)
     if ((yaml_file is not None) and (key in yaml_file)):
      for dependent in yaml_file[key]:
       name = _get_role_name(dependent)
       node_1 = Node(item.name, type_1)
       node_2 = Node(name, type_2)
       graph.add_edge(node_2, node_1)

def _map_roles_to_roles ( graph , dirs , git_dir , key , type_1 , type_2 ) : Node = namedtuple ( 'Node' , [ 'name' , 'type' ] ) for d in dirs : d = pathlib2 . Path ( git_dir , d ) for item in d . iterdir ( ) : roles = { f for f in item . glob ( 'meta/*.yml' ) } if roles : for role in roles : yaml_file = _open_yaml_file ( role ) if ( ( yaml_file is not None ) and ( key in yaml_file ) ) : for dependent in yaml_file [ key ] : name = _get_role_name ( dependent ) node_1 = Node ( item . name , type_1 ) node_2 = Node ( name , type_2 ) graph . add_edge ( node_2 , node_1 )
maps roles to the roles that they depend on .