def GetInteger(value): if isinstance(value, (int, float,)): return int(value) # Will always use there very first value, even for nested items elif isinstance(value,(tuple, list,)): # Recursive check lists & tuples return GetInteger(value[0]) elif value and IsString(value): # Convert because of unsupported methods in str class value = GS(value) if HasAlpha(value): return None # Check for negative if value[0] == u'-': if value.count(u'-') <= 1: value = GetInteger(value[1:]) if value != None: return -value # Check for tuple elif u'.' in value: value = value.split(u'.')[0] return GetInteger(value) elif StringIsNumeric(value): return int(value) return None
def GetInteger(value): if isinstance(value, ( int, float, )): return int(value) # Will always use there very first value, even for nested items elif isinstance(value, ( tuple, list, )): # Recursive check lists & tuples return GetInteger(value[0]) elif value and IsString(value): # Convert because of unsupported methods in str class value = GS(value) if HasAlpha(value): return None # Check for negative if value[0] == u'-': if value.count(u'-') <= 1: value = GetInteger(value[1:]) if value != None: return -value # Check for tuple elif u'.' in value: value = value.split(u'.')[0] return GetInteger(value) elif StringIsNumeric(value): return int(value) return None
if u'help' in parsed_args_s: if INSTALLED: help_output = commands.getstatusoutput(u'man debreate') else: help_output = commands.getstatusoutput(u'man --manpath="{}/man" debreate'.format(PATH_app)) if help_output[0]: print(u'ERROR: Could not locate manpage') sys.exit(help_output[0]) help_output = GS(help_output[1]) print(u'\n'.join(help_output.split(u'\n')[2:-1])) sys.exit(0) if u'log-level' in parsed_args_v: Logger.SetLogLevel(parsed_args_v[u'log-level']) Logger.Info(script_name, u'Python version: {}'.format(PY_VER_STRING)) Logger.Info(script_name, u'wx.Python version: {}'.format(WX_VER_STRING)) Logger.Info(script_name, u'Debreate version: {}'.format(VERSION_string)) Logger.Info(script_name, u'Logging level: {}'.format(Logger.GetLogLevel())) # Check for & parse existing configuration conf_values = GetAllConfigKeys()
if u'help' in parsed_args_s: if INSTALLED: help_output = commands.getstatusoutput(u'man debreate') else: help_output = commands.getstatusoutput( u'man --manpath="{}/man" debreate'.format(PATH_app)) if help_output[0]: print(u'ERROR: Could not locate manpage') sys.exit(help_output[0]) help_output = GS(help_output[1]) print(u'\n'.join(help_output.split(u'\n')[2:-1])) sys.exit(0) if u'log-level' in parsed_args_v: Logger.SetLogLevel(parsed_args_v[u'log-level']) Logger.Info(script_name, u'Python version: {}'.format(PY_VER_STRING)) Logger.Info(script_name, u'wx.Python version: {}'.format(WX_VER_STRING)) Logger.Info(script_name, u'Debreate version: {}'.format(VERSION_string)) Logger.Info(script_name, u'Logging level: {}'.format(Logger.GetLogLevel())) # Check for & parse existing configuration conf_values = GetAllConfigKeys() if not conf_values: