# 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
        :return: UTF-8 encoded JID."""
        warnings.warn("JID.as_string() is deprecated. Use unicode() or `as_utf8` instead.",
                 DeprecationWarning, stacklevel=1)
        return self.as_utf8()

    def as_unicode(self):
        """Unicode string JID representation.

        :return: JID as Unicode string."""
        r=self.domain
        if self.node:
            r=self.node+u'@'+r
        if self.resource:
            r=r+u'/'+self.resource
        if not JID.cache.has_key(r):
            JID.cache[r]=self
        return r

    def bare(self):
        """Make bare JID made by removing resource from current `self`.

        :return: new JID object without resource part."""
        return JID(self.node,self.domain,check=False)

    def __eq__(self,other):
        if other is None:
            return False
        elif type(other) in (str, unicode):
            try:
                other=JID(other)

# 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

        :return: UTF-8 encoded JID."""
        warnings.warn("JID.as_string() is deprecated. Use unicode() or `as_utf8` instead.",
                 DeprecationWarning, stacklevel=1)
        return self.as_utf8()

    def as_unicode(self):
        """Unicode string JID representation.

        :return: JID as Unicode string."""
        r=self.domain
        if self.node:
            r=self.node+u'@'+r
        if self.resource:
            r=r+u'/'+self.resource
        if not JID.cache.has_key(r):
            JID.cache[r]=self
        return r

    def bare(self):
        """Make bare JID made by removing resource from current `self`.

        :return: new JID object without resource part."""
        return JID(self.node,self.domain,check=False)

    def __eq__(self,other):
        if other is None:
            return False
        elif type(other) in (str, unicode):
            try:
                other=JID(other)

            except: