
#python
import re

# apetools
from apetools.baseclass import BaseClass
from apetools.tools import sleep
from apetools.commons import enumerations, expressions, errors
from apetools.parsers.oatbran import NAMED, STRING_START,SPACES, INTEGER
from apetools.commands.pscommand import PsGrep
from apetools.commands.topcommand import TopGrep


CYGWIN = STRING_START + SPACES + NAMED(n=expressions.PID_NAME,e=INTEGER)

operating_systems = enumerations.OperatingSystem



class KillAllError(errors.CommandError):
    """
    A KillAllError is raised if the kill didn't succeed.
    """


class KillAll(BaseClass):
    """
    A killall kills processes. The default operating system is linux
    """
    def __init__(self, connection=None, name=None, time_to_sleep=0, level=None):
        """
        :param:

         - `name`: The name of a process to kill
         - `time_to_sleep`: The number of seconds to wait for a process to die.
         - `connection`: A connection to a device
         - `level`: the signal level (as a positive integer)
        """
        super(BaseClass, self).__init__()
        self._logger = None
        self.name = name