(self, sources)
Initializes the tree with a set of sources.

    Args:
      sources: A set of JavaScript sources.

    Raises:
      MultipleProvideError: A namespace is provided by muplitple sources.
      NamespaceNotFoundError: A namespace is required but never provided.
Initializes the tree with a set of sources.
Initializes the tree with a set of sources .
def __init__(self, sources):
    """Initializes the tree with a set of sources.

    Args:
      sources: A set of JavaScript sources.

    Raises:
      MultipleProvideError: A namespace is provided by muplitple sources.
      NamespaceNotFoundError: A namespace is required but never provided.
    """

    self._sources = sources
    self._provides_map = dict()

    # Ensure nothing was provided twice.
    for source in sources:
      for provide in source.provides:
        if provide in self._provides_map:
          raise MultipleProvideError(
              provide, [self._provides_map[provide], source])

        self._provides_map[provide] = source

    # Check that all required namespaces are provided.
    for source in sources:
      for require in source.requires:
        if require not in self._provides_map:
          raise NamespaceNotFoundError(require, source)
def __init__ ( self , sources ) : self . _sources = sources self . _provides_map = dict ( ) # Ensure nothing was provided twice. for source in sources : for provide in source . provides : if provide in self . _provides_map : raise MultipleProvideError ( provide , [ self . _provides_map [ provide ] , source ] ) self . _provides_map [ provide ] = source # Check that all required namespaces are provided. for source in sources : for require in source . requires : if require not in self . _provides_map : raise NamespaceNotFoundError ( require , source )