Create a map from each query path to a LocationInfo at that path.

    Args:
        query_metadata_table: QueryMetadataTable, object containing all metadata collected during
                              query processing, including location metadata (e.g. which locations
                              are folded or optional).

    Returns:
        Dict[Tuple[str], LocationInfo], dictionary mapping query path to LocationInfo at that path.

def _map_query_path_to_location_info(query_metadata_table):
    """Create a map from each query path to a LocationInfo at that path.

    Args:
        query_metadata_table: QueryMetadataTable, object containing all metadata collected during
                              query processing, including location metadata (e.g. which locations
                              are folded or optional).

    Returns:
        Dict[Tuple[str], LocationInfo], dictionary mapping query path to LocationInfo at that path.
    """
    query_path_to_location_info = {}
    for location, location_info in query_metadata_table.registered_locations:
        if not isinstance(location, Location):
            continue
        if location.query_path in query_path_to_location_info:
            # make sure the stored location information equals the new location information
            # for the fields the SQL backend requires.
            equivalent_location_info = query_path_to_location_info[location.query_path]
            if not _location_infos_equal(location_info, equivalent_location_info):
                raise AssertionError(
                    u'Differing LocationInfos at query_path {} between {} and {}. Expected '
                    u'parent_location.query_path, optional_scopes_depth, recursive_scopes_depth '
                    u'and types to be equal for LocationInfos sharing the same query path.'.format(
                        location.query_path, location_info, equivalent_location_info))

        query_path_to_location_info[location.query_path] = location_info
    return query_path_to_location_info