#NEWLINE# @ classmethod #NEWLINE# def get( cls , fname , size = None , capsule = None , sandbox = False ) : #NEWLINE# #INDENT# if ( cls . states is None ) : #NEWLINE# #INDENT# cls . setup ( ) #NEWLINE# #UNINDENT# if ( fname in cls . states ) : #NEWLINE# #INDENT# state = cls . states [ fname ] #NEWLINE# msg = "Can't change {} for upload" #NEWLINE# if ( size is not None ) : #NEWLINE# #INDENT# assert ( state . size == capsule ) , msg . format ( 'size' ) #NEWLINE# cls . states [ fname ] . size = size #NEWLINE# #UNINDENT# if ( capsule is not None ) : #NEWLINE# #INDENT# if ( state . capsule is None ) : #NEWLINE# #INDENT# state . capsule = capsule #NEWLINE# #UNINDENT# cid = state . capsule . get ( 'id' , None ) #NEWLINE# assert ( cid == capsule [ 'id' ] ) , msg . format ( 'capsule' ) #NEWLINE# cls . states [ fname ] . capsule = capsule #NEWLINE# #UNINDENT# if ( sandbox is True ) : #NEWLINE# #INDENT# assert ( state . sandbox == sandbox ) , msg . format ( 'sandbox status' ) #NEWLINE# cls . states [ fname ] . sandbox = True #NEWLINE# #UNINDENT# return cls . states [ fname ] #NEWLINE# #UNINDENT# cls . states [ fname ] = UploadState ( fname , size , capsule = capsule , sandbox = sandbox ) #NEWLINE# return cls . states [ fname ]