<commit_before>from django.contrib.auth import get_user_model
import discord

from dwarf.api import CacheAPI
from dwarf.models import Guild, Channel, Role, Member, Message


class PrefixNotFound(Exception):
    """Raised when a prefix was searched for but could not be found."""
    pass


class PrefixAlreadyExists(Exception):
    """Raised when a prefix equal to one that already exists would be added."""
    pass


class CoreAPI:
    """Transforms Discord objects into Dwarf objects
    that are connected to the database backend.
    Also provides some basic management and settings functions.
    
    Attributes
    ----------
    cache : :class:`CacheAPI`
        The cache backend connection of the API.
    """

    def __init__(self):
        self.cache = CacheAPI()

    def get_prefixes(self):
        """Returns a list of the bot's prefixes."""
        
        return self.cache.get('prefixes')

    def set_prefixes(self, prefixes, bot=None):<commit_msg>Quick fix for a rarely occuring bug that occurs when updating from v0.8.2b or below.<commit_after>from django.contrib.auth import get_user_model
import discord

from dwarf.api import CacheAPI
from dwarf.models import Guild, Channel, Role, Member, Message


class PrefixNotFound(Exception):
    """Raised when a prefix was searched for but could not be found."""
    pass


class PrefixAlreadyExists(Exception):
    """Raised when a prefix equal to one that already exists would be added."""
    pass


class CoreAPI:
    """Transforms Discord objects into Dwarf objects
    that are connected to the database backend.
    Also provides some basic management and settings functions.
    
    Attributes
    ----------
    cache : :class:`CacheAPI`
        The cache backend connection of the API.
    """

    def __init__(self):
        self.cache = CacheAPI()

    def get_prefixes(self):
        """Returns a list of the bot's prefixes."""
        
        return self.cache.get('prefixes', default=[])

    def set_prefixes(self, prefixes, bot=None):
{'fraction_non_alphanumeric': 0.08848245180425111, 'fraction_numerical': 0.0014829461196243204, 'mean_word_length': 3.0724346076458753, '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': '703079', 'n_tokens_mistral': 551, 'n_tokens_neox': 520, 'n_words': 216}