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

Python compare.version_dict函数代码示例

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

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



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

示例1: version_sidebar

def version_sidebar(request, form_data, facets):
    appver = ""
    # If appver is in the request, we read it cleaned via form_data.
    if "appver" in request.GET or form_data.get("appver"):
        appver = form_data.get("appver")

    app = unicode(request.APP.pretty)
    exclude_versions = getattr(request.APP, "exclude_versions", [])
    # L10n: {0} is an application, such as Firefox. This means "any version of
    # Firefox."
    rv = [FacetLink(_(u"Any {0}").format(app), dict(appver="any"), not appver)]
    vs = [dict_from_int(f["term"]) for f in facets["appversions"]]

    # Insert the filtered app version even if it's not a facet.
    av_dict = version_dict(appver)

    if av_dict and av_dict not in vs and av_dict["major"]:
        vs.append(av_dict)

    # Valid versions must be in the form of `major.minor`.
    vs = set((v["major"], v["minor1"] if v["minor1"] not in (None, 99) else 0) for v in vs)
    versions = ["%s.%s" % v for v in sorted(vs, reverse=True)]

    for version, floated in zip(versions, map(float, versions)):
        if floated not in exclude_versions and floated > request.APP.min_display_version:
            rv.append(FacetLink("%s %s" % (app, version), dict(appver=version), appver == version))
    return rv
开发者ID:vinu76jsr,项目名称:zamboni,代码行数:27,代码来源:views.py


示例2: version_sidebar

def version_sidebar(request, form_data, facets):
    appver = ''
    # If appver is in the request, we read it cleaned via form_data.
    if 'appver' in request.GET or form_data.get('appver'):
        appver = form_data.get('appver')

    app = unicode(request.APP.pretty)
    exclude_versions = getattr(request.APP, 'exclude_versions', [])
    # L10n: {0} is an application, such as Firefox. This means "any version of
    # Firefox."
    rv = [FacetLink(_(u'Any {0}').format(app), dict(appver='any'), not appver)]
    vs = [dict_from_int(f['term']) for f in facets['appversions']]

    # Insert the filtered app version even if it's not a facet.
    av_dict = version_dict(appver)

    if av_dict and av_dict not in vs and av_dict['major']:
        vs.append(av_dict)

    # Valid versions must be in the form of `major.minor`.
    vs = set((v['major'], v['minor1'] if v['minor1'] not in (None, 99) else 0)
             for v in vs)
    versions = ['%s.%s' % v for v in sorted(vs, reverse=True)]

    for version, floated in zip(versions, map(float, versions)):
        if (floated not in exclude_versions
                and floated > request.APP.min_display_version):
            rv.append(FacetLink('%s %s' % (app, version), dict(appver=version),
                                appver == version))
    return rv
开发者ID:jvillalobos,项目名称:olympia,代码行数:30,代码来源:views.py


示例3: test_version_dict

def test_version_dict():
    eq_(version_dict('5.0'),
        {'major': 5,
         'minor1': 0,
         'minor2': None,
         'minor3': None,
         'alpha': None,
         'alpha_ver': None,
         'pre': None,
         'pre_ver': None})
开发者ID:Sancus,项目名称:zamboni,代码行数:10,代码来源:tests.py


示例4: test_version_dict

def test_version_dict():
    eq_(
        version_dict("5.0"),
        {
            "major": 5,
            "minor1": 0,
            "minor2": None,
            "minor3": None,
            "alpha": None,
            "alpha_ver": None,
            "pre": None,
            "pre_ver": None,
        },
    )
开发者ID:mnoorenberghe,项目名称:zamboni,代码行数:14,代码来源:tests.py


示例5: version_sidebar

def version_sidebar(request, query, facets):
    appver = query.get('appver')
    app = unicode(request.APP.pretty)
    exclude_versions = getattr(request.APP, 'exclude_versions', [])
    # L10n: {0} is an application, such as Firefox. This means "any version of
    # Firefox."
    rv = [FacetLink(_(u'Any {0}').format(app), dict(appver=''), not appver)]
    vs = [dict_from_int(f['term']) for f in facets['appversions']]

    # Insert the filtered app version even if it's not a facet.
    av_dict = version_dict(appver)
    if av_dict and av_dict not in vs and av_dict['major']:
        vs.append(av_dict)

    vs = set((v['major'], v['minor1'] if v['minor1'] != 99 else 0) for v in vs)
    versions = ['%s.%s' % v for v in sorted(vs, reverse=True)]

    for version, floated in zip(versions, map(float, versions)):
        if (floated not in exclude_versions
            and floated > request.APP.min_display_version):
            rv.append(FacetLink('%s %s' % (app, version), dict(appver=version),
                                appver == version))
    return rv
开发者ID:LucianU,项目名称:zamboni,代码行数:23,代码来源:views.py


示例6: __init__

 def __init__(self, *args, **kwargs):
     super(AppVersion, self).__init__(*args, **kwargs)
     # Add all the major, minor, ..., version attributes to the object.
     self.__dict__.update(compare.version_dict(self.version or ''))
开发者ID:bebef1987,项目名称:zamboni,代码行数:4,代码来源:models.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python compare.version_int函数代码示例发布时间:2022-05-26
下一篇:
Python compare.dict_from_int函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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