# Path: snapshottest/sorted_dict.py
# class SortedDict(OrderedDict):
#     def __init__(self, values):
#         super(SortedDict, self).__init__()
# 
#         try:
#             sorted_items = sorted(values.items())
#         except TypeError:
#             # Enums are not sortable
#             sorted_items = values.items()
#         for key, value in sorted_items:
#             if isinstance(value, dict):
#                 self[key] = SortedDict(value)
#             elif isinstance(value, list):
#                 self[key] = self._sort_list(value)
#             else:
#                 self[key] = value
# 
#     def _sort_list(self, value):
#         def sort(val):
#             if isinstance(val, dict):
#                 return SortedDict(val)
#             elif isinstance(val, list):
#                 return self._sort_list(val)
#             else:
#                 return val
# 
#         return [sort(item) for item in value]
# 
# Path: snapshottest/generic_repr.py
# class GenericRepr(object):
#     def __init__(self, representation):
#         self.representation = representation
# 
#     def __repr__(self):
#         return "GenericRepr({})".format(repr(self.representation))
# 
#     def __eq__(self, other):
#         return (
#             isinstance(other, GenericRepr)
#             and self.representation == other.representation
#         )
# 
#     def __hash__(self):
#         return hash(self.representation)
# 
#     @staticmethod
#     def from_value(value):
#         representation = repr(value)
#         # Remove the hex id, if found.
#         representation = representation.replace(hex(id(value)), "0x100000000")
#         return GenericRepr(representation)


import math
from collections import defaultdict
from .sorted_dict import SortedDict
from .generic_repr import GenericRepr
    return ",".join(items) + formatter.lfchar + formatter.htchar * indent


def format_tuple(value, indent, formatter):
    return "(%s%s" % (
        format_sequence(value, indent, formatter),
        ",)" if len(value) == 1 else ")",
    )


def format_set(value, indent, formatter):
    return "set([%s])" % format_sequence(value, indent, formatter)


def format_frozenset(value, indent, formatter):
    return "frozenset([%s])" % format_sequence(value, indent, formatter)


class GenericFormatter(BaseFormatter):
    def can_format(self, value):
        return True

    def store(self, test, value):
        return GenericRepr.from_value(value)

    def normalize(self, value, formatter):
        return GenericRepr.from_value(value)

    def format(self, value, indent, formatter):
        if not isinstance(value, GenericRepr):

# Path: snapshottest/sorted_dict.py
# class SortedDict(OrderedDict):
#     def __init__(self, values):
#         super(SortedDict, self).__init__()
# 
#         try:
#             sorted_items = sorted(values.items())
#         except TypeError:
#             # Enums are not sortable
#             sorted_items = values.items()
#         for key, value in sorted_items:
#             if isinstance(value, dict):
#                 self[key] = SortedDict(value)
#             elif isinstance(value, list):
#                 self[key] = self._sort_list(value)
#             else:
#                 self[key] = value
# 
#     def _sort_list(self, value):
#         def sort(val):
#             if isinstance(val, dict):
#                 return SortedDict(val)
#             elif isinstance(val, list):
#                 return self._sort_list(val)
#             else:
#                 return val
# 
#         return [sort(item) for item in value]
# 
# Path: snapshottest/generic_repr.py
# class GenericRepr(object):
#     def __init__(self, representation):
#         self.representation = representation
# 
#     def __repr__(self):
#         return "GenericRepr({})".format(repr(self.representation))
# 
#     def __eq__(self, other):
#         return (
#             isinstance(other, GenericRepr)
#             and self.representation == other.representation
#         )
# 
#     def __hash__(self):
#         return hash(self.representation)
# 
#     @staticmethod
#     def from_value(value):
#         representation = repr(value)
#         # Remove the hex id, if found.
#         representation = representation.replace(hex(id(value)), "0x100000000")
#         return GenericRepr(representation)


# Path: snapshottest/formatters.py
import math
from collections import defaultdict
from .sorted_dict import SortedDict
from .generic_repr import GenericRepr

    return ",".join(items) + formatter.lfchar + formatter.htchar * indent


def format_tuple(value, indent, formatter):
    return "(%s%s" % (
        format_sequence(value, indent, formatter),
        ",)" if len(value) == 1 else ")",
    )


def format_set(value, indent, formatter):
    return "set([%s])" % format_sequence(value, indent, formatter)


def format_frozenset(value, indent, formatter):
    return "frozenset([%s])" % format_sequence(value, indent, formatter)


class GenericFormatter(BaseFormatter):
    def can_format(self, value):
        return True

    def store(self, test, value):
        return GenericRepr.from_value(value)

    def normalize(self, value, formatter):
        return GenericRepr.from_value(value)

    def format(self, value, indent, formatter):
        if not isinstance(value, GenericRepr):

            value = GenericRepr.from_value(value)