# Path: django_performance_testing/signals.py



from django.conf import settings
from django.utils.six.moves import cPickle as pickle
from django_performance_testing.signals import results_collected, results_read

DEFAULT_DJPT_DATAFILE_PATH = 'djpt.results_collected'


def get_datafile_path():
    try:
        return settings.DJPT_DATAFILE_PATH
    except AttributeError:
        return DEFAULT_DJPT_DATAFILE_PATH


class Reader:
    def __init__(self, fpath):
        self.fpath = fpath

    def read_all(self):
        with open(self.fpath, 'rb') as f:
            data = f.read()
        if not data:
            return []
        deserialized = pickle.loads(data)
        for (sender, results, context) in deserialized:

# Path: django_performance_testing/signals.py



# Path: django_performance_testing/serializer.py
from django.conf import settings
from django.utils.six.moves import cPickle as pickle
from django_performance_testing.signals import results_collected, results_read


DEFAULT_DJPT_DATAFILE_PATH = 'djpt.results_collected'


def get_datafile_path():
    try:
        return settings.DJPT_DATAFILE_PATH
    except AttributeError:
        return DEFAULT_DJPT_DATAFILE_PATH


class Reader:
    def __init__(self, fpath):
        self.fpath = fpath

    def read_all(self):
        with open(self.fpath, 'rb') as f:
            data = f.read()
        if not data:
            return []
        deserialized = pickle.loads(data)
        for (sender, results, context) in deserialized:

            results_read.send(sender=sender, results=results, context=context)