def parse_address_family(address_mapper, directory):
  """Given an AddressMapper and a directory, return an AddressFamily.

  The AddressFamily may be empty, but it will not be None.
  """
  patterns = tuple(join(directory.path, p) for p in address_mapper.build_patterns)
  path_globs = PathGlobs(include=patterns,
                         exclude=address_mapper.build_ignore_patterns)
  snapshot = yield Get(Snapshot, PathGlobs, path_globs)
  files_content = yield Get(FilesContent, Digest, snapshot.directory_digest)

  if not files_content:
    raise ResolveError('Directory "{}" does not contain any BUILD files.'.format(directory.path))
  address_maps = []
  for filecontent_product in files_content:
    address_maps.append(AddressMap.parse(filecontent_product.path,
                                         filecontent_product.content,
                                         address_mapper.parser))
  yield AddressFamily.create(directory.path, address_maps)
def parse_address_family ( address_mapper , directory ) : patterns = tuple ( join ( directory . path , p ) for p in address_mapper . build_patterns ) path_globs = PathGlobs ( include = patterns , exclude = address_mapper . build_ignore_patterns ) snapshot = yield Get ( Snapshot , PathGlobs , path_globs ) files_content = yield Get ( FilesContent , Digest , snapshot . directory_digest ) if not files_content : raise ResolveError ( 'Directory "{}" does not contain any BUILD files.' . format ( directory . path ) ) address_maps = [ ] for filecontent_product in files_content : address_maps . append ( AddressMap . parse ( filecontent_product . path , filecontent_product . content , address_mapper . parser ) ) yield AddressFamily . create ( directory . path , address_maps )
Given an AddressMapper and a directory, return an AddressFamily.

  The AddressFamily may be empty, but it will not be None.