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

Python versions.getVersionString函数代码示例

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

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



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

示例1: test_failsWithIncorrectDeprecation

 def test_failsWithIncorrectDeprecation(self):
     """
     callDeprecated raises a test failure if the callable was deprecated
     at a different version to the one expected.
     """
     differentVersion = Version("Foo", 1, 2, 3)
     exception = self.assertRaises(self.failureException, self.callDeprecated, differentVersion, oldMethod, "foo")
     self.assertIn(getVersionString(self.version), str(exception))
     self.assertIn(getVersionString(differentVersion), str(exception))
开发者ID:alfonsjose,项目名称:international-orders-app,代码行数:9,代码来源:test_assertions.py


示例2: test_getVersionStringWithPrerelease

 def test_getVersionStringWithPrerelease(self):
     """
     L{getVersionString} includes the prerelease, if any.
     """
     self.assertEqual(
         getVersionString(Version("whatever", 8, 0, 0, prerelease=1)),
         "whatever 8.0.0pre1")
开发者ID:0004c,项目名称:VTK,代码行数:7,代码来源:test_versions.py


示例3: test_getVersionString

 def test_getVersionString(self):
     """
     L{getVersionString} returns a string with the package name and the
     short version number.
     """
     self.assertEqual(
         'Twisted 8.0.0', getVersionString(Version('Twisted', 8, 0, 0)))
开发者ID:0004c,项目名称:VTK,代码行数:7,代码来源:test_versions.py


示例4: _getDeprecationWarningString

def _getDeprecationWarningString(fqpn, version, format=None, replacement=None):
    """
    Return a string indicating that the Python name was deprecated in the given
    version.

    @param fqpn: Fully qualified Python name of the thing being deprecated
    @type fqpn: C{str}

    @param version: Version that C{fqpn} was deprecated in.
    @type version: L{twisted.python.versions.Version}

    @param format: A user-provided format to interpolate warning values into, or
        L{DEPRECATION_WARNING_FORMAT
        <twisted.python.deprecate.DEPRECATION_WARNING_FORMAT>} if C{None} is
        given.
    @type format: C{str}

    @param replacement: what should be used in place of C{fqpn}. Either pass in
        a string, which will be inserted into the warning message, or a
        callable, which will be expanded to its full import path.
    @type replacement: C{str} or callable

    @return: A textual description of the deprecation
    @rtype: C{str}
    """
    if format is None:
        format = DEPRECATION_WARNING_FORMAT
    warningString = format % {
        'fqpn': fqpn,
        'version': getVersionString(version)}
    if replacement:
        warningString = "%s; %s" % (
            warningString, _getReplacementString(replacement))
    return warningString
开发者ID:BillAndersan,项目名称:twisted,代码行数:34,代码来源:deprecate.py


示例5: test_callDeprecationWithWrongMessage

 def test_callDeprecationWithWrongMessage(self):
     """
     If the message passed to L{callDeprecated} doesn't match,
     L{callDeprecated} raises a test failure.
     """
     exception = self.assertRaises(
         self.failureException, self.callDeprecated, (self.version, "something.wrong"), oldMethodReplaced, 1
     )
     self.assertIn(getVersionString(self.version), str(exception))
     self.assertIn("please use newMethod instead", str(exception))
开发者ID:alfonsjose,项目名称:international-orders-app,代码行数:10,代码来源:test_assertions.py


示例6: test_getVersionStringWithRevision

 def test_getVersionStringWithRevision(self):
     """
     L{getVersionString} includes the discovered revision number.
     """
     self.svnEntries.child(b"format").setContent(b"9\n")
     self.svnEntries.child(b"entries").setContent(VERSION_10_ENTRIES)
     version = getVersionString(self.getVersion())
     self.assertEqual(
         "twisted_python_versions_package 1.0.0+r22715",
         version)
     self.assertTrue(isinstance(version, type("")))
开发者ID:0004c,项目名称:VTK,代码行数:11,代码来源:test_versions.py


示例7: getDeprecationWarningString

def getDeprecationWarningString(callableThing, version):
    """
    Return a string indicating that the callable was deprecated in the given
    version.

    @param callableThing: A callable to be deprecated.
    @param version: The L{twisted.python.versions.Version} that the callable
        was deprecated in.
    @return: A string describing the deprecation.
    """
    return "%s was deprecated in %s" % (
        fullyQualifiedName(callableThing), getVersionString(version))
开发者ID:Almad,项目名称:twisted,代码行数:12,代码来源:deprecate.py


示例8: _getDeprecationDocstring

def _getDeprecationDocstring(version, replacement=None):
    """
    Generate an addition to a deprecated object's docstring that explains its
    deprecation.

    @param version: the version it was deprecated.
    @type version: L{Version}

    @param replacement: The replacement, if specified.
    @type replacement: C{str} or callable

    @return: a string like "Deprecated in Twisted 27.2.0; please use
        twisted.timestream.tachyon.flux instead."
    """
    doc = "Deprecated in %s" % (getVersionString(version),)
    if replacement:
        doc = "%s; %s" % (doc, _getReplacementString(replacement))
    return doc + "."
开发者ID:BillAndersan,项目名称:twisted,代码行数:18,代码来源:deprecate.py


示例9: _getDeprecationWarningString

def _getDeprecationWarningString(fqpn, version, format=None):
    """
    Return a string indicating that the Python name was deprecated in the given
    version.

    @type fqpn: C{str}
    @param fqpn: Fully qualified Python name of the thing being deprecated

    @type version: L{twisted.python.versions.Version}
    @param version: Version that C{fqpn} was deprecated in

    @type format: C{str}
    @param format: A user-provided format to interpolate warning values into,
        or L{DEPRECATION_WARNING_FORMAT} if C{None} is given

    @rtype: C{str}
    @return: A textual description of the deprecation
    """
    if format is None:
        format = DEPRECATION_WARNING_FORMAT
    return format % {
        'fqpn': fqpn,
        'version': getVersionString(version)}
开发者ID:williamsjj,项目名称:twisted,代码行数:23,代码来源:deprecate.py


示例10: opt_version

 def opt_version(self):
     """
     Display version information.
     """
     print versions.getVersionString(version)
     sys.exit(0)
开发者ID:jonathanj,项目名称:renamer,代码行数:6,代码来源:application.py


示例11: Version

# See LICENSE for details.


import warnings, types

from twisted.python.versions import Version, getVersionString
from twisted.python.deprecate import deprecated
from twisted.enterprise.adbapi import _safe

# Common deprecation decorator used for all deprecations.
_deprecatedVersion = Version("Twisted", 8, 0, 0)
_releasedDeprecation = deprecated(_deprecatedVersion)

warnings.warn(
    "twisted.enterprise.util is deprecated since %s." % (
        getVersionString(_deprecatedVersion),),
    category=DeprecationWarning)

NOQUOTE = 1
USEQUOTE = 2

dbTypeMap = {
    "bigint": NOQUOTE,
    "bool": USEQUOTE,
    "boolean": USEQUOTE,
    "bytea": USEQUOTE,
    "date": USEQUOTE,
    "int2": NOQUOTE,
    "int4": NOQUOTE,
    "int8": NOQUOTE,
    "int": NOQUOTE,
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:31,代码来源:util.py


示例12: _getDeprecationDocstring

def _getDeprecationDocstring(version):
    return "Deprecated in %s." % getVersionString(version)
开发者ID:williamsjj,项目名称:twisted,代码行数:2,代码来源:deprecate.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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