# Path: gymnast/filters/stream_filter.py
# class StreamFilter(object):
#     """PDF stream filter stream dispatcher.  Stream filters are registered by
#     calling PdfOperation.register() and passing a subclass of StreamFilterBase.
# 
#     Information on filters at can be found at
#     https://partners.adobe.com/public/developer/en/ps/sdk/TN5603.Filters.pdf"""
#     # Nothing to see here.  Pay no attention to that man behind the curtain.
#     _filters    = {}
#     _nop_filter = StreamFilterBase('NOPFilter', lambda x: x)
# 
#     @classmethod
#     def register(cls, filter_name, decoder, eod=None, encoder=None):
#         """Register a new stream filter"""
#         new_filt = StreamFilterBase(filter_name, decoder, eod, encoder)
#         cls._filters[filter_name] = new_filt
# 
#     @classmethod
#     def __getitem__(cls, filter_name):
#         filter_name = ensure_str(filter_name)
#         try:
#             return cls._filters[filter_name]
#         except KeyError:
#             return cls._nop_filter


import base64
import codecs
import io
import zlib
from .stream_filter import StreamFilter
"""
Implement and register our stream filters
"""


# The best are the ones that are already done for us
def a85decode(data, **kwargs):
    return base64.a85decode(data)
def a85encode(data, **kwargs):
    return base64.a85decode(data)

def flate_decode(data, **kwargs):
    return zlib.decompress(data)
def flate_encode(data, **kwargs):
    return zlib.compress(data)

# Path: gymnast/filters/stream_filter.py
# class StreamFilter(object):
#     """PDF stream filter stream dispatcher.  Stream filters are registered by
#     calling PdfOperation.register() and passing a subclass of StreamFilterBase.
# 
#     Information on filters at can be found at
#     https://partners.adobe.com/public/developer/en/ps/sdk/TN5603.Filters.pdf"""
#     # Nothing to see here.  Pay no attention to that man behind the curtain.
#     _filters    = {}
#     _nop_filter = StreamFilterBase('NOPFilter', lambda x: x)
# 
#     @classmethod
#     def register(cls, filter_name, decoder, eod=None, encoder=None):
#         """Register a new stream filter"""
#         new_filt = StreamFilterBase(filter_name, decoder, eod, encoder)
#         cls._filters[filter_name] = new_filt
# 
#     @classmethod
#     def __getitem__(cls, filter_name):
#         filter_name = ensure_str(filter_name)
#         try:
#             return cls._filters[filter_name]
#         except KeyError:
#             return cls._nop_filter


# Path: gymnast/filters/filters.py
import base64
import codecs
import io
import zlib
from .stream_filter import StreamFilter

"""
Implement and register our stream filters
"""


# The best are the ones that are already done for us
def a85decode(data, **kwargs):
    return base64.a85decode(data)
def a85encode(data, **kwargs):
    return base64.a85decode(data)

def flate_decode(data, **kwargs):
    return zlib.decompress(data)
def flate_encode(data, **kwargs):
    return zlib.compress(data)

StreamFilter.register('ASCII85Decode', a85decode, b'~>', a85encode)