

def initialize_parse_state(self, build_file):
    'Creates a fresh parse state for the given build file.\n\n    :param build_file: The BUILD file to set up a new ParseState for.\n    :type build_file: :class:`pants.base.build_file.BuildFile`\n    :returns: A fresh ParseState for parsing the given `build_file` with.\n    :rtype: :class:`BuildConfiguration.ParseState`\n    '
    type_aliases = self._exposed_object_by_alias.copy()
    registered_addressable_instances = []

    def create_call_proxy(tgt_type, tgt_alias=None):

        def registration_callback(address, addressable):
            registered_addressable_instances.append((address, addressable))
        addressable_factory = self._get_addressable_factory(tgt_type, tgt_alias)
        return AddressableCallProxy(addressable_factory=addressable_factory, build_file=build_file, registration_callback=registration_callback)
    for (alias, target_type) in self._target_by_alias.items():
        proxy = create_call_proxy(target_type, alias)
        type_aliases[alias] = proxy
    parse_globals = type_aliases.copy()
    for (alias, target_type) in self._target_by_alias.items():
        proxy = type_aliases[alias]
        type_aliases[target_type] = proxy
    for target_macro_factory in self._target_macro_factory_by_alias.values():
        for target_type in target_macro_factory.target_types:
            proxy = create_call_proxy(target_type)
            type_aliases[target_type] = proxy
    parse_context = ParseContext(rel_path=build_file.spec_path, type_aliases=type_aliases)
    for (alias, object_factory) in self._exposed_context_aware_object_factory_by_alias.items():
        parse_globals[alias] = object_factory(parse_context)
    for (alias, target_macro_factory) in self._target_macro_factory_by_alias.items():
        parse_globals[alias] = target_macro_factory.target_macro(parse_context)
    return self.ParseState(registered_addressable_instances, parse_globals)

dataset/ETHPy150Open pantsbuild/pants/src/python/pants/build_graph/build_configuration.py BuildConfiguration.initialize_parse_state/original