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

Python compare.version_int函数代码示例

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

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



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

示例1: test_version_int

def test_version_int():
    """Tests that version_int. Corrects our versions."""
    eq_(version_int('3.5.0a1pre2'), 3050000001002)
    eq_(version_int(''), 200100)
    eq_(version_int(sys.maxint), sys.maxint)
    eq_(version_int(sys.maxint + 1), sys.maxint)
    eq_(version_int('9999999'), sys.maxint)
开发者ID:kaiquewdev,项目名称:zamboni,代码行数:7,代码来源:tests.py


示例2: find_jetpacks

def find_jetpacks(jp_version):
    """
    Find all jetpack files that aren't disabled.

    Files that should be upgraded will have needs_upgrade=True.
    """
    statuses = amo.VALID_STATUSES
    files = (File.objects.filter(jetpack_version__isnull=False,
                                 version__addon__status__in=statuses,
                                 version__addon__disabled_by_user=False)
             .exclude(status=amo.STATUS_DISABLED).no_cache()
             .select_related('version'))
    files = sorted(files, key=lambda f: (f.version.addon_id, f.version.id))

    # Figure out which files need to be upgraded.
    for file_ in files:
        file_.needs_upgrade = False
    # If any files for this add-on are reviewed, take the last reviewed file
    # plus all newer files.  Otherwise, only upgrade the latest file.
    for _, fs in groupby(files, key=lambda f: f.version.addon_id):
        fs = list(fs)
        if any(f.status in amo.REVIEWED_STATUSES for f in fs):
            for file_ in reversed(fs):
                file_.needs_upgrade = True
                if file_.status in amo.REVIEWED_STATUSES:
                    break
        else:
            fs[-1].needs_upgrade = True
    # Make sure only old files are marked.
    for file_ in [f for f in files if f.needs_upgrade]:
        if version_int(file_.jetpack_version) >= version_int(jp_version):
            file_.needs_upgrade = False
    return files
开发者ID:ricardodani,项目名称:zamboni,代码行数:33,代码来源:utils.py


示例3: test_version_int

def test_version_int():
    """Tests that version_int. Corrects our versions."""
    eq_(version_int('3.5.0a1pre2'), 3050000001002)
    eq_(version_int(''), 200100)
    eq_(version_int(MAXVERSION), MAXVERSION)
    eq_(version_int(MAXVERSION + 1), MAXVERSION)
    eq_(version_int('9999999'), MAXVERSION)
开发者ID:bebef1987,项目名称:zamboni,代码行数:7,代码来源:tests.py


示例4: __init__

 def __init__(self, request, platform, version):
     self.request = request
     self.platform = platform
     self.version = version
     self.compat_mode = 'strict'
     if version_int(self.version) >= version_int('10.0'):
         self.compat_mode = 'ignore'
开发者ID:abev66,项目名称:zamboni,代码行数:7,代码来源:modules.py


示例5: test_bump_version_in_model

 def test_bump_version_in_model(self, mock_sign_file):
     # We want to make sure each file has been signed.
     self.file2 = amo.tests.file_factory(version=self.version)
     self.file2.update(filename='jetpack-b.xpi')
     backup_file2_path = u'{0}.backup_signature'.format(
         self.file2.file_path)
     try:
         with amo.tests.copy_file('apps/files/fixtures/files/jetpack.xpi',
                                  self.file_.file_path):
             with amo.tests.copy_file(
                     'apps/files/fixtures/files/jetpack.xpi',
                     self.file2.file_path):
                 file_hash = self.file_.generate_hash()
                 file2_hash = self.file2.generate_hash()
                 assert self.version.version == '1.3'
                 assert self.version.version_int == version_int('1.3')
                 tasks.sign_addons([self.addon.pk])
                 assert mock_sign_file.call_count == 2
                 self.version.reload()
                 assert self.version.version == '1.3.1-signed'
                 assert self.version.version_int == version_int(
                     '1.3.1-signed')
                 assert file_hash != self.file_.generate_hash()
                 assert file2_hash != self.file2.generate_hash()
                 self.assert_backup()
                 assert os.path.exists(backup_file2_path)
     finally:
         if os.path.exists(backup_file2_path):
             os.unlink(backup_file2_path)
开发者ID:kmaglione,项目名称:olympia,代码行数:29,代码来源:tests.py


示例6: incompatible_latest_apps

    def incompatible_latest_apps(self):
        """Returns a list of applications with which this add-on is
        incompatible (based on the latest version).

        """
        return [a for a, v in self.compatible_apps.items() if v and
                version_int(v.max.version) < version_int(a.latest_version)]
开发者ID:jsocol,项目名称:zamboni,代码行数:7,代码来源:models.py


示例7: __init__

 def __init__(self, request, platform, version):
     self.request = request
     self.platform = platform
     self.version = version
     self.compat_mode = 'strict'
     if (waffle.switch_is_active('d2c-at-the-disco') and
         version_int(self.version) >= version_int('10.0')):
         self.compat_mode = 'ignore'
开发者ID:atsay,项目名称:zamboni,代码行数:8,代码来源:modules.py


示例8: get_compat_mode

def get_compat_mode(version):
    # Returns appropriate compat mode based on app version.
    # Replace when we are ready to deal with bug 711698.
    vint = version_int(version)
    if waffle.switch_is_active("d2c-at-the-disco"):
        return "ignore" if vint >= version_int("10.0") else "strict"
    else:
        return "strict"
开发者ID:potch,项目名称:zamboni,代码行数:8,代码来源:views.py


示例9: check_jetpack_version

def check_jetpack_version(sender, **kw):
    import files.tasks
    from zadmin.models import get_config

    jetpack_version = get_config('jetpack_version')
    qs = File.objects.filter(version__addon=sender,
                             jetpack_version__isnull=False)
    ids = [f.id for f in qs
           if version_int(f.jetpack_version) < version_int(jetpack_version)]
    if ids:
        files.tasks.start_upgrade.delay(jetpack_version, ids, priority='high')
开发者ID:ricardodani,项目名称:zamboni,代码行数:11,代码来源:models.py


示例10: test_dont_sign_dont_bump_version_bad_zipfile

 def test_dont_sign_dont_bump_version_bad_zipfile(self, mock_sign_file):
     with amo.tests.copy_file(__file__, self.file_.file_path):
         file_hash = self.file_.generate_hash()
         assert self.version.version == '1.3'
         assert self.version.version_int == version_int('1.3')
         tasks.sign_addons([self.addon.pk])
         assert not mock_sign_file.called
         self.version.reload()
         assert self.version.version == '1.3'
         assert self.version.version_int == version_int('1.3')
         assert file_hash == self.file_.generate_hash()
         self.assert_no_backup()
开发者ID:kmaglione,项目名称:olympia,代码行数:12,代码来源:tests.py


示例11: _filter_search

def _filter_search(request,
                   qs,
                   query,
                   filters,
                   sorting,
                   sorting_default='-weekly_downloads',
                   types=[]):
    """Filter an ES queryset based on a list of filters."""
    APP = request.APP
    # Intersection of the form fields present and the filters we want to apply.
    show = [f for f in filters if query.get(f)]

    if query.get('q'):
        qs = qs.query(or_=name_query(query['q']))
    if 'platform' in show and query['platform'] in amo.PLATFORM_DICT:
        ps = (amo.PLATFORM_DICT[query['platform']].id, amo.PLATFORM_ALL.id)
        # If we've selected "All Systems" don't filter by platform.
        if ps[0] != ps[1]:
            qs = qs.filter(platform__in=ps)
    if 'appver' in show:
        # Get a min version less than X.0.
        low = version_int(query['appver'])
        # Get a max version greater than X.0a.
        high = version_int(query['appver'] + 'a')
        # If we're not using D2C then fall back to appversion checking.
        extensions_shown = (not query.get('atype')
                            or query['atype'] == amo.ADDON_EXTENSION)
        if not extensions_shown or low < version_int('10.0'):
            qs = qs.filter(
                **{
                    'appversion.%s.max__gte' % APP.id: high,
                    'appversion.%s.min__lte' % APP.id: low
                })
    if 'atype' in show and query['atype'] in amo.ADDON_TYPES:
        qs = qs.filter(type=query['atype'])
    else:
        qs = qs.filter(type__in=types)
    if 'cat' in show:
        cat = (Category.objects.filter(id=query['cat']).filter(
            Q(application=APP.id) | Q(type=amo.ADDON_SEARCH)))
        if not cat.exists():
            show.remove('cat')
        if 'cat' in show:
            qs = qs.filter(category=query['cat'])
    if 'tag' in show:
        qs = qs.filter(tag=query['tag'])
    if 'sort' in show:
        qs = qs.order_by(sorting[query['sort']])
    elif not query.get('q'):
        # Sort by a default if there was no query so results are predictable.
        qs = qs.order_by(sorting_default)

    return qs
开发者ID:jvillalobos,项目名称:olympia,代码行数:53,代码来源:views.py


示例12: test_dont_sign_dont_bump_sign_error

 def test_dont_sign_dont_bump_sign_error(self, mock_sign_file):
     mock_sign_file.side_effect = IOError()
     with amo.tests.copy_file("apps/files/fixtures/files/jetpack.xpi", self.file_.file_path):
         file_hash = self.file_.generate_hash()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         tasks.sign_addons([self.addon.pk])
         assert mock_sign_file.called
         self.version.reload()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         assert file_hash == self.file_.generate_hash()
         self.assert_no_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:13,代码来源:tests.py


示例13: test_resign_bump_version_in_model_if_force

 def test_resign_bump_version_in_model_if_force(self, mock_sign_file):
     with amo.tests.copy_file("apps/files/fixtures/files/new-addon-signature.xpi", self.file_.file_path):
         self.file_.update(is_signed=True)
         file_hash = self.file_.generate_hash()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         tasks.sign_addons([self.addon.pk], force=True)
         assert mock_sign_file.called
         self.version.reload()
         assert self.version.version == "1.3.1-signed"
         assert self.version.version_int == version_int("1.3.1-signed")
         assert file_hash != self.file_.generate_hash()
         self.assert_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:13,代码来源:tests.py


示例14: test_dont_bump_not_signed

 def test_dont_bump_not_signed(self, mock_sign_file):
     mock_sign_file.return_value = None  # Pretend we didn't sign.
     with amo.tests.copy_file("apps/files/fixtures/files/jetpack.xpi", self.file_.file_path):
         file_hash = self.file_.generate_hash()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         tasks.sign_addons([self.addon.pk])
         assert mock_sign_file.called
         self.version.reload()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         assert file_hash == self.file_.generate_hash()
         self.assert_no_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:13,代码来源:tests.py


示例15: test_sign_bump_old_versions_default_compat

 def test_sign_bump_old_versions_default_compat(self, mock_sign_file):
     """Sign files which are old, but default to compatible."""
     with amo.tests.copy_file("apps/files/fixtures/files/jetpack.xpi", self.file_.file_path):
         file_hash = self.file_.generate_hash()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         self.set_max_appversion(settings.MIN_D2C_VERSION)
         tasks.sign_addons([self.addon.pk])
         assert mock_sign_file.called
         self.version.reload()
         assert self.version.version == "1.3.1-signed"
         assert self.version.version_int == version_int("1.3.1-signed")
         assert file_hash != self.file_.generate_hash()
         self.assert_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:14,代码来源:tests.py


示例16: test_sign_bump_non_ascii_version

 def test_sign_bump_non_ascii_version(self, mock_sign_file):
     """Sign versions which have non-ascii version numbers."""
     self.version.update(version=u"é1.3")
     with amo.tests.copy_file("apps/files/fixtures/files/jetpack.xpi", self.file_.file_path):
         file_hash = self.file_.generate_hash()
         assert self.version.version == u"é1.3"
         assert self.version.version_int == version_int("1.3")
         tasks.sign_addons([self.addon.pk])
         assert mock_sign_file.called
         self.version.reload()
         assert self.version.version == u"é1.3.1-signed"
         assert self.version.version_int == version_int(u"é1.3.1-signed")
         assert file_hash != self.file_.generate_hash()
         self.assert_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:14,代码来源:tests.py


示例17: test_sign_bump_new_versions_not_default_compat

 def test_sign_bump_new_versions_not_default_compat(self, mock_sign_file):
     """Sign files which are recent, event if not default to compatible."""
     with amo.tests.copy_file("apps/files/fixtures/files/jetpack.xpi", self.file_.file_path):
         file_hash = self.file_.generate_hash()
         assert self.version.version == "1.3"
         assert self.version.version_int == version_int("1.3")
         self.file_.update(binary_components=True, strict_compatibility=True)
         tasks.sign_addons([self.addon.pk])
         assert mock_sign_file.called
         self.version.reload()
         assert self.version.version == "1.3.1-signed"
         assert self.version.version_int == version_int("1.3.1-signed")
         assert file_hash != self.file_.generate_hash()
         self.assert_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:14,代码来源:tests.py


示例18: test_dont_resign_dont_bump_version_in_model

 def test_dont_resign_dont_bump_version_in_model(self, mock_sign_file):
     with amo.tests.copy_file(
             'apps/files/fixtures/files/new-addon-signature.xpi',
             self.file_.file_path):
         self.file_.update(is_signed=True)
         file_hash = self.file_.generate_hash()
         assert self.version.version == '1.3'
         assert self.version.version_int == version_int('1.3')
         tasks.sign_addons([self.addon.pk])
         assert not mock_sign_file.called
         self.version.reload()
         assert self.version.version == '1.3'
         assert self.version.version_int == version_int('1.3')
         assert file_hash == self.file_.generate_hash()
         self.assert_no_backup()
开发者ID:kmaglione,项目名称:olympia,代码行数:15,代码来源:tests.py


示例19: test_no_bump_unreviewed

 def test_no_bump_unreviewed(self, mock_sign_file):
     """Don't bump nor sign unreviewed files."""
     for status in amo.UNREVIEWED_STATUSES + (amo.STATUS_BETA,):
         self.file_.update(status=amo.STATUS_UNREVIEWED)
         with amo.tests.copy_file("apps/files/fixtures/files/jetpack.xpi", self.file_.file_path):
             file_hash = self.file_.generate_hash()
             assert self.version.version == "1.3"
             assert self.version.version_int == version_int("1.3")
             tasks.sign_addons([self.addon.pk])
             assert not mock_sign_file.called
             self.version.reload()
             assert self.version.version == "1.3"
             assert self.version.version_int == version_int("1.3")
             assert file_hash == self.file_.generate_hash()
             self.assert_no_backup()
开发者ID:Nolski,项目名称:olympia,代码行数:15,代码来源:tests.py


示例20: make_langpack

def make_langpack(version):
    versions = (version, '%s.*' % version)

    for version in versions:
        AppVersion.objects.get_or_create(application=amo.FIREFOX.id,
                                         version=version,
                                         version_int=version_int(version))

    return make_xpi({
        'install.rdf': """<?xml version="1.0"?>

            <RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
                 xmlns:em="http://www.mozilla.org/2004/em-rdf#">
              <Description about="urn:mozilla:install-manifest"
                           em:id="[email protected]"
                           em:name="Foo Language Pack"
                           em:version="{0}"
                           em:type="8"
                           em:creator="mozilla.org">

                <em:targetApplication>
                  <Description>
                    <em:id>{{ec8030f7-c20a-464f-9b0e-13a3a9e97384}}</em:id>
                    <em:minVersion>{0}</em:minVersion>
                    <em:maxVersion>{1}</em:maxVersion>
                  </Description>
                </em:targetApplication>
              </Description>
            </RDF>
        """.format(*versions)
    }).read()
开发者ID:ddurst,项目名称:olympia,代码行数:31,代码来源:test_tasks.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python compare.vint函数代码示例发布时间:2022-05-26
下一篇:
Python compare.version_dict函数代码示例发布时间: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