<commit_before>from __future__ import absolute_import

import logging
import hashlib

from collections import namedtuple

from django.core.cache import cache

from sentry.models import Project
from sentry.utils import metrics
from sentry.utils.safe import safe_execute

import six
from six import integer_types, text_type


logger = logging.getLogger(__name__)


StacktraceInfo = namedtuple('StacktraceInfo', [
    'stacktrace', 'container', 'platforms'])


class ProcessableFrame(object):

    def __init__(self, frame, idx, processor, stacktrace_info):
        self.frame = frame
        self.idx = idx
        self.processor = processor
        self.stacktrace_info = stacktrace_info
        self.data = None
        self.cache_key = None
        self.cache_value = None

    def __contains__(self, key):
        return key in self.frame

    def __getitem__(self, key):
        return self.frame[key]

    def get(self, key, default=None):
        return self.frame.get(key, default)<commit_msg>Fixed stacktrace info tuple trying to hash by contents instead of id<commit_after>from __future__ import absolute_import

import logging
import hashlib

from collections import namedtuple

from django.core.cache import cache

from sentry.models import Project
from sentry.utils import metrics
from sentry.utils.safe import safe_execute

import six
from six import integer_types, text_type


logger = logging.getLogger(__name__)


StacktraceInfo = namedtuple('StacktraceInfo', [
    'stacktrace', 'container', 'platforms'])
StacktraceInfo.__hash__ = lambda x: id(x)
StacktraceInfo.__eq__ = lambda a, b: a is b
StacktraceInfo.__ne__ = lambda a, b: a is not b


class ProcessableFrame(object):

    def __init__(self, frame, idx, processor, stacktrace_info):
        self.frame = frame
        self.idx = idx
        self.processor = processor
        self.stacktrace_info = stacktrace_info
        self.data = None
        self.cache_key = None
        self.cache_value = None

    def __contains__(self, key):
        return key in self.frame

    def __getitem__(self, key):
        return self.frame[key]

    def get(self, key, default=None):
        return self.frame.get(key, default)
{'fraction_non_alphanumeric': 0.07636031092821216, 'fraction_numerical': 0.0, 'mean_word_length': 3.4928131416837784, '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': '3918470', 'n_tokens_mistral': 623, 'n_tokens_neox': 609, 'n_words': 195}