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


Python LooseVersion.__init__方法代码示例

本文整理汇总了Python中distutils.version.LooseVersion.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python LooseVersion.__init__方法的具体用法?Python LooseVersion.__init__怎么用?Python LooseVersion.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.version.LooseVersion的用法示例。


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

示例1: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
 def __init__(self, version):
     # Can't use super, LooseVersion's base class is not a new-style class.
     LooseVersion.__init__(self, version)
     # Take the first three integer components, stopping at the first
     # non-integer and padding the rest with zeroes.
     (self.major, self.minor, self.patch) = list(itertools.chain(
         itertools.takewhile(lambda x:isinstance(x, int), self.version),
         (0, 0, 0)))[:3]
开发者ID:MekliCZ,项目名称:positron,代码行数:10,代码来源:util.py

示例2: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
    def __init__(self, version_string):
        self.is_dev = (version_string.lower() == "dev")
        if self.is_dev:
            version_string = kafkatest_version()

            # Drop dev suffix if present
            dev_suffix_index = version_string.find(".dev")
            if dev_suffix_index >= 0:
                version_string = version_string[:dev_suffix_index]

        # Don't use the form super.(...).__init__(...) because
        # LooseVersion is an "old style" python class
        LooseVersion.__init__(self, version_string)
开发者ID:harshach,项目名称:kafka,代码行数:15,代码来源:version.py

示例3: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
 def __init__(self, string):
     match = re.match(self.version_re, string)
     if not match:
         raise Exception("invalid version string format")
     LooseVersion.__init__(self, string)
     self.epoch = match.group(1) or 0
     self.version = match.group(2)
     # someone please inform foobnix's maintainer that the letter "o" should
     # never, ever, ever, *ever* be used to represent zero.
     if match.group(3) == "o":
         self.release = 0
     else:
         self.release = int(match.group(3)) if match.group(3) else 1
开发者ID:darvid,项目名称:borealis,代码行数:15,代码来源:objects.py

示例4: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
    def __init__(self, version_string):
        self.is_trunk = (version_string.lower() == "trunk")
        if self.is_trunk:
            # Since "trunk" may actually be a branch that is not trunk,
            # use kafkatest_version() for comparison purposes,
            # and track whether we're in "trunk" with a flag
            version_string = kafkatest_version()

            # Drop dev suffix if present
            dev_suffix_index = version_string.find(".dev")
            if dev_suffix_index >= 0:
                version_string = version_string[:dev_suffix_index]

        # Don't use the form super.(...).__init__(...) because
        # LooseVersion is an "old style" python class
        LooseVersion.__init__(self, version_string)
开发者ID:lovejavaee,项目名称:kafka_enhancement,代码行数:18,代码来源:version.py

示例5: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
    def __init__(self, vstring=None, v_prefix=None):
        self._v_prefix = v_prefix

        if isinstance(vstring, (list, tuple)):
            type_ = type(vstring)
            vstring = '.'.join(str(i) for i in vstring)
        else:
            type_ = list

        vstring = vstring.strip()

        if vstring.startswith('v'):
            vstring = vstring[1:]
            if vstring.startswith('!'):
                raise ValueError('Invalid use of epoch')
            if v_prefix is not False:
                self._v_prefix = True

        # Can not use super(..) on Python 2.7
        LooseVersion.__init__(self, vstring)
        if self._v_prefix:
            self.vstring = 'v' + self.vstring
        if len(self.version) > 1 and self.version[1] == '!':
            self._epoch = self.version[0]
            if not isinstance(self._epoch, int) or len(self.version) < 3:
                raise ValueError('Invalid use of epoch')

        # Normalise to lower case
        self.version = [
            x if isinstance(x, int) else x.lower() for x in self.version
            if x not in ('-', '_')]

        if self.version[-1] != '*' and not isinstance(self.version[-1], int):
            self.version += (0, )

        if type_ is tuple:
            self.version = tuple(self.version)

        self._final = None
        self._previous = None
开发者ID:coala-analyzer,项目名称:coala-quickstart,代码行数:42,代码来源:setup.py

示例6: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
 def __init__(self, vstring=None):
     self.vstring = vstring
     self.version = []
     LooseVersion.__init__(self, vstring=vstring)
开发者ID:H1d3r,项目名称:cobra,代码行数:6,代码来源:dependencies.py

示例7: __init__

# 需要导入模块: from distutils.version import LooseVersion [as 别名]
# 或者: from distutils.version.LooseVersion import __init__ [as 别名]
 def __init__(self, vstring=None):
     LooseVersion.__init__(self, vstring=vstring)
     self.version = tuple(map(str, self.version))
开发者ID:jgiannuzzi,项目名称:pypi-server,代码行数:5,代码来源:hash_version.py


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