# Path: httoop/codecs/codec.py
# class Codec(object):
# 
# 	@classmethod
# 	def decode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		if isinstance(data, bytes):
# 			data = data.decode(charset or 'ascii')
# 		return data
# 
# 	@classmethod
# 	def encode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		if isinstance(data, Unicode):
# 			data = data.encode(charset or 'ascii')
# 		return data
# 
# 	@classmethod
# 	def iterencode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		return cls.encode(data, charset, mimetype)
# 
# 	@classmethod
# 	def iterdecode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		return cls.decode(data, charset, mimetype)
# 
# Path: httoop/exceptions.py
# class DecodeError(_Translateable, ValueError):
# 	u"""error raised when decoding failed"""
# 
# class EncodeError(_Translateable, ValueError):
# 	u"""error raised when encoding failed"""
# 
# Path: httoop/util.py
# def _(x):
# 	return x


import zlib
from httoop.codecs.codec import Codec
from httoop.exceptions import DecodeError, EncodeError
from httoop.util import _
# -*- coding: utf-8 -*-

from __future__ import absolute_import




class Deflate(Codec):
	mimetype = 'application/zlib'

	@classmethod
	def encode(cls, data, charset=None, mimetype=None):
		try:

# Path: httoop/codecs/codec.py
# class Codec(object):
# 
# 	@classmethod
# 	def decode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		if isinstance(data, bytes):
# 			data = data.decode(charset or 'ascii')
# 		return data
# 
# 	@classmethod
# 	def encode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		if isinstance(data, Unicode):
# 			data = data.encode(charset or 'ascii')
# 		return data
# 
# 	@classmethod
# 	def iterencode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		return cls.encode(data, charset, mimetype)
# 
# 	@classmethod
# 	def iterdecode(cls, data, charset=None, mimetype=None):  # pragma: no cover
# 		return cls.decode(data, charset, mimetype)
# 
# Path: httoop/exceptions.py
# class DecodeError(_Translateable, ValueError):
# 	u"""error raised when decoding failed"""
# 
# class EncodeError(_Translateable, ValueError):
# 	u"""error raised when encoding failed"""
# 
# Path: httoop/util.py
# def _(x):
# 	return x


# Path: httoop/codecs/application/zlib.py
import zlib
from httoop.codecs.codec import Codec
from httoop.exceptions import DecodeError, EncodeError
from httoop.util import _

# -*- coding: utf-8 -*-

from __future__ import absolute_import




class Deflate(Codec):
	mimetype = 'application/zlib'

	@classmethod
	def encode(cls, data, charset=None, mimetype=None):
		try:

			return zlib.compress(Codec.encode(data, charset))