<s> import datetime <EOL> import decimal <EOL> import traceback <EOL> import uuid <EOL> try : <EOL> import json <EOL> except ImportError : <EOL> import simplejson as json <EOL> class MoreTypesJSONEncoder ( json . JSONEncoder ) : <EOL> """<STR_LIT>""" <EOL> def default ( self , data ) : <EOL> if isinstance ( data , ( datetime . datetime , datetime . date , datetime . time ) ) : <EOL> return data . isoformat ( ) <EOL> elif isinstance ( data , decimal . Decimal ) or isinstance ( data , uuid . UUID ) : <EOL> return str ( data ) <EOL> else : <EOL> return super ( MoreTypesJSONEncoder , self ) . default ( data ) <EOL> def format_traceback ( exc_info ) : <EOL> stack = traceback . format_stack ( ) <EOL> stack = stack [ : - <NUM_LIT:2> ] <EOL> stack . extend ( traceback . format_tb ( exc_info [ <NUM_LIT:2> ] ) ) <EOL> stack . extend ( traceback . format_exception_only ( exc_info [ <NUM_LIT:0> ] , exc_info [ <NUM_LIT:1> ] ) ) <EOL> stack_str = "<STR_LIT>" <EOL> stack_str += "<STR_LIT>" . join ( stack ) <EOL> stack_str = stack_str [ : - <NUM_LIT:1> ] <EOL> return stack_str </s>
