Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def raw_set(self, sec, key, val):
"""Set the value without encrypting it."""
return ConfigParser.set(self, sec, key, val)
def set(self, section, option, value):
"""Set an option value. Knows how to set options properly marked
as secure."""
if value is False:
value = '!!False!!'
if self.is_secure_option(section, option):
self.set_secure(section, option, value)
else:
ConfigParser.set(self, section, option, value)
def set_size(self, width, height):
if self.getint("display", "height") == height and \
self.getint("display", "width") == width:
return
configparser.ConfigParser.set(self, "display", "height", str(height))
configparser.ConfigParser.set(self, "display", "width", str(width))
self.changed("display")
def set_list(self, name, list):
self.remove_all_in_list_section(name)
i = 0
for item in list:
configparser.ConfigParser.set(self, name, "%d" % i, item)
i += 1
self.changed(name)
def set_main_window_size(self, width, height):
if self.getint("main_window", "height") == height and \
self.getint("main_window", "width") == width:
return
configparser.ConfigParser.set(
self, "main_window", "height", str(height))
configparser.ConfigParser.set(self, "main_window", "width", str(width))
self.changed("main_window")
def _set(self, section, option, value, verbose):
"""
Private set method
"""
if not self.has_section(section):
self.add_section(section)
if not isinstance(value, str):
value = repr(value)
if verbose:
print('%s[ %s ] = %s' % (section, option, value))
cp.ConfigParser.set(self, section, option, value)
def set(self, section, option, value):
if not self.has_section(section):
self.add_section(section)
configparser.ConfigParser.set(self, section, option, value)