<commit_before># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

from oslo_log import log as logging
from oslo_utils import importutils

from zun.common.i18n import _
from zun.common.i18n import _LE
from zun.common.i18n import _LI
import zun.conf
from zun.container.os_capability.linux import os_capability_linux
from zun import objects

LOG = logging.getLogger(__name__)
CONF = zun.conf.CONF


def load_container_driver(container_driver=None):
    """Load a container driver module.

    Load the container driver module specified by the container_driver
    configuration option or, if supplied, the driver name supplied as an
    argument.
    :param container_driver: a container driver name to override the config opt
    :returns: a ContainerDriver instance
    """
    if not container_driver:
        container_driver = CONF.container_driver
        if not container_driver:
            LOG.error(_LE("Container driver option required, "
                          "but not specified"))
            sys.exit(1)

    LOG.info(_LI("Loading container driver '%s'"), container_driver)
    try:
        if not container_driver.startswith('zun.'):
            container_driver = 'zun.container.%s' % container_driver
        driver = importutils.import_object(container_driver)
        if not isinstance(driver, ContainerDriver):
            raise Exception(_('Expected driver of type: %s') %
                            str(ContainerDriver))

        return driver
    except ImportError:
        LOG.exception(_LE("Unable to load the container driver"))
        sys.exit(1)


class ContainerDriver(object):
    '''Base class for container drivers.'''

    def create(self, context, container, sandbox_name=None):
        """Create a container."""
        raise NotImplementedError()

    def delete(self, container, force):
        """Delete a container."""
        raise NotImplementedError()

    def list(self):
        """List all containers."""
        raise NotImplementedError()

    def show(self, container):
        """Show the details of a container."""
        raise NotImplementedError()

    def reboot(self, container):
        """Reboot a container."""
        raise NotImplementedError()

    def stop(self, container):
        """Stop a container."""
        raise NotImplementedError()

    def start(self, container):
        """Start a container."""
        raise NotImplementedError()

    def pause(self, container):
        """Pause a container."""
        raise NotImplementedError()

    def unpause(self, container):
        """Pause a container."""
        raise NotImplementedError()

    def show_logs(self, container, stdout=True, stderr=True):
        """Show logs of a container."""
        raise NotImplementedError()

    def execute(self, container, command):
        """Execute a command in a running container."""
        raise NotImplementedError()

    def kill(self, container, signal):
        """kill signal to a container."""
        raise NotImplementedError()

    def get_websocket_url(self, container):
        """get websocket url of a container."""
        raise NotImplementedError()

    def resize(self, container, height, weight):
        """resize tty of a container."""
        raise NotImplementedError()

    def top(self, container, ps_args):
        """display the running progresses inside the container."""
        raise NotImplementedError()

    def create_sandbox(self, context, container, **kwargs):
        """Create a sandbox."""
        raise NotImplementedError()<commit_msg>Fix typo in container/driver.py<commit_after># Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import sys

from oslo_log import log as logging
from oslo_utils import importutils

from zun.common.i18n import _
from zun.common.i18n import _LE
from zun.common.i18n import _LI
import zun.conf
from zun.container.os_capability.linux import os_capability_linux
from zun import objects

LOG = logging.getLogger(__name__)
CONF = zun.conf.CONF


def load_container_driver(container_driver=None):
    """Load a container driver module.

    Load the container driver module specified by the container_driver
    configuration option or, if supplied, the driver name supplied as an
    argument.
    :param container_driver: a container driver name to override the config opt
    :returns: a ContainerDriver instance
    """
    if not container_driver:
        container_driver = CONF.container_driver
        if not container_driver:
            LOG.error(_LE("Container driver option required, "
                          "but not specified"))
            sys.exit(1)

    LOG.info(_LI("Loading container driver '%s'"), container_driver)
    try:
        if not container_driver.startswith('zun.'):
            container_driver = 'zun.container.%s' % container_driver
        driver = importutils.import_object(container_driver)
        if not isinstance(driver, ContainerDriver):
            raise Exception(_('Expected driver of type: %s') %
                            str(ContainerDriver))

        return driver
    except ImportError:
        LOG.exception(_LE("Unable to load the container driver"))
        sys.exit(1)


class ContainerDriver(object):
    '''Base class for container drivers.'''

    def create(self, context, container, sandbox_name=None):
        """Create a container."""
        raise NotImplementedError()

    def delete(self, container, force):
        """Delete a container."""
        raise NotImplementedError()

    def list(self):
        """List all containers."""
        raise NotImplementedError()

    def show(self, container):
        """Show the details of a container."""
        raise NotImplementedError()

    def reboot(self, container):
        """Reboot a container."""
        raise NotImplementedError()

    def stop(self, container):
        """Stop a container."""
        raise NotImplementedError()

    def start(self, container):
        """Start a container."""
        raise NotImplementedError()

    def pause(self, container):
        """Pause a container."""
        raise NotImplementedError()

    def unpause(self, container):
        """Pause a container."""
        raise NotImplementedError()

    def show_logs(self, container, stdout=True, stderr=True):
        """Show logs of a container."""
        raise NotImplementedError()

    def execute(self, container, command):
        """Execute a command in a running container."""
        raise NotImplementedError()

    def kill(self, container, signal):
        """kill signal to a container."""
        raise NotImplementedError()

    def get_websocket_url(self, container):
        """get websocket url of a container."""
        raise NotImplementedError()

    def resize(self, container, height, weight):
        """resize tty of a container."""
        raise NotImplementedError()

    def top(self, container, ps_args):
        """display the running processes inside the container."""
        raise NotImplementedError()

    def create_sandbox(self, context, container, **kwargs):
        """Create a sandbox."""
        raise NotImplementedError()
{'fraction_non_alphanumeric': 0.09398449993849183, 'fraction_numerical': 0.0029523926682248737, 'mean_word_length': 2.9892051030421984, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '3360201', 'n_tokens_mistral': 2090, 'n_tokens_neox': 2028, 'n_words': 756}