<commit_before>import docker
import os
import subprocess
import typing

from timeit import default_timer as timer
from repairbox.test import TestOutcome


class CompilationOutcome(object):
    pass


class PendingExecResponse(object):
    def __init__(self, exec_response, output) -> None:
        self.__exec_response = exec_response
        self.__output = output


    @property
    def running(self):
        client = docker.from_env()
        return client.api.exec_inspect(self.exec_response)['Running']


    @property
    def exec_response(self):
        return self.__exec_response

    
    @property
    def output(self):
        return self.__output


    @property
    def exit_code(self):
        if self.running:
            return None
        client = docker.from_env()
        id = self.exec_response['Id']
        return client.api.exec_inspect(id)


class ExecResponse(object):
    """
    Used to hold the response from a command execution.
    """
    def __init__(self, code: int, duration: float, output: str) -> None:
        self.__code = code
        self.__duration = duration
        self.__output = output


    @property
    def code(self) -> int:
        """
        The exit code of the execution.
        """
        return self.__code


    @property
    def duration(self) -> float:
        """
        The length of time taken to complete the execution.
        """
        return self.__duration


    @property
    def output(self) -> str:
        """
        The output of the execution.
        """
        return self.__output


class BugContainer(object):
    def __init__(self, bug: 'Bug', volumes=[], network_mode='bridge', ports={}) -> None:
        """
        Constructs a container for a given bug.
        """
        self.__bug = bug

        # construct a Docker container for this bug
        client = docker.from_env()
        self.__container = \
            client.containers.run(bug.image,
                                  '/bin/bash',
                                  volumes=volumes,
                                  ports=ports,
                                  network_mode=network_mode,
                                  stdin_open=True,
                                  detach=True)

    def destroy(self):
        if self.__container:
            self.__container.remove(force=True)


    @property
    def bug(self):
        """
        The bug inside this container.
        """
        return self.__bug


    @property
    def container(self):<commit_msg>added tty argument to BugContainer<commit_after>import docker
import os
import subprocess
import typing

from timeit import default_timer as timer
from repairbox.test import TestOutcome


class CompilationOutcome(object):
    pass


class PendingExecResponse(object):
    def __init__(self, exec_response, output) -> None:
        self.__exec_response = exec_response
        self.__output = output


    @property
    def running(self):
        client = docker.from_env()
        return client.api.exec_inspect(self.exec_response)['Running']


    @property
    def exec_response(self):
        return self.__exec_response

    
    @property
    def output(self):
        return self.__output


    @property
    def exit_code(self):
        if self.running:
            return None
        client = docker.from_env()
        id = self.exec_response['Id']
        return client.api.exec_inspect(id)


class ExecResponse(object):
    """
    Used to hold the response from a command execution.
    """
    def __init__(self, code: int, duration: float, output: str) -> None:
        self.__code = code
        self.__duration = duration
        self.__output = output


    @property
    def code(self) -> int:
        """
        The exit code of the execution.
        """
        return self.__code


    @property
    def duration(self) -> float:
        """
        The length of time taken to complete the execution.
        """
        return self.__duration


    @property
    def output(self) -> str:
        """
        The output of the execution.
        """
        return self.__output


class BugContainer(object):
    def __init__(self, bug: 'Bug', volumes=[], network_mode='bridge', ports={}, tty=False) -> None:
        """
        Constructs a container for a given bug.
        """
        self.__bug = bug

        # construct a Docker container for this bug
        client = docker.from_env()
        self.__container = \
            client.containers.run(bug.image,
                                  '/bin/bash',
                                  volumes=volumes,
                                  ports=ports,
                                  network_mode=network_mode,
                                  stdin_open=True,
                                  tty=tty,
                                  detach=True)

    def destroy(self):
        if self.__container:
            self.__container.remove(force=True)


    @property
    def bug(self):
        """
        The bug inside this container.
        """
        return self.__bug


    @property
    def container(self):
{'fraction_non_alphanumeric': 0.08809198986552329, 'fraction_numerical': 0.0, 'mean_word_length': 1.705324196099104, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 13, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5287898', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1296, 'n_words': 365}