<commit_before>
"""
Error messages are accessed as errorcodes.ERROR_TYPE, e.g. errorcodes.INVALID_JSON.
The result is an ErrorCodeDict of the format:
  {"status": "error", "errorcode": "ERROR_TYPE", "errormessage": "human-readable error message"}
"""

_error_codes = {
    "NOT_UNICODE": "couldn't decode as UTF-8",
    "INVALID_JSON": "invalid JSON",
    "INVALID_FORMAT": "the JSON was in an unexpected format",
    "BRIDGE_NOT_FOUND": "couldn't find a Hue bridge at given address '{ip}'",
    "BRIDGE_ALREADY_ADDED": "bridge has already been added to the server",
    "NO_SUCH_MAC": "the server does not know of a bridge with the MAC address '{mac}'",
    "CURRENTLY_SEARCHING": "currently searching for bridges",
    "NOT_IMPLEMENTED": "feature not implemented yet",
    "NO_LINKBUTTON": "link button not pressed",
    "INVALID_NAME": "user name is too short"
}

class ErrorCodeDict(dict):
    
    def format(self, **kwargs):
        return ErrorCodeDict(self, errormessage=self['errormessage'].format(**kwargs))
    
    def merge(self, **kwargs):
        return ErrorCodeDict(self, **kwargs)


for ec, em in _error_codes.items():
    globals()[ec] = ErrorCodeDict({"status": "error", "errorcode": ec, "errormessage": em})<commit_msg>Fixed typo: status → state<commit_after>
"""
Error messages are accessed as errorcodes.ERROR_TYPE, e.g. errorcodes.INVALID_JSON.
The result is an ErrorCodeDict of the format:
  {"status": "error", "errorcode": "ERROR_TYPE", "errormessage": "human-readable error message"}
"""

_error_codes = {
    "NOT_UNICODE": "couldn't decode as UTF-8",
    "INVALID_JSON": "invalid JSON",
    "INVALID_FORMAT": "the JSON was in an unexpected format",
    "BRIDGE_NOT_FOUND": "couldn't find a Hue bridge at given address '{ip}'",
    "BRIDGE_ALREADY_ADDED": "bridge has already been added to the server",
    "NO_SUCH_MAC": "the server does not know of a bridge with the MAC address '{mac}'",
    "CURRENTLY_SEARCHING": "currently searching for bridges",
    "NOT_IMPLEMENTED": "feature not implemented yet",
    "NO_LINKBUTTON": "link button not pressed",
    "INVALID_NAME": "user name is too short"
}

class ErrorCodeDict(dict):
    
    def format(self, **kwargs):
        return ErrorCodeDict(self, errormessage=self['errormessage'].format(**kwargs))
    
    def merge(self, **kwargs):
        return ErrorCodeDict(self, **kwargs)


for ec, em in _error_codes.items():
    globals()[ec] = ErrorCodeDict({"state": "error", "errorcode": ec, "errormessage": em})
{'fraction_non_alphanumeric': 0.13643659711075443, 'fraction_numerical': 0.0008025682182985554, 'mean_word_length': 4.602247191011236, 'pattern_counts': {'":': 32, '<': 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': '3577812', 'n_tokens_mistral': 793, 'n_tokens_neox': 778, 'n_words': 247}