# Path: pyxmpp/xmppstringprep.py
# class LookupFunction:
# class LookupTable:
# class Profile:
#     def __init__(self,function):
#     def __init__(self,singles,ranges):
#     def lookup(self,c):
# def b1_mapping(uc):
# def nfkc(data):
#     def __init__(self,unassigned,mapping,normalization,prohibited,bidi=1):
#     def prepare(self,data):
#     def prepare_query(self,s):
#     def map(self,s):
#     def prohibit(self,s):
#     def check_unassigned(self,s):
#     def check_bidi(self,s):
# def set_stringprep_cache_size(size):
# A_1=LookupFunction(stringprep.in_table_a1)
# B_1=LookupFunction(b1_mapping)
# B_2=LookupFunction(stringprep.map_table_b2)
# B_3=LookupFunction(stringprep.map_table_b3)
# C_1_1=LookupFunction(stringprep.in_table_c11)
# C_1_2=LookupFunction(stringprep.in_table_c12)
# C_2_1=LookupFunction(stringprep.in_table_c21)
# C_2_2=LookupFunction(stringprep.in_table_c22)
# C_3=LookupFunction(stringprep.in_table_c3)
# C_4=LookupFunction(stringprep.in_table_c4)
# C_5=LookupFunction(stringprep.in_table_c5)
# C_6=LookupFunction(stringprep.in_table_c6)
# C_7=LookupFunction(stringprep.in_table_c7)
# C_8=LookupFunction(stringprep.in_table_c8)
# C_9=LookupFunction(stringprep.in_table_c9)
# D_1=LookupFunction(stringprep.in_table_d1)
# D_2=LookupFunction(stringprep.in_table_d2)
# 
# Path: pyxmpp/exceptions.py
# class JIDError(Error, ValueError):
#     "Exception raised when invalid JID is used"
#     pass


import re
import weakref
import warnings
from encodings import idna
from pyxmpp.xmppstringprep import nodeprep,resourceprep
from pyxmpp.exceptions import JIDError

    def __set_node(self,s):
        """Initialize `self.node`

        :Parameters:
            - `s`: Node part of the JID
        :Types:
            - `s`: unicode

        :raise JIDError: if the node name is too long.
        :raise pyxmpp.xmppstringprep.StringprepError: if the
            node name fails Nodeprep preparation."""
        if s:
            s = unicode(s)
            s=nodeprep.prepare(s)
            if len(s.encode("utf-8"))>1023:
                raise JIDError,"Node name too long"
        else:
            s=None
        object.__setattr__(self,"node",s)

    def __set_domain(self,s):
        """Initialize `self.domain`

        :Parameters:
            - `s`: Unicode or UTF-8 domain part of the JID

        :raise JIDError: if the domain name is too long."""

        if s is None:

# Path: pyxmpp/xmppstringprep.py
# class LookupFunction:
# class LookupTable:
# class Profile:
#     def __init__(self,function):
#     def __init__(self,singles,ranges):
#     def lookup(self,c):
# def b1_mapping(uc):
# def nfkc(data):
#     def __init__(self,unassigned,mapping,normalization,prohibited,bidi=1):
#     def prepare(self,data):
#     def prepare_query(self,s):
#     def map(self,s):
#     def prohibit(self,s):
#     def check_unassigned(self,s):
#     def check_bidi(self,s):
# def set_stringprep_cache_size(size):
# A_1=LookupFunction(stringprep.in_table_a1)
# B_1=LookupFunction(b1_mapping)
# B_2=LookupFunction(stringprep.map_table_b2)
# B_3=LookupFunction(stringprep.map_table_b3)
# C_1_1=LookupFunction(stringprep.in_table_c11)
# C_1_2=LookupFunction(stringprep.in_table_c12)
# C_2_1=LookupFunction(stringprep.in_table_c21)
# C_2_2=LookupFunction(stringprep.in_table_c22)
# C_3=LookupFunction(stringprep.in_table_c3)
# C_4=LookupFunction(stringprep.in_table_c4)
# C_5=LookupFunction(stringprep.in_table_c5)
# C_6=LookupFunction(stringprep.in_table_c6)
# C_7=LookupFunction(stringprep.in_table_c7)
# C_8=LookupFunction(stringprep.in_table_c8)
# C_9=LookupFunction(stringprep.in_table_c9)
# D_1=LookupFunction(stringprep.in_table_d1)
# D_2=LookupFunction(stringprep.in_table_d2)
# 
# Path: pyxmpp/exceptions.py
# class JIDError(Error, ValueError):
#     "Exception raised when invalid JID is used"
#     pass


# Path: pyxmpp/jid.py
import re
import weakref
import warnings
from encodings import idna
from pyxmpp.xmppstringprep import nodeprep,resourceprep
from pyxmpp.exceptions import JIDError


    def __set_node(self,s):
        """Initialize `self.node`

        :Parameters:
            - `s`: Node part of the JID
        :Types:
            - `s`: unicode

        :raise JIDError: if the node name is too long.
        :raise pyxmpp.xmppstringprep.StringprepError: if the
            node name fails Nodeprep preparation."""
        if s:
            s = unicode(s)
            s=nodeprep.prepare(s)
            if len(s.encode("utf-8"))>1023:
                raise JIDError,"Node name too long"
        else:
            s=None
        object.__setattr__(self,"node",s)

    def __set_domain(self,s):
        """Initialize `self.domain`

        :Parameters:
            - `s`: Unicode or UTF-8 domain part of the JID

        :raise JIDError: if the domain name is too long."""

        if s is None:

            raise JIDError,"Domain must be given"