Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def remove_dir():
"""
Remove default directory for folds if there're no files nut models. In other way it raises warning.
Args:
:return: Nothing.
"""
try:
if os.path.exists(_FoldFile.default_dir):
os.rmdir(_FoldFile.default_dir)
except OSError as err:
get_eval_logger().warning(err.message)
def __init__(self, fold, storage_name, sep, column_description):
super(_FoldFile, self).__init__(
fold, storage_name,
sep=sep, column_description=column_description
)
self._file_path = os.path.join(self.default_dir,
storage_name)
self._prepare_path()
self._lines = []
self._file = None
def create_fold(self, fold_set, name, id):
file_name = self.create_name_from_id(name, id)
fold_file = _FoldFile(fold_set,
file_name,
sep=self._line_reader.get_separator(),
column_description=self._column_description)
self._folds_storage.add(fold_file)
return fold_file