<commit_before>from datetime import datetime
import logging
from typing import Set, List, Iterable

from . import Agent
from .utils import Singleton


@Singleton
class AgentManager:
    _agents = set()  # type: set[Agent]
    _started = None

    def __init__(self):
        self._started = datetime.now()

    def add_agent(self, agent: Agent):
        if not isinstance(agent, Agent):
            raise Exception("'{}' is not an agent")

        if agent not in self._agents:
            self._agents.add(agent)
        else:<commit_msg>fixed bug where multiple unittests could not be run in the same process, since a static attribute was retained in between instantiations of the AgentManager singleton.<commit_after>from datetime import datetime
import logging
from typing import Set, List, Iterable

from . import Agent
from .utils import Singleton


@Singleton
class AgentManager:
    def __init__(self):
        self._agents = set()  # type: set[Agent]
        self._started = datetime.now()

    def add_agent(self, agent: Agent):
        if not isinstance(agent, Agent):
            raise Exception("'{}' is not an agent")

        if agent not in self._agents:
            self._agents.add(agent)
        else:
{'fraction_non_alphanumeric': 0.08196721311475409, 'fraction_numerical': 0.0, 'mean_word_length': 2.9387096774193546, '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': '1327744', 'n_tokens_mistral': 338, 'n_tokens_neox': 319, 'n_words': 128}