def _create(self): if dir_exists(self.directory): if len(list_files_recursively(self.directory)) > 0: raise RuntimeError( "Cannot create new project {!r}. Directory {!r} already exists and is not empty" .format(self.name, self.directory)) else: mkdir(self.directory) self.set_meta(ProjectMeta())
def _create(self): ''' Creates a leaf directory and empty meta.json file. Generate exception error if project directory already exists and is not empty. ''' if dir_exists(self.directory): if len(list_files_recursively(self.directory)) > 0: raise RuntimeError( "Cannot create new project {!r}. Directory {!r} already exists and is not empty" .format(self.name, self.directory)) else: mkdir(self.directory) self.set_meta(ProjectMeta())