# Path: src/e2eflow/util.py
# def config_dict(config_path=CONFIG_PATH):
#     """Returns the config as dictionary,
#     where the elements have intuitively correct types.
#     """
# 
#     config = configparser.ConfigParser()
#     config.read(config_path)
# 
#     d = dict()
#     for section_key in config.sections():
#         sd = dict()
#         section = config[section_key]
#         for key in section:
#             val = section[key]
#             try:
#                 sd[key] = int(val)
#             except ValueError:
#                 try:
#                     sd[key] = float(val)
#                 except ValueError:
#                     try:
#                         sd[key] = section.getboolean(key)
#                     except ValueError:
#                         sd[key] = val
#         d[section_key] = sd
#     return d


import os
import subprocess
import datetime
import tensorflow as tf
from shutil import copyfile, rmtree
from .util import config_dict
            os.makedirs(log_dir)
            os.makedirs(save_dir)
            os.makedirs(train_dir)
            os.makedirs(eval_dir)

        # Experiment already exists
        if os.path.isdir(log_dir):
            if overwrite:
                rmtree(log_dir)
                if os.path.isdir(save_dir):
                    rmtree(save_dir)
                _init_dirs()

            else:
                if not os.path.isdir(save_dir):
                    os.makedirs(save_dir)
                    # Copy stored checkpoint in case intermediate checkpoints
                    # were deleted
                    ckpt = self._copy_latest_checkpoint(log_dir, save_dir)
                    if not ckpt:
                        raise RuntimeError('Failed to restore "{}".'
                                           'Use --overwrite=True to clear.'
                                           .format(name))
                    print('Warning: intermediate checkpoints could not be restored.')
        else:
            _init_dirs()

        config_path = os.path.join(log_dir, 'config.ini')
        if not os.path.isfile(config_path) or overwrite:
            copyfile('../config.ini', config_path)

# Path: src/e2eflow/util.py
# def config_dict(config_path=CONFIG_PATH):
#     """Returns the config as dictionary,
#     where the elements have intuitively correct types.
#     """
# 
#     config = configparser.ConfigParser()
#     config.read(config_path)
# 
#     d = dict()
#     for section_key in config.sections():
#         sd = dict()
#         section = config[section_key]
#         for key in section:
#             val = section[key]
#             try:
#                 sd[key] = int(val)
#             except ValueError:
#                 try:
#                     sd[key] = float(val)
#                 except ValueError:
#                     try:
#                         sd[key] = section.getboolean(key)
#                     except ValueError:
#                         sd[key] = val
#         d[section_key] = sd
#     return d


# Path: src/e2eflow/experiment.py
import os
import subprocess
import datetime
import tensorflow as tf
from shutil import copyfile, rmtree
from .util import config_dict

            os.makedirs(log_dir)
            os.makedirs(save_dir)
            os.makedirs(train_dir)
            os.makedirs(eval_dir)

        # Experiment already exists
        if os.path.isdir(log_dir):
            if overwrite:
                rmtree(log_dir)
                if os.path.isdir(save_dir):
                    rmtree(save_dir)
                _init_dirs()

            else:
                if not os.path.isdir(save_dir):
                    os.makedirs(save_dir)
                    # Copy stored checkpoint in case intermediate checkpoints
                    # were deleted
                    ckpt = self._copy_latest_checkpoint(log_dir, save_dir)
                    if not ckpt:
                        raise RuntimeError('Failed to restore "{}".'
                                           'Use --overwrite=True to clear.'
                                           .format(name))
                    print('Warning: intermediate checkpoints could not be restored.')
        else:
            _init_dirs()

        config_path = os.path.join(log_dir, 'config.ini')
        if not os.path.isfile(config_path) or overwrite:
            copyfile('../config.ini', config_path)

        config = config_dict(config_path)