<commit_before>from openid import cryptutil
import copy

class ServerAssocs(object):
    def __init__(self):
        self.assocs = {}

    def set(self, assoc):
        self.assocs[assoc.handle] = assoc

    def get(self, handle):
        return self.assocs.get(handle)

    def remove(self, handle):
        try:
            del self.assocs[handle]
        except KeyError:
            return False
        else:
            return True

    def best(self):
        best = None
        for assoc in self.assocs.values():
            if best is None or best.issued < assoc.issued:
                best = assoc
        return best

class MemoryStore(object):
    AUTH_KEY_LEN = 20

    def __init__(self):
        self.server_assocs = {}
        self.nonces = {}
        self.auth_key = cryptutil.randomString(self.AUTH_KEY_LEN)

    def _getServerAssocs(self, server_url):
        try:
            return self.server_assocs[server_url]<commit_msg>[project @ comment] (mostly to test darcs)<commit_after>from openid import cryptutil
import copy

class ServerAssocs(object):
    def __init__(self):
        self.assocs = {}

    def set(self, assoc):
        self.assocs[assoc.handle] = assoc

    def get(self, handle):
        return self.assocs.get(handle)

    def remove(self, handle):
        try:
            del self.assocs[handle]
        except KeyError:
            return False
        else:
            return True

    def best(self):
        best = None
        for assoc in self.assocs.values():
            if best is None or best.issued < assoc.issued:
                best = assoc
        return best

class MemoryStore(object):
    """In-process memory store.

    Use for single long-running processes.
    """
    AUTH_KEY_LEN = 20

    def __init__(self):
        self.server_assocs = {}
        self.nonces = {}
        self.auth_key = cryptutil.randomString(self.AUTH_KEY_LEN)

    def _getServerAssocs(self, server_url):
        try:
            return self.server_assocs[server_url]
{'fraction_non_alphanumeric': 0.09018435475834578, 'fraction_numerical': 0.001993024414549078, 'mean_word_length': 2.0195488721804513, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5171338', 'n_tokens_mistral': 631, 'n_tokens_neox': 587, 'n_words': 150}