Python paramiko 模块,__version__() 实例源码

我们从Python开源项目中,提取了以下1个代码示例,用于说明如何使用paramiko.__version__()

项目:obnam    作者:obnam-mirror    | 项目源码 | 文件源码
def _get_paramiko_version_info(self):
        '''Get the __version_info__ tuple for paramiko.

        Some versions of paramiko (1.7.8 to 1.10.4, according to
        research by Jan Niggemann) have no __version_info__ tuple. We
        need that tuple to do version comparisons.

        This method constructs the tuple from paramiko.__version__, if
        paramiko.__version_info__ is missing. If __version__ is also
        missing, it raises an exception.

        '''

        if hasattr(paramiko, '__version_info__'):
            return paramiko.__version_info__
        elif hasattr(paramiko, '__version__'):
            return tuple(int(x) for x in paramiko.__version__.split('.'))
        else:
            raise UnknownParamikoVersion()