Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.config = config.BugwarriorConfigParser()
self.config.add_section('general')
self.config.set('general', 'someint', '4')
self.config.set('general', 'somenone', '')
self.config.set('general', 'somechar', 'somestring')
def setUp(self):
self.config = config.BugwarriorConfigParser(allow_no_value=True)
self.config.add_section('general')
self.config.set('general', 'log.level', 'INFO')
self.config.set('general', 'log.file', None)
self.dir = os.getcwd()
os.chdir(os.path.expanduser('~'))
def setUp(self):
self.target = 'someservice'
self.config = config.BugwarriorConfigParser()
self.config.add_section(self.target)
self.config.set(self.target, 'someprefix.someint', '4')
self.config.set(self.target, 'someprefix.somenone', '')
self.config.set(self.target, 'someprefix.somechar', 'somestring')
self.config.set(self.target, 'someprefix.somebool', 'true')
self.service_config = config.ServiceConfig(
'someprefix', self.config, self.target)
def load_config(main_section, interactive=False):
config = BugwarriorConfigParser({'log.level': "INFO", 'log.file': None}, allow_no_value=True)
path = get_config_path()
config.readfp(codecs.open(path, "r", "utf-8",))
config.interactive = interactive
config.data = BugwarriorData(get_data_path(config, main_section))
config.set(main_section, 'log.file', fix_logging_path(config, main_section))
validate_config(config, main_section)
return config
def getint(self, section, option):
""" Accepts both integers and empty values. """
try:
return super(BugwarriorConfigParser, self).getint(section, option)
except ValueError:
if self.get(section, option) == u'':
return None
else:
raise ValueError(
"{section}.{option} must be an integer or empty.".format(
section=section, option=option))