<commit_before>"""
Module support amqp
Required: asynqp
"""
import asyncio

import asynqp

from aioworkers.queue.base import AbstractQueue


class AmqpQueue(AbstractQueue):
    async def init(self):
        """
        config:
            connection:
                host:
                port:
                auth:
                    username:
                    password:
                virtual_host:
            exchange:
                name:
                type:
            queue:
            route_key:
            wait:
            format: [json|msg]
        """
        await super().init()
        self._started = False
        self._lock = asyncio.Lock(loop=self.loop)
        await self._lock.acquire()
        self.context.on_start.append(self.start())
        self.context.on_stop.append(self.stop())

    async def start(self):
        if self._started:
            return<commit_msg>corofunc as handler singnals amqp<commit_after>"""
Module support amqp
Required: asynqp
"""
import asyncio

import asynqp

from aioworkers.queue.base import AbstractQueue


class AmqpQueue(AbstractQueue):
    async def init(self):
        """
        config:
            connection:
                host:
                port:
                auth:
                    username:
                    password:
                virtual_host:
            exchange:
                name:
                type:
            queue:
            route_key:
            wait:
            format: [json|msg]
        """
        await super().init()
        self._started = False
        self._lock = asyncio.Lock(loop=self.loop)
        await self._lock.acquire()
        self.context.on_start.append(self.start)
        self.context.on_stop.append(self.stop)

    async def start(self):
        if self._started:
            return
{'fraction_non_alphanumeric': 0.08662280701754387, 'fraction_numerical': 0.0, 'mean_word_length': 1.3487773487773487, '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': '7104917', 'n_tokens_mistral': 493, 'n_tokens_neox': 472, 'n_words': 105}