# Path: httoop/util.py
# PY3 = sys.version_info[0] == 3
# KNOWN_ENCODINGS = {
# 	'cp1254', 'cp949', 'cp865', 'cp1257', 'euc_jp', 'cp1250', 'mac-cyrillic', 'mac-latin2', 'cp866', 'cp857',
# 	'tis-620', 'hp-roman8', 'iso8859-15', 'iso8859-1', 'mac-turkish', 'utf-32', 'cp1252', 'cp861', 'euc_jis_2004',
# 	'iso8859-6', 'utf-7', 'gb18030', 'iso2022_kr', 'shift_jisx0213', 'shift_jis_2004', 'utf-32-be', 'cp855',
# 	'utf-8', 'iso8859-2', 'koi8-r', 'iso8859-14', 'cp1251', 'iso8859-11', 'cp424', 'ascii', 'euc_jisx0213',
# 	'cp863', 'iso2022_jp_ext', 'euc_kr', 'iso2022_jp_2004', 'cp869', 'gb2312', 'utf-16', 'utf-32-le', 'mac-roman',
# 	'iso8859-10', 'uu', 'iso2022_jp', 'johab', 'cp950', 'cp852', 'iso2022_jp_2', 'iso8859-8', 'cp775', 'shift_jis',
# 	'utf-16-be', 'cp1255', 'cp1253', 'mac-iceland', 'utf-16-le', 'cp437', 'cp864', 'cp1258', 'cp862', 'cp860',
# 	'cp850', 'gbk', 'cp858', 'iso8859-3', 'iso8859-4', 'mac-greek', 'iso2022_jp_1', 'ptcp154', 'iso8859-7',
# 	'iso8859-5', 'cp500', 'iso8859-13', 'iso8859-9', 'cp1256', 'iso8859-16', 'cp932', 'iso2022_jp_3'
# }
# def _(x):
# def sanitize_encoding(encoding):
# def iteritems(d, **kw):
# def to_unicode(string):
# def if_has(func):
# 	def _decorated(self, *args, **kwargs):
# def integer(number, *args):
# 	def name(self):
# 	def close(self):
# 	def flush(self):
# 	def read(self, *size):
# 	def readline(self, *size):
# 	def readlines(self, *size):
# 	def write(self, bytes_):
# 	def writelines(self, sequence_of_strings):
# 	def seek(self, offset, whence=0):
# 	def tell(self):
# 	def truncate(self, size=None):
# 	def formatkey(key):
# 	def formatvalue(value):
# 	def __init__(self, *args, **kwargs):
# 	def __getitem__(self, key):
# 	def __setitem__(self, key, value):
# 	def __delitem__(self, key):
# 	def __contains__(self, key):
# 	def get(self, key, default=None):
# 	def update(self, E):
# 	def setdefault(self, key, x=None):
# 	def pop(self, key, default=None):
# 	def fromkeys(cls, seq, value=None):
# 	def formatkey(key):
# 	def __init__(self, message, *args, **kwargs):
# 	def translate(self):
# 	def __unicode__(self):
# 	def __bytes__(self):
# class IFile(object):
# class CaseInsensitiveDict(dict):
# class ByteUnicodeDict(CaseInsensitiveDict):
# class _Translateable(object):


from httoop.util import PY3, Unicode

"""

from __future__ import absolute_import


__all__ = ['HTTPSemantic']


class Semantic(object):

	__slots__ = ()

	def __str__(self):
		return self.__unicode__() if PY3 else self.__bytes__()

	def __unicode__(self):
		return bytes(self).decode(getattr(self, 'encoding', 'ISO8859-1'))

	def __bytes__(self):
		return self.compose()

	def parse(self, data):  # pragma: no cover
		raise NotImplementedError('%s.parse(%.5r)' % (type(self).__name__, data))

	def compose(self):  # pragma: no cover
		raise NotImplementedError('%s.compose()' % (type(self).__name__, ))

	def __eq__(self, other):
		if isinstance(other, Unicode):

# Path: httoop/util.py
# PY3 = sys.version_info[0] == 3
# KNOWN_ENCODINGS = {
# 	'cp1254', 'cp949', 'cp865', 'cp1257', 'euc_jp', 'cp1250', 'mac-cyrillic', 'mac-latin2', 'cp866', 'cp857',
# 	'tis-620', 'hp-roman8', 'iso8859-15', 'iso8859-1', 'mac-turkish', 'utf-32', 'cp1252', 'cp861', 'euc_jis_2004',
# 	'iso8859-6', 'utf-7', 'gb18030', 'iso2022_kr', 'shift_jisx0213', 'shift_jis_2004', 'utf-32-be', 'cp855',
# 	'utf-8', 'iso8859-2', 'koi8-r', 'iso8859-14', 'cp1251', 'iso8859-11', 'cp424', 'ascii', 'euc_jisx0213',
# 	'cp863', 'iso2022_jp_ext', 'euc_kr', 'iso2022_jp_2004', 'cp869', 'gb2312', 'utf-16', 'utf-32-le', 'mac-roman',
# 	'iso8859-10', 'uu', 'iso2022_jp', 'johab', 'cp950', 'cp852', 'iso2022_jp_2', 'iso8859-8', 'cp775', 'shift_jis',
# 	'utf-16-be', 'cp1255', 'cp1253', 'mac-iceland', 'utf-16-le', 'cp437', 'cp864', 'cp1258', 'cp862', 'cp860',
# 	'cp850', 'gbk', 'cp858', 'iso8859-3', 'iso8859-4', 'mac-greek', 'iso2022_jp_1', 'ptcp154', 'iso8859-7',
# 	'iso8859-5', 'cp500', 'iso8859-13', 'iso8859-9', 'cp1256', 'iso8859-16', 'cp932', 'iso2022_jp_3'
# }
# def _(x):
# def sanitize_encoding(encoding):
# def iteritems(d, **kw):
# def to_unicode(string):
# def if_has(func):
# 	def _decorated(self, *args, **kwargs):
# def integer(number, *args):
# 	def name(self):
# 	def close(self):
# 	def flush(self):
# 	def read(self, *size):
# 	def readline(self, *size):
# 	def readlines(self, *size):
# 	def write(self, bytes_):
# 	def writelines(self, sequence_of_strings):
# 	def seek(self, offset, whence=0):
# 	def tell(self):
# 	def truncate(self, size=None):
# 	def formatkey(key):
# 	def formatvalue(value):
# 	def __init__(self, *args, **kwargs):
# 	def __getitem__(self, key):
# 	def __setitem__(self, key, value):
# 	def __delitem__(self, key):
# 	def __contains__(self, key):
# 	def get(self, key, default=None):
# 	def update(self, E):
# 	def setdefault(self, key, x=None):
# 	def pop(self, key, default=None):
# 	def fromkeys(cls, seq, value=None):
# 	def formatkey(key):
# 	def __init__(self, message, *args, **kwargs):
# 	def translate(self):
# 	def __unicode__(self):
# 	def __bytes__(self):
# class IFile(object):
# class CaseInsensitiveDict(dict):
# class ByteUnicodeDict(CaseInsensitiveDict):
# class _Translateable(object):


# Path: httoop/meta.py
from httoop.util import PY3, Unicode


"""

from __future__ import absolute_import


__all__ = ['HTTPSemantic']


class Semantic(object):

	__slots__ = ()

	def __str__(self):
		return self.__unicode__() if PY3 else self.__bytes__()

	def __unicode__(self):
		return bytes(self).decode(getattr(self, 'encoding', 'ISO8859-1'))

	def __bytes__(self):
		return self.compose()

	def parse(self, data):  # pragma: no cover
		raise NotImplementedError('%s.parse(%.5r)' % (type(self).__name__, data))

	def compose(self):  # pragma: no cover
		raise NotImplementedError('%s.compose()' % (type(self).__name__, ))

	def __eq__(self, other):
		if isinstance(other, Unicode):

			return Unicode(self) == other