def read_config_file(self, filename):
    if (not isinstance(filename, str)):
        raise ValueError('"file_name" must be a string')
    with open(filename, 'r') as stream:
        try:
            data = yaml.load(stream)
        except yaml.YAMLError as exc:
            print(exc)
    if ('width' not in data):
        raise ValueError('The "figstyle" file must have a "width" field')
    self.__width = float(data['width'])
    if ('ratio' not in data):
        raise ValueError('The "figstyle" file must have a "ratio" field')
    if (isinstance(data['ratio'], list) and (len(data['ratio']) == 2) and isinstance(data['ratio'][0], Number) and isinstance(data['ratio'][1], Number)):
        self.__ratio = data['ratio']
    else:
        raise ValueError((('Error reading "' + filename) + '": ratio must be a list of two numbers [x_ratio, y_ratio]'))
    if ('hspace' not in data):
        raise ValueError('The "figstyle" file must have a "hspace" field')
    self.__hspace = float(data['hspace'])
    if isinstance(data['colors'], list):
        self.__colors = ([None] * len(data['colors']))
        for k in range(len(data['colors'])):
            self.__colors[k] = hex2rgb(data['colors'][k])
    if ('linestyles' in data):
        if isinstance(data['linestyles'], list):
            self.__linestyles = data['linestyles']
    if ('markers' in data):
        if isinstance(data['markers'], list):
            self.__markers = data['markers']
    if ('main_color' in data):
        if isinstance(data['main_color'], str):
            self.__main_color = hex2rgb(data['main_color'])
def read_config_file(self, filename):
    if (not isinstance(filename, str)):
        raise ValueError('"file_name" must be a string')
    with open(filename, 'r') as stream:
        try:
            data = yaml.load(stream)
        except yaml.YAMLError as exc:
            print(exc)
    if ('width' not in data):
        raise ValueError('The "figstyle" file must have a "width" field')
    self.__width = float(data['width'])
    if ('ratio' not in data):
        raise ValueError('The "figstyle" file must have a "ratio" field')
    if (isinstance(data['ratio'], list) and (len(data['ratio']) == 2) and isinstance(data['ratio'][0], Number) and isinstance(data['ratio'][1], Number)):
        self.__ratio = data['ratio']
    else:
        raise ValueError((('Error reading "' + filename) + '": ratio must be a list of two numbers [x_ratio, y_ratio]'))
    if ('hspace' not in data):
        raise ValueError('The "figstyle" file must have a "hspace" field')
    self.__hspace = float(data['hspace'])
    if isinstance(data['colors'], list):
        self.__colors = ([None] * len(data['colors']))
        for k in range(len(data['colors'])):
            self.__colors[k] = hex2rgb(data['colors'][k])
    if ('linestyles' in data):
        if isinstance(data['linestyles'], list):
            self.__linestyles = data['linestyles']
    if ('markers' in data):
        if isinstance(data['markers'], list):
            self.__markers = data['markers']
    if ('main_color' in data):
        if isinstance(data['main_color'], str):
            self.__main_color = hex2rgb(data['main_color'])