Exemplo n.º 1
0
 def _flatten_defaults(input_dict):
     result = {}
     for key in input_dict:
         value = input_dict[key]
         if isinstance(value, dict):
             value = UserConfig._flatten_defaults(value)
             for key_inner in value.keys():
                 result[joinsettings(key, key_inner)] = value[key_inner]
         else:
             result[key] = value
     return result
Exemplo n.º 2
0
 def _flatten_defaults(input_dict):
     result = {}
     for key in input_dict:
         value = input_dict[key]
         if isinstance(value, dict):
             value = UserConfig._flatten_defaults(value)
             for key_inner in value.keys():
                 result[joinsettings(key, key_inner)] = value[key_inner]
         else:
             result[key] = value
     return result
Exemplo n.º 3
0
 def _check_section_option_is_valid(self, option, second):
     """
     Sanity check the section and option are strings and return the flattened option key
     """
     if second is None:
         if not is_text_string(option):
             raise TypeError('Found invalid type ({}) for option ({}) must be a string'.format(type(option), option))
         return option
     else: # fist argument is actually the section/group
         if not is_text_string(option):
             raise TypeError('Found invalid type ({}) for section ({}) must be a string'.format(type(option), option))
         if not is_text_string(second):
             raise TypeError('Found invalid type ({}) for option ({}) must be a string'.format(type(second), second))
         return joinsettings(option, second)
Exemplo n.º 4
0
 def _check_section_option_is_valid(self, option, second):
     """
     Sanity check the section and option are strings and return the flattened option key
     """
     if second is None:
         if not is_text_string(option):
             raise TypeError('Found invalid type ({}) for option ({}) must be a string'.format(type(option), option))
         return option
     else: # fist argument is actually the section/group
         if not is_text_string(option):
             raise TypeError('Found invalid type ({}) for section ({}) must be a string'.format(type(option), option))
         if not is_text_string(second):
             raise TypeError('Found invalid type ({}) for option ({}) must be a string'.format(type(second), second))
         return joinsettings(option, second)