<s> __author__ = "<STR_LIT>" <EOL> __email__ = "<STR_LIT>" <EOL> """<STR_LIT>""" <EOL> import pickle <EOL> def export_pickle ( data , filename = '<STR_LIT>' , compress = False ) : <EOL> fh = None <EOL> try : <EOL> if compress : <EOL> fh = gzip . open ( filename , "<STR_LIT:wb>" ) <EOL> else : <EOL> fh = open ( filename , "<STR_LIT:wb>" ) <EOL> pickle . dump ( data , fh , pickle . HIGHEST_PROTOCOL ) <EOL> except ( EnvironmentError , pickle . PickingError ) as err : <EOL> print ( "<STR_LIT>" . format ( os . path . basename ( sys . argv [ <NUM_LIT:0> ] , err ) ) ) <EOL> return False <EOL> finally : <EOL> if fh is not None : <EOL> fh . close ( ) <EOL> def test_export_pickle ( ) : <EOL> mydict = { '<STR_LIT:a>' : <NUM_LIT:1> , '<STR_LIT:b>' : <NUM_LIT:2> , '<STR_LIT:c>' : <NUM_LIT:3> } <EOL> export_pickle ( mydict ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_export_pickle ( ) </s>
