# Path: cellpy/exceptions.py
# class ConfigFileNotRead(Error):
#     """Raised when the configuration file cannot be read"""
# 
#     pass
# 
# class ConfigFileNotWritten(Error):
#     """Raised when the configuration file cannot be written"""
# 
#     pass
# 
# Path: cellpy/parameters/prms.py
# class CellPyConfig:
# class PathsClass(CellPyConfig):
# class FileNamesClass(CellPyConfig):
# class ReaderClass(CellPyConfig):
# class DataSetClass(CellPyConfig):
# class DbClass(CellPyConfig):
# class DbColsClass(CellPyConfig):
# class MaterialsClass(CellPyConfig):
# class BatchClass(CellPyConfig):
# class InstrumentsClass(CellPyConfig):


import getpass
import glob
import logging
import os
import pathlib
import sys
import warnings
import box
import ruamel
from collections import OrderedDict
from dataclasses import asdict, dataclass
from pprint import pprint
from ruamel.yaml import YAML
from cellpy.exceptions import ConfigFileNotRead, ConfigFileNotWritten
from cellpy.parameters import prms
def _convert_instruments_to_dict(x):
    # Converting instruments to dictionary (since it contains box.Box objects)
    d = asdict(x)
    for k, v in d.items():

        try:
            d[k] = v.to_dict()
        except AttributeError:
            pass

    return d


def _convert_to_dict(x):
    try:
        dictionary = x.to_dict()
    except AttributeError:
        dictionary = asdict(x)
    return dictionary


def _pack_prms():
    """if you introduce new 'save-able' parameter dictionaries, then you have
    to include them here"""

    config_dict = {
        "Paths": _convert_to_dict(prms.Paths),
        "FileNames": _convert_to_dict(prms.FileNames),
        "Db": _convert_to_dict(prms.Db),
        "DbCols": _convert_to_dict(prms.DbCols),

# Path: cellpy/exceptions.py
# class ConfigFileNotRead(Error):
#     """Raised when the configuration file cannot be read"""
# 
#     pass
# 
# class ConfigFileNotWritten(Error):
#     """Raised when the configuration file cannot be written"""
# 
#     pass
# 
# Path: cellpy/parameters/prms.py
# class CellPyConfig:
# class PathsClass(CellPyConfig):
# class FileNamesClass(CellPyConfig):
# class ReaderClass(CellPyConfig):
# class DataSetClass(CellPyConfig):
# class DbClass(CellPyConfig):
# class DbColsClass(CellPyConfig):
# class MaterialsClass(CellPyConfig):
# class BatchClass(CellPyConfig):
# class InstrumentsClass(CellPyConfig):


# Path: cellpy/parameters/prmreader.py
import getpass
import glob
import logging
import os
import pathlib
import sys
import warnings
import box
import ruamel
from collections import OrderedDict
from dataclasses import asdict, dataclass
from pprint import pprint
from ruamel.yaml import YAML
from cellpy.exceptions import ConfigFileNotRead, ConfigFileNotWritten
from cellpy.parameters import prms

def _convert_instruments_to_dict(x):
    # Converting instruments to dictionary (since it contains box.Box objects)
    d = asdict(x)
    for k, v in d.items():

        try:
            d[k] = v.to_dict()
        except AttributeError:
            pass

    return d


def _convert_to_dict(x):
    try:
        dictionary = x.to_dict()
    except AttributeError:
        dictionary = asdict(x)
    return dictionary


def _pack_prms():
    """if you introduce new 'save-able' parameter dictionaries, then you have
    to include them here"""

    config_dict = {
        "Paths": _convert_to_dict(prms.Paths),
        "FileNames": _convert_to_dict(prms.FileNames),
        "Db": _convert_to_dict(prms.Db),
        "DbCols": _convert_to_dict(prms.DbCols),

        "DataSet": _convert_to_dict(prms.DataSet),