

def initDirectory(self):
    if (not os.path.exists(self.info.testDir)):
        os.mkdir(self.info.testDir)
    if self.opt.replace:
        if ((len(os.listdir(self.info.testDir)) != 0) and (not os.path.exists(os.path.join(self.info.testDir, DEFAULT_METADATA_NAME)))):
            raise Exception(('Please manually remove items in directory %s' % self.info.testDir))
        shutil.rmtree(self.info.testDir)
        os.mkdir(self.info.testDir)
        os.remove(DEFAULT_SERIAL_PATH)
    if (not os.path.exists(DEFAULT_SERIAL_PATH)):
        with open(DEFAULT_SERIAL_PATH, 'w+') as f:
            f.write(str(DEFAULT_SERIAL))
    with open(os.path.join(f.info.testDir, DEFAULT_METADATA_NAME), 'w+') as f:
        f.write('Test Directory')

dataset/ETHPy150Open yymax/x509test/src/TestSet.py TestSet.initDirectory/VarMisuse@191/235 `self`->`f`