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

Python versions.Version类代码示例

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

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



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

示例1: test_goodSVNEntries_4

 def test_goodSVNEntries_4(self):
     """
     Version should be able to parse an SVN format 4 entries file.
     """
     version = Version("dummy", 1, 0, 0)
     self.assertEqual(
         version._parseSVNEntries_4(BytesIO(VERSION_4_ENTRIES)), b'18211')
开发者ID:0004c,项目名称:VTK,代码行数:7,代码来源:test_versions.py


示例2: test_goodSVNEntriesTenPlus

 def test_goodSVNEntriesTenPlus(self):
     """
     Version should be able to parse an SVN format 10 entries file.
     """
     version = Version("dummy", 1, 0, 0)
     self.assertEqual(
         version._parseSVNEntriesTenPlus(BytesIO(VERSION_10_ENTRIES)), b'22715')
开发者ID:0004c,项目名称:VTK,代码行数:7,代码来源:test_versions.py


示例3: test_goodSVNEntries_9

 def test_goodSVNEntries_9(self):
     """
     Version should be able to parse an SVN format 9 entries file.
     """
     version = Version("dummy", 1, 0, 0)
     self.assertEqual(
         version._parseSVNEntries_9(StringIO(VERSION_9_ENTRIES)), '22715')
开发者ID:AnthonyNystrom,项目名称:YoGoMee,代码行数:7,代码来源:test_versions.py


示例4: test_parseBrokenSVNEntries

 def test_parseBrokenSVNEntries(self):
     """
     If there is a broken SVN entries file, it should return an SVN
     revision of "Unknown".
     """
     version = Version("dummy", 1, 0, 0)
     self.assertEquals(version._parseSVNEntries(StringIO('I like puppies')), 
                       "Unknown")
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:8,代码来源:test_versions.py


示例5: test_notImplementedComparisons

 def test_notImplementedComparisons(self):
     """
     Comparing a L{Version} to some other object type results in
     C{NotImplemented}.
     """
     va = Version("dummy", 1, 0, 0)
     vb = ("dummy", 1, 0, 0) # a tuple is not a Version object
     self.assertEqual(va.__cmp__(vb), NotImplemented)
开发者ID:0004c,项目名称:VTK,代码行数:8,代码来源:test_versions.py


示例6: todo_relative_redirect

def todo_relative_redirect(test_method):
    expected_version = Version('twisted', 13, 1, 0)
    if current_version < expected_version:
        test_method.todo = (
            "Relative Redirects are not supported in Twisted versions "
            "prior to: {0}").format(expected_version.short())

    return test_method
开发者ID:ImmobilienScout24,项目名称:treq,代码行数:8,代码来源:test_treq_integration.py


示例7: getVersion

    def getVersion(self):
        versions = []
        pattern = 'twisted-%s-md5sums.txt'
        for md5sums in self.RELEASES.globChildren(pattern % '*'):
            try:
                components = map(int, md5sums.basename().split('-')[1].split('.'))
            except ValueError:
                pass
            else:
                versions.append(components)
        try:
            version = Version('Twisted', *max(versions))
        except ValueError:
            self.log.error(
                "Could not parse a version from files in the RELEASES directory %s" % (
                self.RELEASES.path,))
            raise TracError("Error loading Twisted version information")

        md5sums_file = self.RELEASES.child(pattern % version.base())
        return version, md5sums_file
开发者ID:jonathanj,项目名称:twisted-trac-plugins,代码行数:20,代码来源:release_macro.py


示例8: test_goodSVNEntries

    def test_goodSVNEntries(self):
        """
        Version should be able to parse an SVN entries file.
        """
        version = Version("dummy", 1, 0, 0)
        crap = '''<?xml version="1.0" encoding="utf-8"?>
<wc-entries
   xmlns="svn:">
<entry
   committed-rev="18210"
   name=""
   committed-date="2006-09-21T04:43:09.542953Z"
   url="svn+ssh://svn.twistedmatrix.com/svn/Twisted/trunk/twisted"
   last-author="exarkun"
   kind="dir"
   uuid="bbbe8e31-12d6-0310-92fd-ac37d47ddeeb"
   repos="svn+ssh://svn.twistedmatrix.com/svn/Twisted"
   revision="18211"/>
</wc-entries>
'''
        self.assertEquals(version._parseSVNEntries(StringIO(crap)), '18211')
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:21,代码来源:test_versions.py


示例9: __init__

 def __init__(self, *args, **kwargs):
     self.version = Version(*args, **kwargs)
     self.app = IDroneModelApp(self.version)
开发者ID:mleinart,项目名称:droned,代码行数:3,代码来源:app.py


示例10: AppVersion

class AppVersion(Entity):
    """Track application versions"""
    implements(IDroneModelAppVersion)
    description = property( lambda self: "%s %s" % \
            (self.app.name, self.version_string) )
    serializable = True

    def __getattribute__(self, name):
        """Overrode to fulfill Interface Obligations"""
        if name in ('package','major','minor','micro','prerelease','base',\
                'short'):
            return self.version.__getattribute__(name)
        return object.__getattribute__(self, name)

    def __init__(self, *args, **kwargs):
        self.version = Version(*args, **kwargs)
        self.app = IDroneModelApp(self.version)

    @property
    def version_string(self):
        """makes a nice version string that we can use for reconstruction"""
        result = '.'.join([
            str(self.major),
            str(self.minor),
            str(self.micro),
        ])
        if self.prerelease:
            result += '.%s' % str(self.prerelease)
        return result

    def __getstate__(self):
        return {
            'app' : self.package,
            'version' : self.version_string, #for proper serialization
        }

    def __cmp__(self, other):
        """overrode for easy comparison of AppVersion to AppVersion and Version
           to AppVersion.

           @raise IncomparableVersions:  when the package names of the versions
               differ.
           @param other L{twisted.python.versions.Version}, 
               L{IDroneModelAppVersion}, or object
           @return C{int} of value -1, 0, or 1
        """
        try:
            if IDroneModelAppVersion.providedBy(other):
                return self.version.__cmp__(other.version)
        except IncomparableVersions: raise
        except: pass
        if isinstance(other, Version):
            return self.version.__cmp__(other)
        return object.__cmp__(self, other)

    @staticmethod
    def makeAppVersion(name, version):
        """Similar to ``makeArgs``

           @return L{IDroneModelAppVersion} provider
        """
        args, kwargs = AppVersion.makeArgs(name, version)
        return AppVersion(*args, **kwargs)

    @staticmethod
    def makeVersion(name, version):
        """Similar to ``makeArgs``

           @return L{twisted.python.versions.Version}
        """
        args, kwargs = AppVersion.makeArgs(name, version)
        return Version(*args, **kwargs)

    @staticmethod
    def versionExists(name, version):
        """check if this L{IDroneModelAppVersion} provider exists"""
        args, kwargs = AppVersion.makeArgs(name, version)
        return AppVersion.exists(*args, **kwargs)

    @staticmethod
    def makeArgs(name, version):
        """goes through great lengths to make args for use
           by a constructor for class types -
               L{IDroneModelAppVersion} providers or 
               L{twisted.python.versions.Version}.

           @raises TypeError - if version is not convertable

           @param name C{str}
           @param version C{str}, C{list}, C{tuple}, or 
               L{twisted.python.versions.Version}

           @return ((name, major, minor, micro), {'prerelease': prerelease})
        """
        default = [0,0,0,0] #last number denotes pre-release
        if isinstance(version, Version):
            if version.package == name:
                return (
                    (name, version.major, version.minor, version.micro),
                    {'prerelease': version.prerelease}
#.........这里部分代码省略.........
开发者ID:mleinart,项目名称:droned,代码行数:101,代码来源:app.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python _twistd_unix.UnixAppLogger类代码示例发布时间:2022-05-27
下一篇:
Python versions.getVersionString函数代码示例发布时间: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