# Path: pyzza/tags.py
# class Tag(object):
# class End(Tag):
# class SymbolClass(Tag):
# class FileAttributes(Tag):
# class ShowFrame(Tag):
#     def blob(self):
#     def _read(self, stream):
#     def __repr__(self):
#     def blob(self):
#     def _read(self, stream):
#     def __init__(self, main_class=None):
#     def _read(self, stream):
#     def blob(self):
#     def __repr__(self):
#     def __init__(self):
#     def _read(self, stream):
#     def blob(self):
#     def blob(self):
# def read(file):
# 
# Path: pyzza/io.py
# class DummyABCStream(object):
#     for i in dir(ABCStream):
#         if not i.startswith('__') and hasattr(getattr(ABCStream, i), '__call__'):
#             locals()[i] = lambda *args: None
# 
# class ABCStream(BytesIO):
# 
#     def read_formatted(self, format):
#         return getattr(self, 'read_' + format)()
# 
#     def write_formatted(self, format, value):
#         return getattr(self, 'write_' + format)(value)
# 
#     def read_s24(self):
#         bytes = self.read(3)
#         res = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16)
#         if res > (1 << 23):
#             res = -((~res)&((1 << 23)-1))-1
#         return res
# 
#     def write_s24(self, val):
#         assert -(1 << 23) < val < (1 << 23)
#         if val < 0:
#             val = (1 << 24) + val
#         self.write(bytes([val & 0xFF,
#             ((val >> 8) & 0xFF),
#             val >> 16]))
# 
#     def read_u16(self):
#         bytes = self.read(2)
#         return uint(bytes[0] | (bytes[1] << 8))
# 
#     def write_u16(self, val):
#         assert 0 <= val < 1 << 16
#         self.write(bytes([
#             val & 0xFF,
#             val >> 8]))
# 
#     def read_u8(self):
#         return uint(self.read(1)[0])
# 
#     def write_u8(self, val):
#         assert 0 <= val < 256
#         self.write(bytes([ val ]))
# 
#     def read_u30(self):
#         res = 0
#         for i in range(5):
#             b = self.read(1)
#             res |= (b[0] & 127) << (i*7)
#             if not (b[0] & 128):
#                 break
#         assert res < (1 << 30)
#         return uint(res)
# 
#     def write_u30(self, val):
#         assert val < (1 << 30)
#         while True:
#             byte = val & 127
#             val >>= 7
#             if val:
#                 byte |= 128
#             self.write(bytes([byte]))
#             if not val:
#                 break
# 
#     def read_s32(self):
#         res = 0
#         for i in range(5):
#             b = self.read(1)
#             if b[0] & 128:
#                 res |= (b[0] & 127) << (i*7)
#             else:
#                 res |= (b[0] & 63) << (i*7)
#                 if b[0] & 64:
#                     res = -res
#                 break
#         assert -(1 << 32) < res < (1 << 32)
#         return res
# 
#     def write_s32(self, val):
#         if val < 0:
#             sign = 64
#             val = -val
#         else:
#             sign = 0
#         assert val < (1 << 32)
#         while True:
#             byte = val & 127
#             val >>= 7
#             if val:
#                 byte |= 128
#             elif byte >= 64:
#                 byte |= 128
#             else:
#                 byte |= sign
#             self.write(bytes([byte]))
#             if not (byte & 128):
#                 break
# 
#     def read_u32(self):
#         res = 0
#         for i in range(5):
#             b = self.read(1)
#             res |= (b[0] & 127) << (i*7)
#             if not (b[0] & 128):
#                 break
#         assert res < (1 << 32)
#         return uint(res)
# 
#     def write_u32(self, val):
#         assert 0 <= val < (1 << 32)
#         while val:
#             byte = val & 127
#             val >>= 7
#             if val:
#                 byte |= 128
#             self.write(bytes([byte]))
# 
#     def read_d64(self):
#         return struct.unpack('d', self.read(8))[0]
# 
#     def write_d64(self, val):
#         self.write(struct.pack('d', val))
# 
# class uint(int):
#     __slots__ = ()
#     def __init__(self, val):
#         assert self >= 0


import struct
import copy
from operator import itemgetter
from collections import defaultdict, OrderedDict as ordereddict
from .tags import Tag, TAG_DoABC
from .io import DummyABCStream, ABCStream, uint
from . import bytecode
        data.constant_pool.double = list(map(itemgetter(0),
            sorted(self.doubles.items(), key=itemgetter(1))))
        data.constant_pool.string = list(map(itemgetter(0),
            sorted(self.strings.items(), key=itemgetter(1))))
        data.constant_pool.multiname_info = list(map(itemgetter(0),
            sorted(self.multinames.items(), key=itemgetter(1))))
        data.constant_pool.namespace_info = list(map(itemgetter(0),
            sorted(self.namespaces.items(), key=itemgetter(1))))
        data.constant_pool.ns_set_info = list(map(itemgetter(0),
            sorted(self.namespace_sets.items(), key=itemgetter(1))))
        data.metadata_info = list(map(itemgetter(0),
            sorted(self.metadata.items(), key=itemgetter(1))))

    def get_string_index(self, value):
        assert isinstance(value, str), "Value {0!r} is not string".format(value)
        self.strings[value] += 1
        return 0

    def get_integer_index(self, value):
        self.integers[value] += 1
        return 0

    def get_uinteger_index(self, value):
        self.uintegers[value] += 1
        return 0

    def get_multiname_index(self, value):
        if isinstance(value, AnyType):
            return 0
        self.multinames[value] += 1

# Path: pyzza/tags.py
# class Tag(object):
# class End(Tag):
# class SymbolClass(Tag):
# class FileAttributes(Tag):
# class ShowFrame(Tag):
#     def blob(self):
#     def _read(self, stream):
#     def __repr__(self):
#     def blob(self):
#     def _read(self, stream):
#     def __init__(self, main_class=None):
#     def _read(self, stream):
#     def blob(self):
#     def __repr__(self):
#     def __init__(self):
#     def _read(self, stream):
#     def blob(self):
#     def blob(self):
# def read(file):
# 
# Path: pyzza/io.py
# class DummyABCStream(object):
#     for i in dir(ABCStream):
#         if not i.startswith('__') and hasattr(getattr(ABCStream, i), '__call__'):
#             locals()[i] = lambda *args: None
# 
# class ABCStream(BytesIO):
# 
#     def read_formatted(self, format):
#         return getattr(self, 'read_' + format)()
# 
#     def write_formatted(self, format, value):
#         return getattr(self, 'write_' + format)(value)
# 
#     def read_s24(self):
#         bytes = self.read(3)
#         res = bytes[0] | (bytes[1] << 8) | (bytes[2] << 16)
#         if res > (1 << 23):
#             res = -((~res)&((1 << 23)-1))-1
#         return res
# 
#     def write_s24(self, val):
#         assert -(1 << 23) < val < (1 << 23)
#         if val < 0:
#             val = (1 << 24) + val
#         self.write(bytes([val & 0xFF,
#             ((val >> 8) & 0xFF),
#             val >> 16]))
# 
#     def read_u16(self):
#         bytes = self.read(2)
#         return uint(bytes[0] | (bytes[1] << 8))
# 
#     def write_u16(self, val):
#         assert 0 <= val < 1 << 16
#         self.write(bytes([
#             val & 0xFF,
#             val >> 8]))
# 
#     def read_u8(self):
#         return uint(self.read(1)[0])
# 
#     def write_u8(self, val):
#         assert 0 <= val < 256
#         self.write(bytes([ val ]))
# 
#     def read_u30(self):
#         res = 0
#         for i in range(5):
#             b = self.read(1)
#             res |= (b[0] & 127) << (i*7)
#             if not (b[0] & 128):
#                 break
#         assert res < (1 << 30)
#         return uint(res)
# 
#     def write_u30(self, val):
#         assert val < (1 << 30)
#         while True:
#             byte = val & 127
#             val >>= 7
#             if val:
#                 byte |= 128
#             self.write(bytes([byte]))
#             if not val:
#                 break
# 
#     def read_s32(self):
#         res = 0
#         for i in range(5):
#             b = self.read(1)
#             if b[0] & 128:
#                 res |= (b[0] & 127) << (i*7)
#             else:
#                 res |= (b[0] & 63) << (i*7)
#                 if b[0] & 64:
#                     res = -res
#                 break
#         assert -(1 << 32) < res < (1 << 32)
#         return res
# 
#     def write_s32(self, val):
#         if val < 0:
#             sign = 64
#             val = -val
#         else:
#             sign = 0
#         assert val < (1 << 32)
#         while True:
#             byte = val & 127
#             val >>= 7
#             if val:
#                 byte |= 128
#             elif byte >= 64:
#                 byte |= 128
#             else:
#                 byte |= sign
#             self.write(bytes([byte]))
#             if not (byte & 128):
#                 break
# 
#     def read_u32(self):
#         res = 0
#         for i in range(5):
#             b = self.read(1)
#             res |= (b[0] & 127) << (i*7)
#             if not (b[0] & 128):
#                 break
#         assert res < (1 << 32)
#         return uint(res)
# 
#     def write_u32(self, val):
#         assert 0 <= val < (1 << 32)
#         while val:
#             byte = val & 127
#             val >>= 7
#             if val:
#                 byte |= 128
#             self.write(bytes([byte]))
# 
#     def read_d64(self):
#         return struct.unpack('d', self.read(8))[0]
# 
#     def write_d64(self, val):
#         self.write(struct.pack('d', val))
# 
# class uint(int):
#     __slots__ = ()
#     def __init__(self, val):
#         assert self >= 0


# Path: pyzza/abc.py
import struct
import copy
from operator import itemgetter
from collections import defaultdict, OrderedDict as ordereddict
from .tags import Tag, TAG_DoABC
from .io import DummyABCStream, ABCStream, uint
from . import bytecode

        data.constant_pool.double = list(map(itemgetter(0),
            sorted(self.doubles.items(), key=itemgetter(1))))
        data.constant_pool.string = list(map(itemgetter(0),
            sorted(self.strings.items(), key=itemgetter(1))))
        data.constant_pool.multiname_info = list(map(itemgetter(0),
            sorted(self.multinames.items(), key=itemgetter(1))))
        data.constant_pool.namespace_info = list(map(itemgetter(0),
            sorted(self.namespaces.items(), key=itemgetter(1))))
        data.constant_pool.ns_set_info = list(map(itemgetter(0),
            sorted(self.namespace_sets.items(), key=itemgetter(1))))
        data.metadata_info = list(map(itemgetter(0),
            sorted(self.metadata.items(), key=itemgetter(1))))

    def get_string_index(self, value):
        assert isinstance(value, str), "Value {0!r} is not string".format(value)
        self.strings[value] += 1
        return 0

    def get_integer_index(self, value):
        self.integers[value] += 1
        return 0

    def get_uinteger_index(self, value):
        self.uintegers[value] += 1
        return 0

    def get_multiname_index(self, value):
        if isinstance(value, AnyType):
            return 0
        self.multinames[value] += 1

        value.write(DummyABCStream(), self)