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


Python config.CONFIG属性代码示例

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


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

示例1: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main():
    if len(sys.argv) != 3:
        print('Usage:')
        print('python exodus_download.py <report id> <destination folder>')
        sys.exit(1)

    uri = '/api/report/{}/'.format(sys.argv[1])
    destination = sys.argv[2]

    try:
        ec = ExodusConnector(config.CONFIG['host'], uri)
        ec.login(config.CONFIG['username'], config.CONFIG['password'])
        print('Successfully logged in')
        ec.get_report_info()
        print('Downloading the APK ...')
        apk_path = ec.download_apk(destination)
        print('APK successfully downloaded: {}'.format(apk_path))
    except Exception as e:
        print('ERROR: {}'.format(e))
        sys.exit(1) 
开发者ID:Exodus-Privacy,项目名称:exodus-standalone,代码行数:22,代码来源:exodus_download.py

示例2: converter

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def converter(filepath, src, dst):
    """Convert a MIDI file to a multi-track piano-roll and save the
    resulting multi-track piano-roll to the destination directory. Return a
    tuple of `midi_md5` and useful information extracted from the MIDI file.
    """
    try:
        midi_md5 = os.path.splitext(os.path.basename(filepath))[0]
        multitrack = Multitrack(beat_resolution=CONFIG['beat_resolution'],
                                name=midi_md5)

        pm = pretty_midi.PrettyMIDI(filepath)
        multitrack.parse_pretty_midi(pm)
        midi_info = get_midi_info(pm)

        result_dir = change_prefix(os.path.dirname(filepath), src, dst)
        make_sure_path_exists(result_dir)
        multitrack.save(os.path.join(result_dir, midi_md5 + '.npz'))

        return (midi_md5, midi_info)

    except:
        return None 
开发者ID:salu133445,项目名称:lakh-pianoroll-dataset,代码行数:24,代码来源:converter.py

示例3: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main():
    """Main function."""
    src, dst, midi_info_path = parse_args()
    make_sure_path_exists(dst)
    midi_info = {}

    if CONFIG['multicore'] > 1:
        kv_pairs = joblib.Parallel(n_jobs=CONFIG['multicore'], verbose=5)(
            joblib.delayed(converter)(midi_path, src, dst)
            for midi_path in findall_endswith('.mid', src))
        for kv_pair in kv_pairs:
            if kv_pair is not None:
                midi_info[kv_pair[0]] = kv_pair[1]
    else:
        for midi_path in findall_endswith('.mid', src):
            kv_pair = converter(midi_path, src, dst)
            if kv_pair is not None:
                midi_info[kv_pair[0]] = kv_pair[1]

    if midi_info_path is not None:
        with open(midi_info_path, 'w') as f:
            json.dump(midi_info, f)

    print("{} files have been successfully converted".format(len(midi_info))) 
开发者ID:salu133445,项目名称:lakh-pianoroll-dataset,代码行数:26,代码来源:converter.py

示例4: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main():
    """Main function."""
    src, dst, id_list_path = parse_args()
    make_sure_path_exists(dst)

    with open(id_list_path) as f:
        id_list = [line.split() for line in f]

    if CONFIG['multicore'] > 1:
        joblib.Parallel(n_jobs=CONFIG['multicore'], verbose=5)(
            joblib.delayed(collector)(midi_md5, msd_id, src, dst)
            for midi_md5, msd_id in id_list)
    else:
        for midi_md5, msd_id in id_list:
            collector(midi_md5, msd_id, src, dst)

    print("Subset successfully collected for: {}".format(id_list_path)) 
开发者ID:salu133445,项目名称:lakh-pianoroll-dataset,代码行数:19,代码来源:collector.py

示例5: send_generic

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def send_generic(recipient):
    page.send(recipient, Template.Generic([
        Template.GenericElement("rift",
                                subtitle="Next-generation virtual reality",
                                item_url="https://www.oculus.com/en-us/rift/",
                                image_url=CONFIG['SERVER_URL'] + "/assets/rift.png",
                                buttons=[
                                    Template.ButtonWeb("Open Web URL", "https://www.oculus.com/en-us/rift/"),
                                    Template.ButtonPostBack("tigger Postback", "DEVELOPED_DEFINED_PAYLOAD"),
                                    Template.ButtonPhoneNumber("Call Phone Number", "+16505551234")
                                ]),
        Template.GenericElement("touch",
                                subtitle="Your Hands, Now in VR",
                                item_url="https://www.oculus.com/en-us/touch/",
                                image_url=CONFIG['SERVER_URL'] + "/assets/touch.png",
                                buttons=[
                                    {'type': 'web_url', 'title': 'Open Web URL',
                                     'value': 'https://www.oculus.com/en-us/rift/'},
                                    {'type': 'postback', 'title': 'tigger Postback',
                                     'value': 'DEVELOPED_DEFINED_PAYLOAD'},
                                    {'type': 'phone_number', 'title': 'Call Phone Number', 'value': '+16505551234'},
                                ])
    ])) 
开发者ID:team-anything,项目名称:Briefly,代码行数:25,代码来源:messenger.py

示例6: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main(args):
    """
    function for the initial repositories fetch and manual repositories updates
    """

    if not args:
        _show_usage()
        sys.exit(0)

    logging.basicConfig(
        filename=CONFIG["path.log.fetch"],
        level=logging.DEBUG,
        format='%(asctime)s %(message)s')

    if args[0] == 'fetch-all':
        fetch_all()
    elif args[0] == 'update':
        update_by_name(sys.argv[1])
    elif args[0] == 'update-all':
        update_all()
    else:
        _show_usage()
        sys.exit(0) 
开发者ID:chubin,项目名称:cheat.sh,代码行数:25,代码来源:fetch.py

示例7: get_topic_type

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def get_topic_type(self, topic):
        """
        Return topic type for `topic` or "unknown" if topic can't be determined.
        """

        def __get_topic_type(topic):
            for regexp, route in self.routing_table:
                if re.search(regexp, topic):
                    if route in self._adapter:
                        if self._adapter[route].is_found(topic):
                            return route
                    else:
                        return route
            return CONFIG["routing.default"]

        if topic not in self._cached_topic_type:
            self._cached_topic_type[topic] = __get_topic_type(topic)
        return self._cached_topic_type[topic] 
开发者ID:chubin,项目名称:cheat.sh,代码行数:20,代码来源:routing.py

示例8: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main():
    if request.method == 'POST':
        file = request.files['image']
        model_name = request.form['model']
        model =  CONFIG['pix2depth'][model_name]
        input_path = os.path.join(app.config['UPLOAD_FOLDER'], file.filename)
        file.save(input_path)
        if not development:
            result_path = pix2depth(input_path,model)
        else:
            result_path = str(input_path)
        img_left = str(input_path)
        img_right = str(result_path)
    else:
        img_left = os.path.join(app.config['UPLOAD_FOLDER'], 'pix.jpg')
        img_right = os.path.join(app.config['UPLOAD_FOLDER'], 'depth.jpg')
        
    return render_template('client/index.html',image_left=img_left,image_right=img_right,options = CONFIG['pix2depth']) 
开发者ID:gautam678,项目名称:Pix2Depth,代码行数:20,代码来源:app.py

示例9: depth

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def depth():
    if request.method == 'POST':
        file = request.files['image']
        model_name = request.form['model']
        model = CONFIG['depth2pix'][model_name]
        input_path = os.path.join(app.config['UPLOAD_FOLDER'], file.filename)
        file.save(input_path)
        if not development:
            result_path = depth2pix(input_path,model)
        else:
            result_path = str(input_path)
        img_left = str(input_path)
        img_right = str(result_path)
    else:
        img_left = os.path.join(app.config['UPLOAD_FOLDER'], 'depth.jpg')
        img_right = os.path.join(app.config['UPLOAD_FOLDER'], 'pix.jpg')
        
    return render_template('client/depth.html',image_left=img_left,image_right=img_right,options = CONFIG['depth2pix']) 
开发者ID:gautam678,项目名称:Pix2Depth,代码行数:20,代码来源:app.py

示例10: portrait

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def portrait():
    if request.method == 'POST':
        file = request.files['image']
        model_name = request.form['model']
        model = CONFIG['portrait'][model_name]
        input_path= os.path.join(app.config['UPLOAD_FOLDER'], file.filename)
        file.save(input_path)
        # Perform depth conversion
        if not development:
            result_path = portrait_mode(input_path, model)
        else:
            result_path = str(input_path)
        img_left = str(input_path)
        img_right = str(result_path)
    else:
        img_left = os.path.join(app.config['UPLOAD_FOLDER'], 'pix.jpg')
        img_right = os.path.join(app.config['UPLOAD_FOLDER'], 'pix.jpg')
        
    return render_template('client/potrait.html',image_left=img_left,image_right=img_right,options = CONFIG['portrait']) 
开发者ID:gautam678,项目名称:Pix2Depth,代码行数:21,代码来源:app.py

示例11: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main():
    """Main function."""
    src, dst = parse_args()
    make_sure_path_exists(dst)

    if CONFIG['multicore'] > 1:
        joblib.Parallel(n_jobs=CONFIG['multicore'], verbose=5)(
            joblib.delayed(binarizer)(npz_path, src, dst)
            for npz_path in findall_endswith('.npz', src))
    else:
        for npz_path in findall_endswith('.npz', src):
            binarizer(npz_path, src, dst)

    print("Dataset successfully binarized.") 
开发者ID:salu133445,项目名称:lakh-pianoroll-dataset,代码行数:16,代码来源:binarizer.py

示例12: main

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def main():
    """Main function."""
    src, dst = parse_args()
    make_sure_path_exists(dst)

    if CONFIG['multicore'] > 1:
        joblib.Parallel(n_jobs=CONFIG['multicore'], verbose=5)(
            joblib.delayed(merger)(npz_path, src, dst)
            for npz_path in findall_endswith('.npz', src))
    else:
        for npz_path in findall_endswith('.npz', src):
            merger(npz_path, src, dst) 
开发者ID:salu133445,项目名称:lakh-pianoroll-dataset,代码行数:14,代码来源:merger_5.py

示例13: midi_filter

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def midi_filter(midi_info):
    """Return True for qualified MIDI files and False for unwanted ones."""
    if midi_info['first_beat_time'] > 0.0:
        return False
    if midi_info['constant_time_signature'] not in CONFIG['time_signatures']:
        return False
    return True 
开发者ID:salu133445,项目名称:lakh-pianoroll-dataset,代码行数:9,代码来源:cleanser.py

示例14: validate

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def validate():
    if request.args.get('hub.mode', '') == 'subscribe' and \
                    request.args.get('hub.verify_token', '') == CONFIG['VERIFY_TOKEN']:

        print("Validating webhook")

        return request.args.get('hub.challenge', '')
    else:
        return 'Failed validation. Make sure the validation tokens match.' 
开发者ID:team-anything,项目名称:Briefly,代码行数:11,代码来源:server.py

示例15: send_image

# 需要导入模块: import config [as 别名]
# 或者: from config import CONFIG [as 别名]
def send_image(recipient):
    page.send(recipient, Attachment.Image(CONFIG['SERVER_URL'] + "/assets/rift.png")) 
开发者ID:team-anything,项目名称:Briefly,代码行数:4,代码来源:messenger.py


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