# Path: httoop/six.py



from httoop import six
	ALPHA = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	DIGIT = b'0123456789'
	UNRESERVED = ALPHA + DIGIT + b'-._~'

	SCHEME = ALPHA + DIGIT + b'+-.'
	PCHAR = UNRESERVED + SUB_DELIMS + b':@'
	USERINFO = UNRESERVED + SUB_DELIMS + b':'
	PATH = PCHAR + b'/'
	QUERY = PCHAR + b'/?'
	FRAGMENT = PCHAR + b'/?'

	@classmethod
	def unquote(cls, data):
		return b''.join(cls._decode_iter(data))

	@classmethod
	def _decode_iter(cls, data):
		data = data.split(b'%')
		yield data.pop(0)
		for item in data:
			try:
				yield cls.HEX_MAP[item[:2]]
				yield item[2:]
			except KeyError:
				yield b'%'
				yield item

	@classmethod
	def quote(cls, data, charset=UNRESERVED):
		charset = {six.int2byte(c) for c in six.iterbytes(charset)} - {b'%'}

# Path: httoop/six.py



# Path: httoop/uri/percent_encoding.py
from httoop import six

	ALPHA = b'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
	DIGIT = b'0123456789'
	UNRESERVED = ALPHA + DIGIT + b'-._~'

	SCHEME = ALPHA + DIGIT + b'+-.'
	PCHAR = UNRESERVED + SUB_DELIMS + b':@'
	USERINFO = UNRESERVED + SUB_DELIMS + b':'
	PATH = PCHAR + b'/'
	QUERY = PCHAR + b'/?'
	FRAGMENT = PCHAR + b'/?'

	@classmethod
	def unquote(cls, data):
		return b''.join(cls._decode_iter(data))

	@classmethod
	def _decode_iter(cls, data):
		data = data.split(b'%')
		yield data.pop(0)
		for item in data:
			try:
				yield cls.HEX_MAP[item[:2]]
				yield item[2:]
			except KeyError:
				yield b'%'
				yield item

	@classmethod
	def quote(cls, data, charset=UNRESERVED):
		charset = {six.int2byte(c) for c in six.iterbytes(charset)} - {b'%'}

		data = (six.int2byte(d) for d in six.iterbytes(data))