#NEWLINE# def __init__( self , swift_proxy = None , swift_proxy_storage_path = None , swift_proxy_cdn_path = None , attempts = 5 , eventlet = None , chunk_size = 65536 , verbose = None , verbose_id = '' , direct_object_ring = None ) : #NEWLINE# #INDENT# super ( DirectClient , self ) . __init__ ( ) #NEWLINE# self . storage_path = swift_proxy_storage_path #NEWLINE# self . cdn_path = swift_proxy_cdn_path #NEWLINE# self . attempts = attempts #NEWLINE# self . chunk_size = chunk_size #NEWLINE# if verbose : #NEWLINE# #INDENT# self . verbose = ( lambda m , * a , **k : verbose ( ( self . _verbose_id + m ) , * a , ** k ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . verbose = ( lambda * a , **k : None ) #NEWLINE# #UNINDENT# self . verbose_id = swift_proxy #NEWLINE# self . _verbose_id = self . verbose_id #NEWLINE# if self . _verbose_id : #NEWLINE# #INDENT# self . _verbose_id += ' ' #NEWLINE# #UNINDENT# self . swift_proxy = swift_proxy #NEWLINE# if ( not swift_proxy ) : #NEWLINE# #INDENT# self . verbose ( 'Creating default proxy instance.' ) #NEWLINE# import swift.proxy.server #NEWLINE# from swiftly.client.localmemcache import LocalMemcache #NEWLINE# from swiftly.client.nulllogger import NullLogger #NEWLINE# try : #NEWLINE# #INDENT# import swift.common.swob #NEWLINE# self . Request = swift . common . swob . Request #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# import webob #NEWLINE# self . Request = webob . Request #NEWLINE# #UNINDENT# self . swift_proxy = swift . proxy . server . Application ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , memcache = LocalMemcache ( ) , logger = NullLogger ( ) ) #NEWLINE# self . oring = None #NEWLINE# def get_oring( * args ) : #NEWLINE# #INDENT# return self . oring #NEWLINE# #UNINDENT# if direct_object_ring : #NEWLINE# #INDENT# self . oring = swift . common . ring . ring . Ring ( direct_object_ring ) #NEWLINE# self . swift_proxy . get_object_ring = get_oring #NEWLINE# #UNINDENT# #UNINDENT# if ( eventlet is None ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# import eventlet #NEWLINE# if ( eventlet . __version__ >= '0.11.0' ) : #NEWLINE# #INDENT# eventlet = True #NEWLINE# #UNINDENT# #UNINDENT# except ImportError : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# if eventlet : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# import eventlet #NEWLINE# self . sleep = eventlet . sleep #NEWLINE# #UNINDENT# except ImportError : #NEWLINE# #INDENT# import time #NEWLINE# self . sleep = time . sleep #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# import time #NEWLINE# self . sleep = time . sleep