當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。