# Path: soap/logger.py
# class levels():
# def set_context(**kwargs):
# def get_context():
# def header(s, l=levels.info):
# def format(*args):
# def log(*args, **kwargs):
# def line(*args, **kwargs):
# def rewrite(*args, **kwargs):
# def persistent(name, *args, **kwargs):
# def unpersistent(*args):
# def local_context(**kwargs):
# def log_level(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_enable(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_context(l):
#     def wrapper():
# def _init_level():


import signal
import multiprocessing
from multiprocessing.pool import Pool
from soap import logger
        from soap.common.cache import process_invalidate_cache
    Process = NoDaemonProcess


class _Pool(object):
    def __init__(self, cpu=None):
        super().__init__()
        self._cpu = cpu or multiprocessing.cpu_count()
        self._pool = None
        self.map = self._map_func_wrapper('imap')
        self.map_unordered = self._map_func_wrapper('imap_unordered')

    @property
    def pool(self):
        if not self._pool:
            cpu = self._cpu
            self._pool = _NoDaemonPool(cpu, initializer=self._initializer)
        return self._pool

    @staticmethod
    def _initializer():
        signal.signal(signal.SIGINT, signal.SIG_IGN)

    def _map_func_wrapper(self, func_name):
        def wrapped(map_func, items, chunksize=None):
            if chunksize is None:
                chunksize = int(len(items) / self._cpu) + 1
            try:
                func = getattr(self.pool, func_name)
                return func(map_func, items, chunksize)
            except KeyboardInterrupt:

# Path: soap/logger.py
# class levels():
# def set_context(**kwargs):
# def get_context():
# def header(s, l=levels.info):
# def format(*args):
# def log(*args, **kwargs):
# def line(*args, **kwargs):
# def rewrite(*args, **kwargs):
# def persistent(name, *args, **kwargs):
# def unpersistent(*args):
# def local_context(**kwargs):
# def log_level(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_enable(l):
#     def wrapper(f):
#         def wrapped(*args, **kwargs):
# def log_context(l):
#     def wrapper():
# def _init_level():


# Path: soap/common/parallel.py
import signal
import multiprocessing
from multiprocessing.pool import Pool
from soap import logger
        from soap.common.cache import process_invalidate_cache

    Process = NoDaemonProcess


class _Pool(object):
    def __init__(self, cpu=None):
        super().__init__()
        self._cpu = cpu or multiprocessing.cpu_count()
        self._pool = None
        self.map = self._map_func_wrapper('imap')
        self.map_unordered = self._map_func_wrapper('imap_unordered')

    @property
    def pool(self):
        if not self._pool:
            cpu = self._cpu
            self._pool = _NoDaemonPool(cpu, initializer=self._initializer)
        return self._pool

    @staticmethod
    def _initializer():
        signal.signal(signal.SIGINT, signal.SIG_IGN)

    def _map_func_wrapper(self, func_name):
        def wrapped(map_func, items, chunksize=None):
            if chunksize is None:
                chunksize = int(len(items) / self._cpu) + 1
            try:
                func = getattr(self.pool, func_name)
                return func(map_func, items, chunksize)
            except KeyboardInterrupt:

                logger.warning(