# Path: rst2pdf/log.py
# def nodeid(node):
# 
# Path: rst2pdf/rson.py
# def loads(s, **kw):
#     if not kw:
#         return default_loads(s)
# 
#     key = tuple(sorted(kw.items()))
#     func = cached(key)
#     if func is None:
#         # Begin some real ugliness here -- just modify our instance to
#         # have the correct user variables for the initialization functions.
#         # Seems to speed up simplejson testcases a bit.
#         self.__dict__ = dict((x, y) for (x, y) in key if y is not None)
#         func = parsercache[key] = parser_factory()
# 
#     return func(s)


import os
import re
from rst2pdf.log import log
from rst2pdf.rson import loads as rson_loads
        while 1:
            total = sum(values)
            if total > 100:
                values[values.index(max(values))] -= 1
            elif total < 100:
                values[values.index(max(values))] += 1
            else:
                break

        values = ['%s%%' % x for x in values]
        self.widthcount += 1
        stylename = 'embeddedtablewidth%d' % self.widthcount
        self.styles.setdefault('styles', {})[stylename] = dict(
            parent=parent, colWidths=values
        )
        self.result.extend(['', '', '.. class:: ' + stylename, ''])

    def handle_style(self, chunk):
        """Parse through the source until we find lines that are no longer indented,
        then pass our indented lines to the RSON parser.
        """
        self.changed = True
        if chunk:
            log.error(".. style:: does not recognize string %s" % repr(chunk))
            return

        mystyles = '\n'.join(self.read_indented())
        if not mystyles:
            log.error("Empty .. style:: block found")
        try:

# Path: rst2pdf/log.py
# def nodeid(node):
# 
# Path: rst2pdf/rson.py
# def loads(s, **kw):
#     if not kw:
#         return default_loads(s)
# 
#     key = tuple(sorted(kw.items()))
#     func = cached(key)
#     if func is None:
#         # Begin some real ugliness here -- just modify our instance to
#         # have the correct user variables for the initialization functions.
#         # Seems to speed up simplejson testcases a bit.
#         self.__dict__ = dict((x, y) for (x, y) in key if y is not None)
#         func = parsercache[key] = parser_factory()
# 
#     return func(s)


# Path: rst2pdf/extensions/preprocess_r2p.py
import os
import re
from rst2pdf.log import log
from rst2pdf.rson import loads as rson_loads

        while 1:
            total = sum(values)
            if total > 100:
                values[values.index(max(values))] -= 1
            elif total < 100:
                values[values.index(max(values))] += 1
            else:
                break

        values = ['%s%%' % x for x in values]
        self.widthcount += 1
        stylename = 'embeddedtablewidth%d' % self.widthcount
        self.styles.setdefault('styles', {})[stylename] = dict(
            parent=parent, colWidths=values
        )
        self.result.extend(['', '', '.. class:: ' + stylename, ''])

    def handle_style(self, chunk):
        """Parse through the source until we find lines that are no longer indented,
        then pass our indented lines to the RSON parser.
        """
        self.changed = True
        if chunk:
            log.error(".. style:: does not recognize string %s" % repr(chunk))
            return

        mystyles = '\n'.join(self.read_indented())
        if not mystyles:
            log.error("Empty .. style:: block found")
        try:

            styles = rson_loads(mystyles)