<commit_before># -*- coding: utf-8 -*-
"""
    profiling.utils
    ~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
from collections import deque

try:
    from . import speedup
except ImportError:
    speedup = False


__all__ = ['frame_stack']


if speedup:
    def frame_stack(frame, top_frame=None, top_code=None):
        """Returns a deque of frame stack."""
        return speedup.frame_stack(frame, top_frame, top_code)
else:
    def frame_stack(frame, top_frame=None, top_code=None):
        """Returns a deque of frame stack."""
        frames = deque()
        while frame is not None:
            frames.appendleft(frame)
            if frame is top_frame or frame.f_code is top_code:
                break
            frame = frame.f_back
        return frames
<commit_msg>Implement repr_frame() utility<commit_after># -*- coding: utf-8 -*-
"""
    profiling.utils
    ~~~~~~~~~~~~~~~
"""
from __future__ import absolute_import
from collections import deque

try:
    from . import speedup
except ImportError:
    speedup = False


__all__ = ['frame_stack', 'repr_frame']


if speedup:
    def frame_stack(frame, top_frame=None, top_code=None):
        """Returns a deque of frame stack."""
        return speedup.frame_stack(frame, top_frame, top_code)
else:
    def frame_stack(frame, top_frame=None, top_code=None):
        """Returns a deque of frame stack."""
        frames = deque()
        while frame is not None:
            frames.appendleft(frame)
            if frame is top_frame or frame.f_code is top_code:
                break
            frame = frame.f_back
        return frames


def repr_frame(frame):
    return '%s:%d' % (frame.f_code.co_filename, frame.f_lineno)

{'fraction_non_alphanumeric': 0.11565420560747663, 'fraction_numerical': 0.0011682242990654205, 'mean_word_length': 2.6918103448275863, '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': '5029525', 'n_tokens_mistral': 523, 'n_tokens_neox': 512, 'n_words': 149}