<commit_before>def handle_container_on_metal(instance):
        from core.models import Instance, Flavor, Port, Image

        if instance.deleted:
            return

        if (instance.isolation in ["container"]):
            # Our current docker-on-metal network strategy requires that there be some
            # VM on the server that connects to the networks, so that
            # the containers can piggyback off of that configuration.
            if not Instance.objects.filter(slice=instance.slice, node=instance.node, isolation="vm").exists():
                flavors = Flavor.objects.filter(name="m1.small")
                if not flavors:
                    raise XOSConfigurationError("No m1.small flavor")

                images = Image.objects.filter(kind="vm")

                companion_instance = Instance(slice = instance.slice,
                                node = instance.node,
                                image = images[0],
                                creator = instance.creator,
                                deployment = instance.node.site_deployment.deployment,
                                flavor = flavors[0])
                companion_instance.save()

        # Add the ports for the container
        for network in instance.slice.networks.all():
            if (network.name.endswith("-nat")):
                continue

            if not Port.objects.filter(network=network, instance=instance).exists():
                port = Port(network = network, instance=instance)
                port.save()
<commit_msg>comments about the NAT thing<commit_after>def handle_container_on_metal(instance):
        from core.models import Instance, Flavor, Port, Image

        if instance.deleted:
            return

        if (instance.isolation in ["container"]):
            # Our current docker-on-metal network strategy requires that there be some
            # VM on the server that connects to the networks, so that
            # the containers can piggyback off of that configuration.
            if not Instance.objects.filter(slice=instance.slice, node=instance.node, isolation="vm").exists():
                flavors = Flavor.objects.filter(name="m1.small")
                if not flavors:
                    raise XOSConfigurationError("No m1.small flavor")

                images = Image.objects.filter(kind="vm")

                companion_instance = Instance(slice = instance.slice,
                                node = instance.node,
                                image = images[0],
                                creator = instance.creator,
                                deployment = instance.node.site_deployment.deployment,
                                flavor = flavors[0])
                companion_instance.save()

        # Add the ports for the container
        for network in instance.slice.networks.all():
            # hmmm... The NAT ports never become ready, because sync_ports never
            # instantiates them. Need to think about this.
            if (network.name.endswith("-nat")):
                continue

            if not Port.objects.filter(network=network, instance=instance).exists():
                port = Port(network = network, instance=instance)
                port.save()

{'fraction_non_alphanumeric': 0.0823924321025328, 'fraction_numerical': 0.0024412572474824534, 'mean_word_length': 1.6846846846846846, 'pattern_counts': {'":': 0, '<': 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': '3510264', 'n_tokens_mistral': 776, 'n_tokens_neox': 741, 'n_words': 215}