# Path: cjktools/maps.py
# def invert_injective_mapping(dictionary):
#     """
#     Inverts a dictionary with a one-to-one mapping from key to value, into a
#     new dictionary with a one-to-one mapping from value to key.
#     """
#     inverted_dict = {}
#     for key, value in iteritems(dictionary):
#         assert value not in inverted_dict, "Mapping is not 1-1"
#         inverted_dict[value] = key
# 
#     return inverted_dict


from cjktools.maps import invert_injective_mapping
# -*- coding: utf-8 -*-
#
# languages.py
# cjktools
#

"""
A list of common languages and character codes.
"""


to_one_char_code = {
    'English':      'e',
    'Chinese':      'c',
    'Japanese':     'j',
    'German':       'g',
    'French':       'f',
    'Spanish':      's',
    'Portugese':    'p',
}

from_one_char_code = invert_injective_mapping(to_one_char_code)

to_two_char_code = {
    'English':      'en',
    'Chinese':      'cn',
    'Japanese':     'jp',
}


# Path: cjktools/maps.py
# def invert_injective_mapping(dictionary):
#     """
#     Inverts a dictionary with a one-to-one mapping from key to value, into a
#     new dictionary with a one-to-one mapping from value to key.
#     """
#     inverted_dict = {}
#     for key, value in iteritems(dictionary):
#         assert value not in inverted_dict, "Mapping is not 1-1"
#         inverted_dict[value] = key
# 
#     return inverted_dict


# Path: cjktools/resources/languages.py
from cjktools.maps import invert_injective_mapping

# -*- coding: utf-8 -*-
#
# languages.py
# cjktools
#

"""
A list of common languages and character codes.
"""


to_one_char_code = {
    'English':      'e',
    'Chinese':      'c',
    'Japanese':     'j',
    'German':       'g',
    'French':       'f',
    'Spanish':      's',
    'Portugese':    'p',
}

from_one_char_code = invert_injective_mapping(to_one_char_code)

to_two_char_code = {
    'English':      'en',
    'Chinese':      'cn',
    'Japanese':     'jp',
}


from_two_char_code = invert_injective_mapping(to_two_char_code)