• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python vault.extend_record函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: open_reviews

def open_reviews(module):
    memory_storage_inst = vault.get_memory_storage()
    time_now = int(time.time())

    module_id_index = vault.get_vault()['module_id_index']
    module = module.lower()
    if module not in module_id_index:
        flask.abort(404)

    modules = module_id_index[module]['modules']

    review_ids = (memory_storage_inst.get_record_ids_by_modules(modules) &
                  memory_storage_inst.get_record_ids_by_types(['review']))

    waiting_on_reviewer = []
    total_open = 0

    for review in memory_storage_inst.get_records(review_ids):
        if review.status == 'NEW':
            total_open += 1
            if review.value in [1, 2]:
                waiting_on_reviewer.append(vault.extend_record(review))

    return {
        'module': module,
        'total_open': total_open,
        'waiting_on_reviewer': len(waiting_on_reviewer),
        'waiting_on_submitter': total_open - len(waiting_on_reviewer),
        'latest_revision': _process_stat(
            waiting_on_reviewer, 'updated_on', time_now),
        'first_revision': _process_stat(waiting_on_reviewer, 'date', time_now),
    }
开发者ID:germylure,项目名称:stackalytics,代码行数:32,代码来源:reports.py


示例2: get_commit_report

def get_commit_report(records, **kwargs):
    loc_threshold = int(flask.request.args.get('loc_threshold') or 1000)
    response = []
    for record in records:
        if record.record_type == 'commit' and record.loc > loc_threshold:
            ext_record = vault.extend_record(record)
            nr = dict([(k, ext_record[k])
                       for k in ['loc', 'subject', 'module', 'primary_key',
                                 'change_id']
                       if k in ext_record])
            response.append(nr)
    return response
开发者ID:Youngcoder,项目名称:stackalytics,代码行数:12,代码来源:reports.py


示例3: get_members

def get_members(records, **kwargs):
    response = []
    for record in records:
        record = vault.extend_record(record)
        nr = dict([(k, record[k]) for k in
                   ['author_name', 'date', 'company_name', 'member_uri']])
        nr['date_str'] = helpers.format_date(nr['date'])
        response.append(nr)

    response.sort(key=lambda x: x['date'], reverse=True)
    utils.add_index(response)

    return response
开发者ID:dlundquist,项目名称:stackalytics,代码行数:13,代码来源:web.py


示例4: extend_record

def extend_record(record):
    record = vault.extend_record(record)
    _extend_record_common_fields(record)

    if record['record_type'] == 'commit':
        record['branches'] = ','.join(record['branches'])
        if 'correction_comment' not in record:
            record['correction_comment'] = ''
        record['message'] = make_commit_message(record)
        if record['commit_date']:
            record['commit_date_str'] = format_datetime(record['commit_date'])
    elif record['record_type'] == 'mark':
        review = vault.get_memory_storage().get_record_by_primary_key(
            record['review_id'])
        patch = vault.get_memory_storage().get_record_by_primary_key(
            utils.get_patch_id(record['review_id'], record['patch']))
        if not review or not patch:
            return None

        _extend_by_parent_info(record, review, 'parent_')
        _extend_by_parent_info(record, patch, 'patch_')
    elif record['record_type'] == 'patch':
        review = vault.get_memory_storage().get_record_by_primary_key(
            record['review_id'])
        _extend_by_parent_info(record, review, 'parent_')
    elif record['record_type'] == 'email':
        record['email_link'] = record.get('email_link') or ''
        record['blueprint_links'] = []
        for bp_id in record.get('blueprint_id', []):
            bp_module, bp_name = bp_id.split(':')
            record['blueprint_links'].append(
                make_blueprint_link(bp_module, bp_name))
    elif record['record_type'] in ['bpd', 'bpc']:
        record['summary'] = utils.format_text(record['summary'])
        if record.get('mention_count'):
            record['mention_date_str'] = format_datetime(
                record['mention_date'])
        record['blueprint_link'] = make_blueprint_link(record['module'],
                                                       record['name'])
    elif record['record_type'] in ['bugr', 'bugf']:
        record['number'] = record['web_link'].split('/')[-1]
        record['title'] = filter_bug_title(record['title'])
        record['status_class'] = re.sub('\s+', '', record['status'])

    elif record['record_type'] == 'tr':
        record['date_str'] = format_date(record['date'])  # no need for hours

    return record
开发者ID:Mirantis,项目名称:stackalytics,代码行数:48,代码来源:helpers.py


示例5: get_activity

def get_activity(records, start_record, page_size, query_message=None):
    if query_message:
        records = [vault.extend_record(r) for r in records]
        records = [r for r in records
                   if (r.get('message') and
                       r.get('message').find(query_message) > 0)]
    records_sorted = sorted(records, key=lambda x: x['date'], reverse=True)

    result = []
    for record in records_sorted[start_record:]:
        processed_record = extend_record(record)
        if processed_record:
            result.append(processed_record)
            if len(result) == page_size:
                break

    return result
开发者ID:dlundquist,项目名称:stackalytics,代码行数:17,代码来源:helpers.py


示例6: get_activity

def get_activity(records, start_record, page_size, query_message=None):
    if query_message:
        # note that all records are now dicts!
        key_func = operator.itemgetter('date')
        records = [vault.extend_record(r) for r in records]
        records = [r for r in records
                   if (r.get('message') and
                       r.get('message').find(query_message) > 0)]
    else:
        key_func = operator.attrgetter('date')

    records_sorted = sorted(records, key=key_func, reverse=True)

    result = []
    for record in records_sorted[start_record:]:
        processed_record = extend_record(record)
        if processed_record:
            result.append(processed_record)
            if len(result) == page_size:
                break

    return result
开发者ID:Mirantis,项目名称:stackalytics,代码行数:22,代码来源:helpers.py


示例7: extend_record

def extend_record(record):
    record = vault.extend_record(record)
    _extend_record_common_fields(record)

    if record['record_type'] == 'commit':
        record['branches'] = ','.join(record['branches'])
        if 'correction_comment' not in record:
            record['correction_comment'] = ''
        record['message'] = make_commit_message(record)
        if record['commit_date']:
            record['commit_date_str'] = format_datetime(record['commit_date'])
    elif record['record_type'] == 'mark':
        parent = vault.get_memory_storage().get_record_by_primary_key(
            record['review_id'])
        if not parent:
            return None

        _extend_by_parent_info(record, parent)
    elif record['record_type'] == 'patch':
        parent = vault.get_memory_storage().get_record_by_primary_key(
            record['review_id'])
        _extend_by_parent_info(record, parent)
    elif record['record_type'] == 'email':
        record['email_link'] = record.get('email_link') or ''
        record['blueprint_links'] = []
        for bp_id in record.get('blueprint_id', []):
            bp_module, bp_name = bp_id.split(':')
            record['blueprint_links'].append(
                make_blueprint_link(bp_module, bp_name))
    elif record['record_type'] in ['bpd', 'bpc']:
        record['summary'] = utils.format_text(record['summary'])
        if record.get('mention_count'):
            record['mention_date_str'] = format_datetime(
                record['mention_date'])
        record['blueprint_link'] = make_blueprint_link(record['module'],
                                                       record['name'])

    return record
开发者ID:Acidburn0zzz,项目名称:stackalytics,代码行数:38,代码来源:helpers.py


示例8: get_bpd

def get_bpd(records, **kwargs):
    result = []
    for record in records:
        if record['record_type'] in ['bpd', 'bpc']:
            record = vault.extend_record(record)
            mention_date = record.get('mention_date')
            if mention_date:
                date = helpers.format_date(mention_date)
            else:
                date = 'never'
            result.append({
                'date': date,
                'status': record['lifecycle_status'],
                'metric': record.get('mention_count') or 0,
                'id': record['name'],
                'name': record['name'],
                'link': helpers.make_blueprint_link(record['module'],
                                                    record['name'])
            })

    result.sort(key=lambda x: x['metric'], reverse=True)
    utils.add_index(result)

    return result
开发者ID:dlundquist,项目名称:stackalytics,代码行数:24,代码来源:web.py


示例9: _extend_by_parent_info

def _extend_by_parent_info(record, parent, prefix='parent_'):
    parent = vault.extend_record(parent)
    _extend_record_common_fields(parent)
    for k, v in six.iteritems(parent):
        record[prefix + k] = v
开发者ID:Mirantis,项目名称:stackalytics,代码行数:5,代码来源:helpers.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vault.get_memory_storage函数代码示例发布时间:2022-05-27
下一篇:
Python parameters.get_parameter函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap