<commit_before>#!/usr/bin/env python2.6
"""BitBake variable reference tracking and signature generation"""

import re
import codegen
import ast
import hashlib
import pickle
from fnmatch import fnmatchcase
from itertools import chain
from collections import deque
from pysh import pyshyacc, pyshlex, sherrors
import bb.msg
import bb.data
import bb.utils

from pysh.sherrors import ShellSyntaxError

class RecursionError(RuntimeError):
    def __init__(self, variable, path = None):
        self.variable = variable
        self.path = path

    def __str__(self):
        msg = "Recursive variable reference for %s" % self.variable
        if self.path:
            msg += " via %s" % " -> ".join(stable_repr(v) for v in self.path)

        return msg

class PythonExpansionError(Exception):
    def __init__(self, exception, node, path):
        self.exception = exception
        self.node = node
        self.path = path

    def __str__(self):
        msg = "%s while resolving %s" % (self.exception, stable_repr(self.node))
        if self.path:
            msg += " via %s" % " -> ".join(stable_repr(v) for v in self.path)
        return msg

class Memoized(object):
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """
    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        key = pickle.dumps(args)
        try:
            return self.cache[key]
        except KeyError:<commit_msg>Quote the exception string in PythonExpansionError<commit_after>#!/usr/bin/env python2.6
"""BitBake variable reference tracking and signature generation"""

import re
import codegen
import ast
import hashlib
import pickle
from fnmatch import fnmatchcase
from itertools import chain
from collections import deque
from pysh import pyshyacc, pyshlex, sherrors
import bb.msg
import bb.data
import bb.utils

from pysh.sherrors import ShellSyntaxError

class RecursionError(RuntimeError):
    def __init__(self, variable, path = None):
        self.variable = variable
        self.path = path

    def __str__(self):
        msg = "Recursive variable reference for %s" % self.variable
        if self.path:
            msg += " via %s" % " -> ".join(stable_repr(v) for v in self.path)

        return msg

class PythonExpansionError(Exception):
    def __init__(self, exception, node, path):
        self.exception = exception
        self.node = node
        self.path = path

    def __str__(self):
        msg = "'%s' while resolving %s" % (self.exception, stable_repr(self.node))
        if self.path:
            msg += " via %s" % " -> ".join(stable_repr(v) for v in self.path)
        return msg

class Memoized(object):
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """
    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        key = pickle.dumps(args)
        try:
            return self.cache[key]
        except KeyError:
{'fraction_non_alphanumeric': 0.09331259720062209, 'fraction_numerical': 0.001244167962674961, 'mean_word_length': 2.7482517482517483, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1014272', 'n_tokens_mistral': 954, 'n_tokens_neox': 937, 'n_words': 320}