<commit_before>import time
import hashlib
import umsgpack
import random
try:
    from Queue import Queue, Full  # py2
except ImportError:
    from queue import Queue, Full  # py3
import binascii
from io import BytesIO
from pybloom import BloomFilter
from collections import defaultdict
from twisted.internet.task import LoopingCall


SIZE = 512  # default from quasar paper section 4, first paragraph
DEPTH = 3  # default from quasar paper section 4, first paragraph
TTL = 64
FRESHNESS = 60


# TODO Add limited propagations when own filters updated
#      (by subscribe/unscribe or peer filter update).
#      Only x updates per refresh cycle to prevent flooding,
#      this should prevent flooding while remaining responsive.


class Quasar(object):

    def __init__(self, protocol, queue_limit=8192, history_limit=65536):
        self._protocol = protocol
        self._protocol.quasar = self
        self._subscriptions = set()
        self._filters = self._empty_filters()
        self._peers = defaultdict(
            lambda: {
                "timestamp": 0,
                "filters": self._empty_filters(),<commit_msg>reduced freshness time for quasar<commit_after>import time
import hashlib
import umsgpack
import random
try:
    from Queue import Queue, Full  # py2
except ImportError:
    from queue import Queue, Full  # py3
import binascii
from io import BytesIO
from pybloom import BloomFilter
from collections import defaultdict
from twisted.internet.task import LoopingCall


SIZE = 512  # default from quasar paper section 4, first paragraph
DEPTH = 3  # default from quasar paper section 4, first paragraph
TTL = 64
FRESHNESS = 30


# TODO Add limited propagations when own filters updated
#      (by subscribe/unscribe or peer filter update).
#      Only x updates per refresh cycle to prevent flooding,
#      this should prevent flooding while remaining responsive.


class Quasar(object):

    def __init__(self, protocol, queue_limit=8192, history_limit=65536):
        self._protocol = protocol
        self._protocol.quasar = self
        self._subscriptions = set()
        self._filters = self._empty_filters()
        self._peers = defaultdict(
            lambda: {
                "timestamp": 0,
                "filters": self._empty_filters(),
{'fraction_non_alphanumeric': 0.06140350877192982, 'fraction_numerical': 0.01929824561403509, 'mean_word_length': 3.2007366482504604, 'pattern_counts': {'":': 4, '<': 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': '2440654', 'n_tokens_mistral': 659, 'n_tokens_neox': 594, 'n_words': 237}