<commit_before>"""
A Printer for generating executable code.

The most important function here is srepr that returns a string so that the
relation eval(srepr(expr))=expr holds in an appropriate environment.
"""

import mpmath.libmp as mlib
from mpmath.libmp import prec_to_dps, repr_dps

from sympy.core.function import AppliedUndef
from .printer import Printer


class ReprPrinter(Printer):
    printmethod = "_sympyrepr"

    _default_settings = {
        "order": None
    }

    def reprify(self, args, sep):
        """
        Prints each item in `args` and joins them with `sep`.
        """
        return sep.join([self.doprint(item) for item in args])

    def emptyPrinter(self, expr):
        """
        The fallback printer.
        """
        if isinstance(expr, str):
            return expr
        elif hasattr(expr, "__srepr__"):
            return expr.__srepr__()
        elif hasattr(expr, "args") and hasattr(expr.args, "__iter__"):
            l = []
            for o in expr.args:
                l.append(self._print(o))
            return expr.__class__.__name__ + '(%s)' % ', '.join(l)
        elif hasattr(expr, "__module__") and hasattr(expr, "__name__"):
            return "<'%s.%s'>" % (expr.__module__, expr.__name__)
        else:
            return repr(expr)

    def _print_Add(self, expr, order=None):<commit_msg>Override repr for Dict<commit_after>"""
A Printer for generating executable code.

The most important function here is srepr that returns a string so that the
relation eval(srepr(expr))=expr holds in an appropriate environment.
"""

import mpmath.libmp as mlib
from mpmath.libmp import prec_to_dps, repr_dps

from sympy.core.function import AppliedUndef
from sympy.core.compatibility import default_sort_key
from .printer import Printer


class ReprPrinter(Printer):
    printmethod = "_sympyrepr"

    _default_settings = {
        "order": None
    }

    def reprify(self, args, sep):
        """
        Prints each item in `args` and joins them with `sep`.
        """
        return sep.join([self.doprint(item) for item in args])

    def emptyPrinter(self, expr):
        """
        The fallback printer.
        """
        if isinstance(expr, str):
            return expr
        elif hasattr(expr, "__srepr__"):
            return expr.__srepr__()
        elif hasattr(expr, "args") and hasattr(expr.args, "__iter__"):
            l = []
            for o in expr.args:
                l.append(self._print(o))
            return expr.__class__.__name__ + '(%s)' % ', '.join(l)
        elif hasattr(expr, "__module__") and hasattr(expr, "__name__"):
            return "<'%s.%s'>" % (expr.__module__, expr.__name__)
        else:
            return repr(expr)

    def _print_Dict(self, expr):
        l = []
        for o in sorted(expr.args, key=default_sort_key):
            l.append(self._print(o))
        return expr.__class__.__name__ + '(%s)' % ', '.join(l)

    def _print_Add(self, expr, order=None):
{'fraction_non_alphanumeric': 0.11618535930154467, 'fraction_numerical': 0.0, 'mean_word_length': 2.4479166666666665, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, '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': '4855951', 'n_tokens_mistral': 926, 'n_tokens_neox': 909, 'n_words': 262}