def METHOD_NAME(self, names, groups):
    all_connectors = get_all_connectors()
    execution_connectors = get_execution_connectors()
    # Map name -> data
    name_to_data = defaultdict(dict)
    # Map name -> group names
    name_to_group_names = defaultdict(list)
    for group_name, (group_names, group_data) in groups.items():
        # Assign group data
        self.group_data[group_name] = group_data
        # For any hosts in the group, assign mappings
        for name, data in extract_name_data(group_names):
            name_to_data[name].update(data)
            name_to_group_names[name].append(group_name)
    # Build all/top-level host data - *before* we expand any inventory
    # connectors.
    for name, data in extract_name_data(names):
        name_to_data[name].update(data)
    # Now, use the above to fill self.host_data and populate names_executors
    names_executors = []
    for name, _ in extract_name_data(names):
        host_data = name_to_data[name]
        # Default to executing commands with the ssh connector
        executor = execution_connectors["ssh"]
        if name[0] == "@":
            connector_name = name[1:]
            arg_string = None
            if "/" in connector_name:
                connector_name, arg_string = connector_name.split("/", 1)
            if connector_name not in get_all_connectors():
                raise NoConnectorError(
                    "Invalid connector: {0}".format(connector_name),
                )
            # Execution connector? Simple, just set it for their host
            if connector_name in execution_connectors:
                executor = execution_connectors[connector_name]
            names_data = all_connectors[connector_name].make_names_data(arg_string)
            connector_inventory_name = name
        else:
            names_data = [(name, {}, [])]
            connector_inventory_name = None
        for sub_name, sub_data, sub_groups in names_data:
            # Update any connector data with a copy of the host data (so that
            # host data can override connector data).
            sub_data.update(host_data.copy())
            # Assign the name/data/groups from the connector
            self.host_data[sub_name] = sub_data
            names_executors.append((sub_name, executor))
            name_to_group_names[sub_name].extend(sub_groups)
            # If we have a connector inventory name, copy any groups attached
            # to the newly generated host name.
            if connector_inventory_name:
                name_to_group_names[sub_name].extend(
                    name_to_group_names[connector_inventory_name],
                )
    # Now we can actually make Host instances
    hosts: dict[str, "Host"] = {}
    for name, executor in names_executors:
        host_groups = name_to_group_names[name]
        host = Host(name, inventory=self, groups=host_groups, executor=executor)
        hosts[name] = host
        # And push into any groups
        for group_name in host_groups:
            if host not in self.groups[group_name]:
                self.groups[group_name].append(host)
    return hosts