<s> try : <EOL> import cloudfiles <EOL> except ImportError : <EOL> pass <EOL> class RackspaceBackend ( object ) : <EOL> def __init__ ( self , username , api_key , container_name ) : <EOL> self . username = username <EOL> self . api_key = api_key <EOL> self . conn = cloudfiles . Connection ( username = username , api_key = api_key ) <EOL> self . container = cloudfiles . Container ( self . conn , name = container_name ) <EOL> @ property <EOL> def name ( self ) : <EOL> return "<STR_LIT>" <EOL> def key ( self , hash ) : <EOL> return cloudfiles . Object ( container = self . container , name = "<STR_LIT>" . format ( hash [ : <NUM_LIT:2> ] , hash [ <NUM_LIT:2> : ] ) ) <EOL> def push ( self , file , hash , cb = None ) : <EOL> self . key ( hash ) . load_from_filename ( file . name , callback = cb ) <EOL> def pull ( self , file , hash , cb = None ) : <EOL> self . key ( hash ) . save_to_filename ( file . name , callback = cb ) <EOL> def exists ( self , hash ) : <EOL> return self . key ( hash ) . etag is not None </s>
