# Path: amfast/decoder.py
# class Decoder(object):
#     """A wrapper class for convenient access to amfast.decode.decode.
# 
#     Decoder
#     ========
#      * amf3 - bool - True to decode as AMF3.
#      * class_def_mapper - amfast.class_def.ClassDefMapper - The object that retrieves ClassDef objects.
#     """ 
# 
#     def __init__(self, amf3=False, class_def_mapper=None):
# 
#         self.amf3 = amf3
# 
#         if class_def_mapper is None:
#             class_def_mapper = ClassDefMapper()
#         self.class_def_mapper = class_def_mapper
# 
#     def _getContext(self, input, amf3=None):
#         if amf3 is None:
#             amf3 = self.amf3
#         return DecoderContext(input, amf3=amf3, class_def_mapper=self.class_def_mapper)
# 
#     def decode(self, val, amf3=None):
#         """Decode a string or file-like-object from AMF."""
#         return decode(self._getContext(val, amf3))
# 
#     def decode_packet(self, val, amf3=None):
#         """Decode a string or file-like-object representing an AMF packet."""
#         return decode_packet(self._getContext(val, amf3))
# 
# Path: amfast/encoder.py
# class Encoder(object):
#     """A wrapper class for convenient access to amfast.encode.encode.
# 
#     Encoder
#     ========
#      * amf3 - bool - True to encode as AMF3.
#      * use_collections - bool - True to encode lists and tuples as ArrayCollections.
#      * use_proxies - bool - True to encode dicts as ObjectProxies.
#      * use_references - bool - True to encode multiply occuring objects by reference.
#      * use_legacy_xml - bool - True to XML as XMLDocument instead of e4x.
#      * include_private - bool - True to encode attributes starting with '_'.
#      * class_def_mapper - amfast.class_def.ClassDefMapper - The object that retrieves ClassDef objects.
#      * buffer - file-like-object - Output buffer. Set to None to output to a string.
# 
#     """ 
# 
#     def __init__(self, amf3=False, use_collections=False, use_proxies=False,
#         use_references=True, use_legacy_xml=False, include_private=False,
#         class_def_mapper=None, buffer=None):
# 
#         self.amf3 = amf3
#         self.use_collections = use_collections
#         self.use_proxies = use_proxies
#         self.use_references = use_references
#         self.use_legacy_xml = use_legacy_xml
#         self.include_private = include_private
# 
#         if class_def_mapper is None:
#             class_def_mapper = ClassDefMapper()
#         self.class_def_mapper = class_def_mapper
# 
#         self.buffer = buffer
# 
#     def _getContext(self, amf3=None):
#         if amf3 is None:
#             amf3 = self.amf3
# 
#         kwargs = {
#             'amf3': amf3,
#             'use_collections': self.use_collections,
#             'use_proxies': self.use_proxies,
#             'use_references': self.use_references,
#             'use_legacy_xml': self.use_legacy_xml,
#             'include_private': self.include_private,
#             'class_def_mapper': self.class_def_mapper
#         }
#  
#         if self.buffer is not None:
#             kwargs['buffer'] = self.buffer
# 
#         return EncoderContext(**kwargs);
# 
#     def encode(self, val, amf3=None):
#         """Encode a value to AMF."""
#         return encode(val, self._getContext(amf3))
# 
#     def encode_packet(self, val, amf3=None):
#         """Encode an AMF packet."""
#         return encode_packet(val, self._getContext(amf3))


import gc
import json
import re
import sys
import unittest
from guppy import hpy
from amfast.decoder import Decoder
from amfast.encoder import Encoder
                 if (not line.startswith('{"status"')):
                     continue

                 start = self.heapSize()

                 obj = json.loads(line)
                 for count in xrange(1000000):
                     out = encoder.encode(obj)
                     new = decoder.decode(out)

                 obj = None
                 en = None
                 out = None
                 new = None
                 gc.collect()

                 end = self.heapSize()
                 print '%s (%s): %s - %s' % (idx, line[:10], start, end)
                 sys.stdout.flush()
         finally:
             in_file.close()

         

    def testEncodeAmf0(self):
         return
         self._testEncoder(Encoder(), 'sample.log')

    def testEncodeAmf3(self):
         return

# Path: amfast/decoder.py
# class Decoder(object):
#     """A wrapper class for convenient access to amfast.decode.decode.
# 
#     Decoder
#     ========
#      * amf3 - bool - True to decode as AMF3.
#      * class_def_mapper - amfast.class_def.ClassDefMapper - The object that retrieves ClassDef objects.
#     """ 
# 
#     def __init__(self, amf3=False, class_def_mapper=None):
# 
#         self.amf3 = amf3
# 
#         if class_def_mapper is None:
#             class_def_mapper = ClassDefMapper()
#         self.class_def_mapper = class_def_mapper
# 
#     def _getContext(self, input, amf3=None):
#         if amf3 is None:
#             amf3 = self.amf3
#         return DecoderContext(input, amf3=amf3, class_def_mapper=self.class_def_mapper)
# 
#     def decode(self, val, amf3=None):
#         """Decode a string or file-like-object from AMF."""
#         return decode(self._getContext(val, amf3))
# 
#     def decode_packet(self, val, amf3=None):
#         """Decode a string or file-like-object representing an AMF packet."""
#         return decode_packet(self._getContext(val, amf3))
# 
# Path: amfast/encoder.py
# class Encoder(object):
#     """A wrapper class for convenient access to amfast.encode.encode.
# 
#     Encoder
#     ========
#      * amf3 - bool - True to encode as AMF3.
#      * use_collections - bool - True to encode lists and tuples as ArrayCollections.
#      * use_proxies - bool - True to encode dicts as ObjectProxies.
#      * use_references - bool - True to encode multiply occuring objects by reference.
#      * use_legacy_xml - bool - True to XML as XMLDocument instead of e4x.
#      * include_private - bool - True to encode attributes starting with '_'.
#      * class_def_mapper - amfast.class_def.ClassDefMapper - The object that retrieves ClassDef objects.
#      * buffer - file-like-object - Output buffer. Set to None to output to a string.
# 
#     """ 
# 
#     def __init__(self, amf3=False, use_collections=False, use_proxies=False,
#         use_references=True, use_legacy_xml=False, include_private=False,
#         class_def_mapper=None, buffer=None):
# 
#         self.amf3 = amf3
#         self.use_collections = use_collections
#         self.use_proxies = use_proxies
#         self.use_references = use_references
#         self.use_legacy_xml = use_legacy_xml
#         self.include_private = include_private
# 
#         if class_def_mapper is None:
#             class_def_mapper = ClassDefMapper()
#         self.class_def_mapper = class_def_mapper
# 
#         self.buffer = buffer
# 
#     def _getContext(self, amf3=None):
#         if amf3 is None:
#             amf3 = self.amf3
# 
#         kwargs = {
#             'amf3': amf3,
#             'use_collections': self.use_collections,
#             'use_proxies': self.use_proxies,
#             'use_references': self.use_references,
#             'use_legacy_xml': self.use_legacy_xml,
#             'include_private': self.include_private,
#             'class_def_mapper': self.class_def_mapper
#         }
#  
#         if self.buffer is not None:
#             kwargs['buffer'] = self.buffer
# 
#         return EncoderContext(**kwargs);
# 
#     def encode(self, val, amf3=None):
#         """Encode a value to AMF."""
#         return encode(val, self._getContext(amf3))
# 
#     def encode_packet(self, val, amf3=None):
#         """Encode an AMF packet."""
#         return encode_packet(val, self._getContext(amf3))


# Path: tests/memory_test.py
import gc
import json
import re
import sys
import unittest
from guppy import hpy
from amfast.decoder import Decoder
from amfast.encoder import Encoder

                 if (not line.startswith('{"status"')):
                     continue

                 start = self.heapSize()

                 obj = json.loads(line)
                 for count in xrange(1000000):
                     out = encoder.encode(obj)
                     new = decoder.decode(out)

                 obj = None
                 en = None
                 out = None
                 new = None
                 gc.collect()

                 end = self.heapSize()
                 print '%s (%s): %s - %s' % (idx, line[:10], start, end)
                 sys.stdout.flush()
         finally:
             in_file.close()

         

    def testEncodeAmf0(self):
         return
         self._testEncoder(Encoder(), 'sample.log')

    def testEncodeAmf3(self):
         return

         self._testEncoder(Encoder(amf3=True), 'sample.log')