<s> import os <EOL> import json <EOL> from objects import File , Config <EOL> def jsonize ( data ) : <EOL> return json . dumps ( data , sort_keys = False , indent = <NUM_LIT:4> ) <EOL> def store_sample ( data ) : <EOL> sha256 = File ( file_data = data ) . get_sha256 ( ) <EOL> folder = os . path . join ( Config ( ) . api . repository , sha256 [ <NUM_LIT:0> ] , sha256 [ <NUM_LIT:1> ] , sha256 [ <NUM_LIT:2> ] , sha256 [ <NUM_LIT:3> ] ) <EOL> if not os . path . exists ( folder ) : <EOL> os . makedirs ( folder , <NUM_LIT:0> <NUM_LIT> ) <EOL> file_path = os . path . join ( folder , sha256 ) <EOL> if not os . path . exists ( file_path ) : <EOL> sample = open ( file_path , "<STR_LIT:wb>" ) <EOL> sample . write ( data ) <EOL> sample . close ( ) <EOL> return file_path <EOL> def get_sample_path ( sha256 ) : <EOL> path = os . path . join ( Config ( ) . api . repository , sha256 [ <NUM_LIT:0> ] , sha256 [ <NUM_LIT:1> ] , sha256 [ <NUM_LIT:2> ] , sha256 [ <NUM_LIT:3> ] , sha256 ) <EOL> if not os . path . exists ( path ) : <EOL> return None <EOL> return path </s>
