# Path: incf/countryutils/data.py

# 
# Path: incf/countryutils/transformations.py
# def is_string_type(obj):
# def ccn_to_ccn(code):
# def ccn_to_cca2(code):
# def ccn_to_cca3(code):
# def ccn_to_cn(code):
# def ccn_to_con(code):
# def cn_to_ccn(code):
# def cca2_to_ccn(code):
# def cca3_to_ccn(code):
# def ccn_to_ctca2(code):
# def ctca2_to_ccn(code):
# def ccn_to_ctn(code):
# def cca_to_ccn(code):
# def cca_to_cn(code):
# def cc_to_ccn(code):
# def cc_to_cn(code):
# def cc_to_con(code):
# def cca_to_con(code):
# def cca_to_ctn(code):
# def cca_to_ctca2(code):
# def cn_to_ctca2(code):
# def cn_to_ctn(code):


from incf.countryutils import data
from incf.countryutils import transformations as trafos
class Country(object):
    """encapsulating information about a country
    
    The constructor needs to be passed in an ISO 3166 numeric, two or 
    three letter country code or the simple English name.

    Raises ValueError if no corresponding country can be found
    """

    def __init__(self, key):
        """Infer the country from the key
        
        Valid keys are: two letter, three letter or numeric country code
        acording to ISO 3166 or the countries simple English name.

        Raises ValueError if key is not found.
        """

        if key in data.cn_to_ccn:
            self.cn = self.name = key
            self.ccn = self.numeric = data.cn_to_ccn[key]
        else:
            try:
                code = trafos.cc_to_ccn(key)
            except KeyError:
                raise ValueError("%s is o ISO country code or name" % key)
            self.ccn = self.numeric = code
            self.cn = self.name = trafos.ccn_to_cn(self.ccn)

        self.cca2 = self.alpha2 = trafos.ccn_to_cca2(self.numeric)

# Path: incf/countryutils/data.py

# 
# Path: incf/countryutils/transformations.py
# def is_string_type(obj):
# def ccn_to_ccn(code):
# def ccn_to_cca2(code):
# def ccn_to_cca3(code):
# def ccn_to_cn(code):
# def ccn_to_con(code):
# def cn_to_ccn(code):
# def cca2_to_ccn(code):
# def cca3_to_ccn(code):
# def ccn_to_ctca2(code):
# def ctca2_to_ccn(code):
# def ccn_to_ctn(code):
# def cca_to_ccn(code):
# def cca_to_cn(code):
# def cc_to_ccn(code):
# def cc_to_cn(code):
# def cc_to_con(code):
# def cca_to_con(code):
# def cca_to_ctn(code):
# def cca_to_ctca2(code):
# def cn_to_ctca2(code):
# def cn_to_ctn(code):


# Path: incf/countryutils/datatypes.py
from incf.countryutils import data
from incf.countryutils import transformations as trafos

class Country(object):
    """encapsulating information about a country
    
    The constructor needs to be passed in an ISO 3166 numeric, two or 
    three letter country code or the simple English name.

    Raises ValueError if no corresponding country can be found
    """

    def __init__(self, key):
        """Infer the country from the key
        
        Valid keys are: two letter, three letter or numeric country code
        acording to ISO 3166 or the countries simple English name.

        Raises ValueError if key is not found.
        """

        if key in data.cn_to_ccn:
            self.cn = self.name = key
            self.ccn = self.numeric = data.cn_to_ccn[key]
        else:
            try:
                code = trafos.cc_to_ccn(key)
            except KeyError:
                raise ValueError("%s is o ISO country code or name" % key)
            self.ccn = self.numeric = code
            self.cn = self.name = trafos.ccn_to_cn(self.ccn)

        self.cca2 = self.alpha2 = trafos.ccn_to_cca2(self.numeric)

        self.cca3 = self.alpha3 = trafos.ccn_to_cca3(self.numeric)