<commit_before>import ansible
from ansible.playbook import PlayBook
from ansible import callbacks
from ansible import utils



class Manager:
    def __init__(self, provisioner_response):

        self.inventory = {}
        self.host_vars = {}
        for group in provisioner_response.keys():
            if group == "masters":
                self.master_fqdn = response[u'SNF:fqdn']
            self.inventory[group] = {"hosts": []}
            for response in provisioner_response[group]:
                self.inventory[group]["hosts"].append(response[u'SNF:fqdn'])

    def create_inventory(self):
        """
        Create the inventory using the ansible library objects
        :return:
        """
        inventory_groups = []
        for group in self.inventory.keys():
            inventory_groups.append(ansible.inventory.group.Group(name=group))
            if group != "masters":
                self.host_vars["http_proxy"] = "http://"+self.master_fqdn+":3128"
            for host in self.inventory[group]["hosts"]:
                ansible_host = ansible.inventory.host.Host(name=host)
                host_vars = self.host_vars.iteritems()
                for var_key, var_value in host_vars:
                    ansible_host.set_variable(var_key, var_value)
                inventory_groups[-1].add_host(ansible_host)

        self.inventory = ansible.inventory.Inventory(host_list=None)
        for group in inventory_groups:
            self.inventory.add_group(group)

        return self.inventory
<commit_msg>LAM-40 Removed unnecessary loop variable<commit_after>import ansible
from ansible.playbook import PlayBook
from ansible import callbacks
from ansible import utils



class Manager:
    def __init__(self, provisioner_response):

        self.inventory = {}
        self.host_vars = {}
        for group in provisioner_response.keys():
            if group == "masters":
                self.master_fqdn = response[u'SNF:fqdn']
            self.inventory[group] = {"hosts": []}
            for response in provisioner_response[group]:
                self.inventory[group]["hosts"].append(response[u'SNF:fqdn'])

    def create_inventory(self):
        """
        Create the inventory using the ansible library objects
        :return:
        """
        inventory_groups = []
        for group in self.inventory.keys():
            inventory_groups.append(ansible.inventory.group.Group(name=group))
            if group != "masters":
                self.host_vars["http_proxy"] = "http://"+self.master_fqdn+":3128"
            for host in self.inventory[group]["hosts"]:
                ansible_host = ansible.inventory.host.Host(name=host)
                host_vars = self.host_vars.iteritems()
                for var_key, var_value in self.host_vars.iteritems():
                    ansible_host.set_variable(var_key, var_value)
                inventory_groups[-1].add_host(ansible_host)

        self.inventory = ansible.inventory.Inventory(host_list=None)
        for group in inventory_groups:
            self.inventory.add_group(group)

        return self.inventory

{'fraction_non_alphanumeric': 0.10250642673521851, 'fraction_numerical': 0.0038560411311053984, 'mean_word_length': 2.347311827956989, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7194437', 'n_tokens_mistral': 911, 'n_tokens_neox': 879, 'n_words': 172}