当前位置: 首页>>代码示例>>Python>>正文


Python ConfigParser.getint方法代码示例

本文整理汇总了Python中ConfigParser.ConfigParser.getint方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigParser.getint方法的具体用法?Python ConfigParser.getint怎么用?Python ConfigParser.getint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConfigParser.ConfigParser的用法示例。


在下文中一共展示了ConfigParser.getint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: readIni

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def readIni(nb):
    global K, N, cut, gui, distrWE, distrNS, vehphWEA, vehphNSA, maxSumFlow, tlType, intergreenLength, GSum
    global phaseMinWE, phaseMaxWE, phaseMinNS, phaseMaxNS, maxGap, detPos
    filename = 'input' + str(nb).zfill(2) + '.ini'
    ini = ConfigParser()
    ini.read(filename)

    K = ini.getint("general", "K")
    N = ini.getint("general", "N")

    cut = ini.getboolean("general", "cut")

    gui = ini.getboolean("general", "gui")

    distrWE = ini.get("demand", "distrWE")
    distrNS = ini.get("demand", "distrNS")

    vehphWEA = eval(ini.get("demand", "vehphWEA"))
    vehphNSA = eval(ini.get("demand", "vehphNSA"))

    maxSumFlow = ini.getint("demand", "maxSumFlow")

    tlType = ini.get("TL", "tlType")

    intergreenLength = ini.getint("TL", "intergreenLength")
    GSum = ini.getfloat("TL", "GSum")

    [phaseMinWE, phaseMaxWE] = eval(ini.get("TL", "phaseMinMaxWE"))
    [phaseMinNS, phaseMaxNS] = eval(ini.get("TL", "phaseMinMaxNS"))
    maxGap = ini.getfloat("TL", "maxGap")
    detPos = ini.getfloat("TL", "detPos")

    return filename
开发者ID:fieryzig,项目名称:sumo,代码行数:35,代码来源:main.py

示例2: load_config

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
    def load_config(self):
        """
        Loads the vPoller Worker Manager configuration settings

        """
        logger.debug('Loading config file %s', self.config_file)

        parser = ConfigParser(self.config_defaults)
        parser.read(self.config_file)

        self.config['mgmt'] = parser.get('worker', 'mgmt')
        self.config['db'] = parser.get('worker', 'db')
        self.config['proxy'] = parser.get('worker', 'proxy')
        self.config['helpers'] = parser.get('worker', 'helpers')
        self.config['tasks'] = parser.get('worker', 'tasks')
        self.config['cache_enabled'] = parser.getboolean('cache', 'enabled')
        self.config['cache_maxsize'] = parser.getint('cache', 'maxsize')
        self.config['cache_ttl'] = parser.getint('cache', 'ttl')
        self.config['cache_housekeeping'] = parser.getint('cache', 'housekeeping')

        if self.config['helpers']:
            self.config['helpers'] = self.config['helpers'].split(',')

        if self.config['tasks']:
            self.config['tasks'] = self.config['tasks'].split(',')
        
        logger.debug(
            'Worker Manager configuration: %s',
            self.config
        )
开发者ID:dnaeon,项目名称:py-vpoller,代码行数:32,代码来源:worker.py

示例3: load_arguments

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def load_arguments(file_name):
    """load arguments from arguments.conf"""
    arg = {}
    cf = ConfigParser()
    cf.read(file_name)

    arg["start_time"] = cf.getint("arguments", "start_time")
    arg["time_length"] = cf.getint("arguments", "time_length")
    arg["bandwidth"] = cf.getint("arguments", "bandwidth")
    arg["out_range"] = cf.getint("arguments", "out_range")
    arg["source"] = cf.get("arguments", "source")
    arg["input"] = cf.get("arguments", "input")
    arg["output"] = cf.get("arguments", "output")

    arg["all_recall"] = cf.getfloat("prediction", "all_recall")
    arg["all_precision"] = cf.getfloat("prediction", "all_precision")
    arg["text_recall"] = cf.getfloat("prediction", "text_recall")
    arg["text_precision"] = cf.getfloat("prediction", "text_precision")
    arg["image_recall"] = cf.getfloat("prediction", "image_recall")
    arg["image_precision"] = cf.getfloat("prediction", "image_precision")
    arg["app_recall"] = cf.getfloat("prediction", "app_recall")
    arg["app_precision"] = cf.getfloat("prediction", "video_precision")
    arg["video_recall"] = cf.getfloat("prediction", "video_recall")
    arg["video_precision"] = cf.getfloat("prediction", "all_precision")
    arg["audio_recall"] = cf.getfloat("prediction", "audio_recall")
    arg["audio_precision"] = cf.getfloat("prediction", "audio_precision")
    arg["other_recall"] = cf.getfloat("prediction", "other_recall")
    arg["other_precision"] = cf.getfloat("prediction", "other_precision")

    return arg
开发者ID:pangzy,项目名称:experiment,代码行数:32,代码来源:lib.py

示例4: read

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
 def read(self, f):
     '''Read the settings from the given file handle.'''
     cfg = ConfigParser()
     cfg.readfp(f)
     
     netSection = 'Network'
     if cfg.has_section(netSection):
         if cfg.has_option(netSection, 'defaultIpAddress'):
             self.defaultIpAddress = cfg.get(netSection, 'defaultIpAddress')
         if cfg.has_option(netSection, 'defaultPort'):
             self.defaultPort = cfg.getint(netSection, 'defaultPort')
         if cfg.has_option(netSection, 'ephemeralPortsFrom'):
             self.ephemeralPorts[0] = cfg.getint(netSection, 'ephemeralPortsFrom')
         if cfg.has_option(netSection, 'ephemeralPortsTo'):
             self.ephemeralPorts[1] = cfg.getint(netSection, 'ephemeralPortsTo')
                     
     tftpSection = 'TFTP'
     if cfg.has_section(tftpSection):
         if cfg.has_option(tftpSection, 'timeout'):
             self.tftpTimeout = cfg.getfloat(tftpSection, 'timeout')
         if cfg.has_option(tftpSection, 'retries'):
             self.tftpRetries = cfg.getint(tftpSection, 'retries')
                     
     serverSection = 'Server'
     if cfg.has_section(serverSection):
         if cfg.has_option(serverSection, 'defaultDirectory'):
             self.defaultDirectory = cfg.get(serverSection, 'defaultDirectory')
         if cfg.has_option(serverSection, 'saveLastUsed'):
             self.saveLastUsed = cfg.getboolean(serverSection, 'saveLastUsed')
开发者ID:javert,项目名称:tftpudGui,代码行数:31,代码来源:TftpudSettings.py

示例5: __init__

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
    def __init__(self, conffile):
        Observable.__init__(self)
	cp = ConfigParser()
	cp.read(conffile)

	if not Globals.globSimulate:
	    wiringpi.wiringPiSetupGpio()

	self.md = MotorDriver([
		    cp.getint("MotorDriver", "LEFT_L"),
		    cp.getint("MotorDriver", "LEFT_R"),
		    cp.getint("MotorDriver", "RIGHT_L"),
		    cp.getint("MotorDriver", "RIGHT_R"),
		    cp.getint("MotorDriver", "VERTICAL_L"),
		    cp.getint("MotorDriver", "VERTICAL_R"),
		    ])
	self.md.start()

	self.ds = DistanceSensor(
		    cp.getint("DistanceSensor", "TRIGGER"),
		    cp.getint("DistanceSensor", "ECHO")
		    )
	self.ds.start()

	self.acl = AltitudeControlLoop(self.md, self.ds)

	self.update("MotorDriver", self.md)
	self.update("DistanceSensor", self.ds)
	self.update("AltitudeControlLoop", self.acl)

	self.md.subscribe(self.update)
	self.ds.subscribe(self.update)
	self.acl.subscribe(self.update)

	self.setCamera(False)
开发者ID:StevenVanAcker,项目名称:ProjectHelios,代码行数:37,代码来源:HeliosController.py

示例6: load

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
    def load(file):
        config = ConfigParser()
        config.read(file)

        # MongoDB settings
        host = config.get('MongoDB', 'host')
        port = config.getint('MongoDB', 'port')

        # Regex settings
        google_analytics = config.get('Regex', 'google_analytics')
        google_adsense = config.get('Regex', 'google_adsense')

        # Procspy
        threads = config.getint('Procspy', 'threads')

        # RabbitMQ
        rabbit_queue = config.get('RabbitMQ', 'queue')

        if not host or not port or not google_analytics or not google_adsense or not threads:
            print 'Please, specify all required parameters in %s!' % file
            sys.exit(1)

        return {
            'host': host,
            'port': port,
            'google_analytics': google_analytics,
            'google_adsense': google_adsense,
            'threads': threads,
            'queue': rabbit_queue
        }
开发者ID:alex-groshev,项目名称:SpyPy,代码行数:32,代码来源:confspy.py

示例7: load_config

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def load_config(args=None):
    if args is None or isinstance(args, basestring):
        namespace = argparse.Namespace()
        if args is None:
            namespace.config = DEFAULT_CONFIG_FILE
        else:
            namespace.config = args
        args = namespace
    try:
        config = ConfigParser()
        config.read(args.config)
        args.ip = config.get('manager', 'ip')
        args.port = config.getint('manager', 'port')
        args.authkey = config.get('manager', 'authkey')
        args.batch_size = config.getint('manager', 'batch_size')
        args.columns = config.get('output', 'columns')

        args.uses_sqlite = config.getboolean('worker', 'uses_sqlite')
        args.processes = config.getint('worker', 'processes')
        args.nth = config.getint('worker', 'nth')
        args.distance = config.getint('worker', 'distance')

        args.dbpath = config.get('db', 'path')
        args.zip2ws_db = os.path.join(args.dbpath, config.get('db', 'zip2ws'))
    except Exception as e:
        logging.error(str(e))

    return args
开发者ID:dunhampa,项目名称:get-weather-data,代码行数:30,代码来源:worker.py

示例8: parseOpts

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def parseOpts():
    global config
    argp = ArgumentParser(description='TorCheck')
    argp.add_argument('-c', nargs='?', default='torcheck.conf')
    f = vars(argp.parse_args())['c']

    # config parser with these defaults set
    confp = ConfigParser({
        # getint() method will convert to int
        'reachable_port': '80',
        'listen_port': '8000',
        'listen_address': '127.0.0.1',
        'export_filename': 'torbel_export.csv',
        'status_filename': 'torbel_export.status',
        'log_file': 'torbel.log',
        'use_forwarded_header': 'False',
        })
    confp.add_section('TorCheck')
    if f: confp.read(f) 
    config = dict()
    config['listen_port'] = confp.getint('TorCheck', 'listen_port')
    config['listen_address'] = confp.get('TorCheck', 'listen_address')
    config['reachable_port'] = confp.getint('TorCheck', 'reachable_port')
    config['export_filename'] = confp.get('TorCheck', 'export_filename')
    config['status_filename'] = confp.get('TorCheck', 'status_filename')
    config['log_file'] = confp.get('TorCheck', 'log_file')
    config['use_forwarded_header'] = confp.get('TorCheck', 'use_forwarded_header')
开发者ID:aagbsn,项目名称:TorCheck,代码行数:29,代码来源:checkweb.py

示例9: __init__

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
	def __init__(self):
		defaults = getDefaults()
		config = ConfigParser()
		config.read(defaults)
		self.tapertype = config.get('signal', 'tapertype')
		self.taperwidth = config.getfloat('signal', 'taperwidth')
		self.maxiter = config.getint('iccs', 'maxiter')
		self.convepsi = config.getfloat('iccs', 'convepsi')
		self.convtype = config.get('iccs', 'convtype')
		self.stackwgt = config.get('iccs', 'stackwgt')
		self.srate = config.getfloat('iccs', 'srate')
		self.fstack = config.get('iccs', 'fstack')
		# SAC headers for time window, trace selection, and quality factors
		self.twhdrs = config.get('sachdrs', 'twhdrs').split()
		self.hdrsel = config.get('sachdrs', 'hdrsel')
		self.qfactors = config.get('sachdrs', 'qfactors').split()
		self.qheaders = config.get('sachdrs', 'qheaders').split()
		self.qweights = [ float(val)  for val in config.get('sachdrs', 'qweights').split() ] 
		# SAC headers for ICCS time picks
		self.ichdrs = config.get('sachdrs', 'ichdrs').split()
		# Choose a xcorr module and function
		self.shift = config.getint('iccs', 'shift')
		modu = config.get('iccs', 'xcorr_modu')
		func = config.get('iccs', 'xcorr_func')
		cmd = 'from %s import %s; xcorr=%s'	% (modu, func, func)
		exec cmd
		self.xcorr = xcorr
		self.xcorr_modu = modu
		self.xcorr_func = func
开发者ID:ASankaran,项目名称:AIMBAT_Qt,代码行数:31,代码来源:ttconfig.py

示例10: canCheckin

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def canCheckin(toCheckin):
	"""
	@returns: True if destination is not locked by another user
		AND this checkin will not overwrite a newer version
	"""
	chkoutInfo = ConfigParser()
	chkoutInfo.read(os.path.join(toCheckin, ".checkoutInfo"))
	chkInDest = chkoutInfo.get("Checkout", "checkedoutfrom")
	version = chkoutInfo.getint("Checkout", "version")
	lockedbyme = chkoutInfo.getboolean("Checkout", "lockedbyme")
	
	nodeInfo = ConfigParser()
	nodeInfo.read(os.path.join(chkInDest, ".nodeInfo"))
	locked = nodeInfo.getboolean("Versioning", "locked")
	latestVersion = nodeInfo.getint("Versioning", "latestversion")
	
	#TODO raise different exceptions to give override options to the user
	result = True
	if lockedbyme == False:
		if locked == True:
			result = False
		if version < latestVersion:
			result = False
	
	return result
开发者ID:nstandif,项目名称:chasm-version-system,代码行数:27,代码来源:utilities.py

示例11: __init__

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
 def __init__(self):
     defaults = getDefaults()
     config = ConfigParser()
     config.read(defaults)
     # SAC headers for time window, trace selection, and quality factors
     self.twhdrs = config.get("sachdrs", "twhdrs").split()
     self.hdrsel = config.get("sachdrs", "hdrsel")
     self.qfactors = config.get("sachdrs", "qfactors").split()
     self.qheaders = config.get("sachdrs", "qheaders").split()
     self.qweights = [float(val) for val in config.get("sachdrs", "qweights").split()]
     # SAC headers for ICCS time picks
     self.ichdrs = config.get("sachdrs", "ichdrs").split()
     # plots
     self.colorwave = config.get("sacplot", "colorwave")
     self.colortwfill = config.get("sacplot", "colortwfill")
     self.colortwsele = config.get("sacplot", "colortwsele")
     self.alphatwfill = config.get("sacplot", "alphatwfill")
     self.alphatwsele = config.get("sacplot", "alphatwsele")
     self.npick = config.getint("sacplot", "npick")
     self.pickcolors = config.get("sacplot", "pickcolors")
     self.pickstyles = config.get("sacplot", "pickstyles").split()
     self.minspan = config.getint("sacplot", "minspan")
     self.fstack = config.get("iccs", "fstack")
     self.thresholds = [float(val) for val in config.get("sacplot", "thresholds").split()]
     self.colorthresholds = config.get("sacplot", "colorthresholds").split()
开发者ID:XStargate,项目名称:aimbat,代码行数:27,代码来源:ttconfig.py

示例12: init_settings

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def init_settings(argv):
    """
    Populates SETTINGS with key-value pairs from configuration file.
    """
    conf = ConfigParser()
    conf.read(argv[1])
    SETTINGS['logfile'] = conf.get('crawl', 'logfile')
    SETTINGS['seeders'] = conf.get('crawl', 'seeders').strip().split("\n")
    SETTINGS['workers'] = conf.getint('crawl', 'workers')
    SETTINGS['debug'] = conf.getboolean('crawl', 'debug')
    SETTINGS['user_agent'] = conf.get('crawl', 'user_agent')
    SETTINGS['socket_timeout'] = conf.getint('crawl', 'socket_timeout')
    SETTINGS['cron_delay'] = conf.getint('crawl', 'cron_delay')
    SETTINGS['max_age'] = conf.getint('crawl', 'max_age')
    SETTINGS['ipv6'] = conf.getboolean('crawl', 'ipv6')
    exclude_nodes = conf.get('crawl', 'exclude_nodes').strip().split("\n")
    exclude_networks = conf.get('crawl',
                                'exclude_networks').strip().split("\n")
    for network in exclude_networks:
        exclude_nodes.extend(
            [str(address) for address in list(ip_network(unicode(network)))])
    SETTINGS['exclude_nodes'] = set(exclude_nodes)
    SETTINGS['crawl_dir'] = conf.get('crawl', 'crawl_dir')
    if not os.path.exists(SETTINGS['crawl_dir']):
        os.makedirs(SETTINGS['crawl_dir'])
    SETTINGS['master'] = argv[2] == "master"
开发者ID:neurocis,项目名称:PiggyNodes,代码行数:28,代码来源:crawl.py

示例13: init

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def init(config_file="ganglia-alert.conf"):
    global INTERVAL, SENDER, SERVER, RECIPIENTS, ALERTS, SMS_NUMBER, DEBUG, LOG_FILE, PID_FILE, API_KEY, API_SECRET
    config = ConfigParser()
    try:
        config.read(config_file)
        INTERVAL = config.getint("options", "interval")
        DEBUG = config.getboolean("options", "debug")
        LOG_FILE = config.get("options", "log_file")
        PID_FILE = config.get("options", "pid_file")
        SENDER = config.get("mail", "sender")
        SERVER = config.get("mail", "server")
        RECIPIENTS = [s.strip() for s in config.get("mail", "recipients").split(",")]
        SMS_NUMBER = config.get("sms", "recipient")
        API_KEY = config.get("sms", "api_key")
        API_SECRET = config.get("sms", "api_secret")
        for section in config.sections():
            if section[:5] == 'Alert':
                severity = config.get(section, 'type')
                expression = config.get(section, 'expression')
                message = config.get(section, 'message')
                action = config.get(section, 'action')
                occurences = config.getint(section, 'occurences')
                ALERTS.append(Alert(severity, expression, message, action, occurences))
        logging.basicConfig(format=FORMAT, filename=LOG_FILE, level=logging.DEBUG)
    except:
        debug("Bad configuration");
        sys.exit(2)
开发者ID:dvoina,项目名称:py-ganglia-alert,代码行数:29,代码来源:ganglia-alert.py

示例14: init_conf

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def init_conf(argv):
    """
    Populates CONF with key-value pairs from configuration file.
    """
    conf = ConfigParser()
    conf.read(argv[1])
    CONF['logfile'] = conf.get('ping', 'logfile')
    CONF['magic_number'] = unhexlify(conf.get('ping', 'magic_number'))
    CONF['db'] = conf.getint('ping', 'db')
    CONF['workers'] = conf.getint('ping', 'workers')
    CONF['debug'] = conf.getboolean('ping', 'debug')
    CONF['source_address'] = conf.get('ping', 'source_address')
    CONF['protocol_version'] = conf.getint('ping', 'protocol_version')
    CONF['user_agent'] = conf.get('ping', 'user_agent')
    CONF['services'] = conf.getint('ping', 'services')
    CONF['relay'] = conf.getint('ping', 'relay')
    CONF['socket_timeout'] = conf.getint('ping', 'socket_timeout')
    CONF['cron_delay'] = conf.getint('ping', 'cron_delay')
    CONF['ttl'] = conf.getint('ping', 'ttl')
    CONF['ipv6_prefix'] = conf.getint('ping', 'ipv6_prefix')
    CONF['nodes_per_ipv6_prefix'] = conf.getint('ping',
                                                'nodes_per_ipv6_prefix')

    CONF['onion'] = conf.getboolean('ping', 'onion')
    CONF['tor_proxy'] = None
    if CONF['onion']:
        tor_proxy = conf.get('ping', 'tor_proxy').split(":")
        CONF['tor_proxy'] = (tor_proxy[0], int(tor_proxy[1]))

    CONF['crawl_dir'] = conf.get('ping', 'crawl_dir')
    if not os.path.exists(CONF['crawl_dir']):
        os.makedirs(CONF['crawl_dir'])

    # Set to True for master process
    CONF['master'] = argv[2] == "master"
开发者ID:ayeowch,项目名称:bitnodes,代码行数:37,代码来源:ping.py

示例15: parseConfig

# 需要导入模块: from ConfigParser import ConfigParser [as 别名]
# 或者: from ConfigParser.ConfigParser import getint [as 别名]
def parseConfig(config_file):
    config = ConfigParser()
    if not config.read(config_file):
        print("ERROR: config file '", config_file, "' not found")
        sys.exit(1)

    if not config.has_section("system.ruby.network"):
        print("ERROR: Ruby network not found in '", config_file)
        sys.exit(1)

    if config.get("system.ruby.network", "type") != "GarnetNetwork_d" :
        print("ERROR: Garnet network not used in '", config_file)
        sys.exit(1)

    number_of_virtual_networks = config.getint("system.ruby.network",
                                               "number_of_virtual_networks")
    vcs_per_vnet = config.getint("system.ruby.network", "vcs_per_vnet")

    buffers_per_data_vc = config.getint("system.ruby.network",
                                        "buffers_per_data_vc")
    buffers_per_control_vc = config.getint("system.ruby.network",
                                           "buffers_per_ctrl_vc")

    ni_flit_size_bits = 8 * config.getint("system.ruby.network",
                                          "ni_flit_size")

    routers = config.get("system.ruby.network", "routers").split()
    int_links = config.get("system.ruby.network", "int_links").split()
    ext_links = config.get("system.ruby.network", "ext_links").split()

    return (config, number_of_virtual_networks, vcs_per_vnet,
            buffers_per_data_vc, buffers_per_control_vc, ni_flit_size_bits,
            routers, int_links, ext_links)
开发者ID:AMDmi3,项目名称:gem5,代码行数:35,代码来源:on-chip-network-power-area.py


注:本文中的ConfigParser.ConfigParser.getint方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。