def terminate(self):
try:<EOL><INDENT>self.id2sims.terminate()<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT>import glob<EOL>for fname in glob.glob(self.fname + '<STR_LIT:*>'):<EOL><INDENT>try:<EOL><INDENT>os.remove(fname)<EOL>logger.info("<STR_LIT>" % fname)<EOL><DEDENT>except Exception as e:<EOL><INDENT>logger.warning("<STR_LIT>" % (fname, e))<EOL><DEDENT><DEDENT>for val in list(self.__dict__.keys()):<EOL><INDENT>try:<EOL><INDENT>delattr(self, val)<EOL><DEDENT>except:<EOL><INDENT>pass<EOL><DEDENT><DEDENT>
Delete all files created by this index, invalidating `self`. Use with care.