def get_source_index():
 try:
  exists = STORAGE.index_exists('source')
 except OSError:
  create_index()
  exists = False
 if (not exists):
  create_source_index()
 index = STORAGE.open_index('source')
 if ('location' not in index.schema):
  index.add_field('location', TEXT())
 if ('pk' not in index.schema):
  index.add_field('pk', NUMERIC(stored=True, unique=True))
 if ('checksum' in index.schema):
  index.remove_field('checksum')
 return index

def get_source_index ( ) : try : exists = STORAGE . index_exists ( 'source' ) except OSError : create_index ( ) exists = False if ( not exists ) : create_source_index ( ) index = STORAGE . open_index ( 'source' ) if ( 'location' not in index . schema ) : index . add_field ( 'location' , TEXT ( ) ) if ( 'pk' not in index . schema ) : index . add_field ( 'pk' , NUMERIC ( stored = True , unique = True ) ) if ( 'checksum' in index . schema ) : index . remove_field ( 'checksum' ) return index
returns source index object .