当前位置: 首页>>代码示例>>Python>>正文


Python versions.getVersionString函数代码示例

本文整理汇总了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;未经允许,请勿转载。