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


Python utils.read_config函数代码示例

本文整理汇总了Python中utils.read_config函数的典型用法代码示例。如果您正苦于以下问题:Python read_config函数的具体用法?Python read_config怎么用?Python read_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: main

def main(params_file):
    params = {}
    params_file = os.path.realpath(params_file)
    # Figure out the paths
    script_path = os.path.realpath(__file__)
    script_dir = os.path.dirname(script_path)
    app_dir = os.path.dirname(script_dir)
    params['app_dir'] = app_dir

    # Current timestamp
    curr_timestamp = time.strftime("%d_%b_%Y_%H_%M_%S_GMT", time.gmtime())

    # read configuration file and check
    utils.read_config(params_file, params)
    process_country_gender(params)
开发者ID:pandasasa,项目名称:name,代码行数:15,代码来源:process_country_gender_zh.py

示例2: main

def main(argv):
    """
    Entry point for etl module.
    """
    option_parser = optparse.OptionParser(usage=DEFAULT_USAGE_TEXT)
    option_parser.add_option("-c", "--config", dest="config",
                             default="config.cfg", help="Configuration file")
    option_parser.add_option("-v", "--verbose", dest="verbose",
                             action="store_true", default=False,
                             help="Show verbose output")
    options, _ = option_parser.parse_args(argv)

    if not os.path.exists(options.config):
        sys.stderr.write("ERROR: {} does not exist\n".format(options.config))
        option_parser.print_help()
        return 1
    config = read_config(options.config)

    log_dir = config['general']['log_dir']
    if not os.path.exists(log_dir):
        os.mkdir(log_dir)
    filename = os.path.join(log_dir, __file__.replace(".py", ".log"))
    setup_logger(filename, options.verbose)
    logging.debug("config={}".format(json.dumps(config, indent=2)))

    retcode = run_etl(config)
    return retcode
开发者ID:ydupont,项目名称:101repo,代码行数:27,代码来源:run_etl.py

示例3: play_sound

def play_sound(fname):
    global cfg_dict
    cfg_dict = utils.read_config()

    audio = pyaudio.PyAudio()
    stream_audio = audio.open(format=pyaudio.paInt16,
                              channels=2,
                              rate=cfg_dict['rate'],
                              output=True,
                              frames_per_buffer=cfg_dict['rate'])

    f = open(fname)
    data = list(utils.chunks(f.read(), cfg_dict['rate']))
    f.close()

    print ' * play'
    start = time.time()

    for i in range(len(data)):
        stream_audio.write(data[i])

    print ' * play end |',

    stream_audio.stop_stream()
    stream_audio.close()
    audio.terminate()

    print 'elapsed time =', time.time() - start
开发者ID:el-100,项目名称:MicrAudio,代码行数:28,代码来源:send.py

示例4: __init__

 def __init__(self, path):
     """
     :param path: path to theme file
     :type path: str
     :raises: :class:`~alot.settings.errors.ConfigError`
     """
     self._spec = os.path.join(DEFAULTSPATH, 'theme.spec')
     self._config = read_config(path, self._spec,
                                checks={'align': align_mode,
                                        'widthtuple': width_tuple,
                                        'force_list': force_list,
                                        'attrtriple': attr_triple})
     self._colours = [1, 16, 256]
     # make sure every entry in 'order' lists have their own subsections
     threadline = self._config['search']['threadline']
     for sec in self._config['search']:
         if sec.startswith('threadline'):
             tline = self._config['search'][sec]
             if tline['parts'] is not None:
                 listed = set(tline['parts'])
                 here = set(tline.sections)
                 indefault = set(threadline.sections)
                 diff = listed.difference(here.union(indefault))
                 if diff:
                     msg = 'missing threadline parts: %s' % ', '.join(diff)
                     raise ConfigError(msg)
开发者ID:SuperScript,项目名称:alot,代码行数:26,代码来源:theme.py

示例5: XST

def XST(env, target, source):
    """
    A pseudo-Builder wrapper for the XST synthesizer

    Reads the config file
    Creates the XST Project file (containing all the verilog)
    Creates the XST Script file (containing all of the commands)
    Executes the build

    Args:
        env (SCons Environment)
        target (list of strings)
        source (list of strings) 

    Returns:
        The output file list

    Raises:
        XSTBuilderWarning
        XSTBuilderError
    """
    #OKAY MAYBE I DIDN'T NEED A PSUEDO-BUILDER
    config = utils.read_config(env)
    _xst_builder.__call__(env, env["XST_NGC_FILE"], config["verilog"])
    return [xst_utils.get_ngc_filename(config)]
开发者ID:CospanDesign,项目名称:nysa-tx1-pcie-platform,代码行数:25,代码来源:xst.py

示例6: upload

def upload(env, target, source):
    """
    A Pseudo-builder wrapper for the upload program
    """
    config = utils.read_config(env)

    _upload_builder.__call__(env, target, source)
    return "upload_img"
开发者ID:CospanDesign,项目名称:arm_builder,代码行数:8,代码来源:upload.py

示例7: test_create_build_directory

 def test_create_build_directory(self):
     cfg = utils.read_config(self.env)
     build_dir = "temp"
     cfg["build_dir"] = build_dir
     utils.create_build_directory(cfg)
     build_dir = os.path.join(utils.get_project_base(), build_dir)
     self.assertTrue(os.path.exists(build_dir))
     os.rmdir(build_dir)
开发者ID:CospanDesign,项目名称:xilinx_builder,代码行数:8,代码来源:test_utils.py

示例8: modify_results

def modify_results(results_filename, exam_config_filename,
                   output_filename, invalidate, set_correct):
    config = utils.read_config()
    results = utils.read_results(results_filename)
    exam_data = utils.ExamConfig(exam_config_filename)
    for result in results:
        modify(result, exam_data, invalidate, set_correct)
    utils.write_results(results, output_filename, config['csv-dialect'])
开发者ID:jvrplmlmn,项目名称:eyegrade,代码行数:8,代码来源:modify_results.py

示例9: BITGEN

def BITGEN(env, target, source):
    """
    A pseudo-builder wrapper for Xilinx Bitgen
    """
    config = utils.read_config(env)
    env["BITGEN_SOURCES"] = source
    env["BITGEN_TARGETS"] = target
    _bitgen_builder.__call__(env, target, source)
    return bitgen_utils.get_bitgen_filename(config)
开发者ID:CospanDesign,项目名称:nysa-tx1-pcie-platform,代码行数:9,代码来源:bitgen.py

示例10: __init__

 def __init__(self, path):
     """
     :param path: path to theme file
     :type path: str
     :raises: :class:`~alot.settings.errors.ConfigError`
     """
     self._spec = os.path.join(DEFAULTSPATH, 'theme.spec')
     self._config = read_config(path, self._spec)
     self.attributes = self._parse_attributes(self._config)
开发者ID:laarmen,项目名称:alot,代码行数:9,代码来源:theme.py

示例11: main

def main(params_file):
    params = {}
    params_file = os.path.realpath(params_file)
    # Figure out the paths
    script_path = os.path.realpath(__file__)
    script_dir = os.path.dirname(script_path)
    app_dir = os.path.dirname(script_dir)
    params['app_dir'] = app_dir

    # Current timestamp
    curr_timestamp = time.strftime("%d_%b_%Y_%H_%M_%S_GMT", time.gmtime())

    # read configuration file and check
    utils.read_config(params_file, params)
    gen_class = GenderClassifier()
    #gen_class.loadData(params['process_country_gender_output_file_gender'], params['process_country_gender_output_file_gender_zh'], params['gender_classifier_model_file_zh'])
    gen_class.loadModel(params['gender_classifier_model_file_zh'])
    t1 = time.time()
    for c in ascii_lowercase:
        print gen_class.predict(c)
    print gen_class.predict('Diyi Yang')
    t2 = time.time()
    print("Predict Time: %f ms" % ((t2 - t1) * 1000))
    print gen_class.predict('Yuntian Deng')
    print gen_class.predict('Hanyue Liang')
    print gen_class.predict('Lidan Mu')
    print gen_class.predict('Lanxiao Xu')
    print gen_class.predict('Zhiruo Zhou')
    print gen_class.predict('Charlotte Riley')
    print gen_class.predict('Qi Guo')
    print gen_class.predict('Eric Xing')
    print gen_class.predict('Yiming Yang')
    print gen_class.predict('Xiaoping Deng')
    print gen_class.predict('Yidi Zhao')
    print gen_class.predict('Yuanchi Ning')
    print gen_class.predict('Jinping Xi')
    print gen_class.predict('Liyuan Peng')
    print gen_class.predict('Wei-chiu Ma')
    print gen_class.predict('Zhiting Hu')
    print gen_class.predict('Hao Zhang')
    print gen_class.predict('Li Zhou')
    print gen_class.predict('Shayan Doroudi')
    print gen_class.predict('Daniel Guo')
    print gen_class.predict('Christoph Dann')
开发者ID:imoonkey,项目名称:eduwiki,代码行数:44,代码来源:gender_classifier.py

示例12: TRACE

def TRACE(env, target, source):
    """
    A pseudo-builder wrapper for Xilinx trace
    """
    config = utils.read_config(env)
    env["TRACE_SOURCES"] = source
    env["TRACE_TARGETS"] = target

    _trace_builder.__call__(env, target, source)
    return trace_utils.get_trace_filename(config)
开发者ID:CospanDesign,项目名称:nysa-tx1-pcie-platform,代码行数:10,代码来源:trace.py

示例13: generate

def generate(env):
    env["UPLOAD_COMMAND"] = _detect(env)
    config = utils.read_config(env)
    upload_flags = config["upload_flags"]
    
    env.SetDefault(
            UPLOAD_FLAGS = upload_flags,
            UPLOAD_COMSTR = "$UPLOAD_COMMAND $UPLOAD_FLAGS $SOURCES"
            )
    env.AddMethod(_upload_builder, "upload")
    return None
开发者ID:CospanDesign,项目名称:arm_builder,代码行数:11,代码来源:upload.py

示例14: PAR

def PAR(env, target, source):
    """
    A pseudo-builder wrapper for the Xilinx par
    """
    config = utils.read_config(env)
    env["PAR_SOURCES"] = source
    env["PAR_TARGETS"] = target

    _par_builder.__call__(env, target, source)

    return par_utils.get_par_filename(config)
开发者ID:CospanDesign,项目名称:nysa-tx1-pcie-platform,代码行数:11,代码来源:par.py

示例15: __init__

    def __init__(self, pid, role, config_path):
        self.__config = utils.read_config(config_path)
        for r in self.__config:
            if r in ('acceptors', 'proposers', 'clients', 'learners'):
                self.__config[r][1] = int(self.__config[r][1])
        self.__role = role
        self.__multicast_group = tuple(self.__config[self.__role])

        self._id = pid
        self.__recv_socket = self.__init_socket(self.__multicast_group[0])
        self.__recv_socket.bind(self.__multicast_group)
开发者ID:enriquefynn,项目名称:pyPaxos,代码行数:11,代码来源:entity.py


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