#NEWLINE# @ upgrade_steps . add ( '1.0' ) #NEWLINE# def _upgrade_1_0( self ) : #NEWLINE# #INDENT# if os . path . exists ( self . _md_filename ) : #NEWLINE# #INDENT# with open ( self . _md_filename , 'r' ) as f : #NEWLINE# #INDENT# old_md = json . load ( f ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# old_md = None #NEWLINE# #UNINDENT# active_model = ( old_md [ ( - 1 ) ] [ 'version' ] if old_md else None ) #NEWLINE# new_md = { #NEWLINE# #INDENT# 'models' : ( old_md or [ ] ) , #NEWLINE# 'properties' : { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# if ( active_model is not None ) : #NEWLINE# #INDENT# new_md [ 'properties' ] [ 'active-model' ] = str ( active_model ) #NEWLINE# #UNINDENT# with open ( self . _md_filename , 'w' ) as f : #NEWLINE# #INDENT# json . dump ( new_md , f , indent = 4 )