def pdfRepr(obj):
<EOL>if hasattr(obj, '<STR_LIT>'):<EOL><INDENT>return obj.pdfRepr()<EOL><DEDENT>elif isinstance(obj, float):<EOL><INDENT>if not npy.isfinite(obj):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>r = "<STR_LIT>" % obj<EOL>return r.rstrip('<STR_LIT:0>').rstrip('<STR_LIT:.>')<EOL><DEDENT>elif isinstance(obj, int):<EOL><INDENT>return "<STR_LIT>" % obj<EOL><DEDENT>elif is_string_like(obj):<EOL><INDENT>return '<STR_LIT:(>' + _string_escape_regex.sub(r'<STR_LIT>', obj) + '<STR_LIT:)>'<EOL><DEDENT>elif isinstance(obj, dict):<EOL><INDENT>r = ["<STR_LIT>"]<EOL>r.extend(["<STR_LIT>" % (Name(key).pdfRepr(), pdfRepr(val))<EOL>for key, val in list(obj.items())])<EOL>r.append("<STR_LIT>")<EOL>return fill(r)<EOL><DEDENT>elif isinstance(obj, (list, tuple)):<EOL><INDENT>r = ["<STR_LIT:[>"]<EOL>r.extend([pdfRepr(val) for val in obj])<EOL>r.append("<STR_LIT:]>")<EOL>return fill(r)<EOL><DEDENT>elif isinstance(obj, bool):<EOL><INDENT>return ['<STR_LIT:false>', '<STR_LIT:true>'][obj]<EOL><DEDENT>elif obj is None:<EOL><INDENT>return '<STR_LIT:null>'<EOL><DEDENT>elif isinstance(obj, datetime):<EOL><INDENT>r = obj.strftime('<STR_LIT>')<EOL>if time.daylight: z = time.altzone<EOL>else: z = time.timezone<EOL>if z == <NUM_LIT:0>: r += '<STR_LIT>'<EOL>elif z < <NUM_LIT:0>: r += "<STR_LIT>" % ((-z)//<NUM_LIT>, (-z)%<NUM_LIT>)<EOL>else: r += "<STR_LIT>" % (z//<NUM_LIT>, z%<NUM_LIT>)<EOL>return pdfRepr(r)<EOL><DEDENT>elif isinstance(obj, BboxBase):<EOL><INDENT>return fill([pdfRepr(val) for val in obj.bounds])<EOL><DEDENT>else:<EOL><INDENT>raise TypeError("<STR_LIT>"% type(obj))<EOL><DEDENT>
Map Python objects to PDF syntax.