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


Python platform.python_version_tuple方法代码示例

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


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

示例1: get_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def get_environment():
    """
    Returns a dictionary describing the environment in which tsinfer
    is currently running.
    """
    env = {
        "libraries": {
            "zarr": {"version": zarr.__version__},
            "numcodecs": {"version": numcodecs.__version__},
            "lmdb": {"version": lmdb.__version__},
            "tskit": {"version": tskit.__version__},
        },
        "os": {
            "system": platform.system(),
            "node": platform.node(),
            "release": platform.release(),
            "version": platform.version(),
            "machine": platform.machine(),
        },
        "python": {
            "implementation": platform.python_implementation(),
            "version": platform.python_version_tuple(),
        },
    }
    return env 
开发者ID:tskit-dev,项目名称:tsinfer,代码行数:27,代码来源:provenance.py

示例2: default_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def default_environment():
    if hasattr(sys, "implementation"):
        iver = format_full_version(sys.implementation.version)
        implementation_name = sys.implementation.name
    else:
        iver = "0"
        implementation_name = ""

    return {
        "implementation_name": implementation_name,
        "implementation_version": iver,
        "os_name": os.name,
        "platform_machine": platform.machine(),
        "platform_release": platform.release(),
        "platform_system": platform.system(),
        "platform_version": platform.version(),
        "python_full_version": platform.python_version(),
        "platform_python_implementaiton": platform.python_implementation(),
        "python_version": ".".join(platform.python_version_tuple()[:2]),
        "sys_platform": sys.platform,
    } 
开发者ID:frostming,项目名称:pdm,代码行数:23,代码来源:pep508.py

示例3: test_python3_2_raises_exception

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def test_python3_2_raises_exception(monkeypatch):
    "Test python version 3.0 through 3.2 raises an exception."
    import blessed

    monkeypatch.setattr('platform.python_version_tuple',
                        lambda: ('3', '2', '2'))

    try:
        imp.reload(blessed)
    except ImportError as err:
        assert err.args[0] == (
            'Blessed needs Python 3.2.3 or greater for Python 3 '
            'support due to http://bugs.python.org/issue10570.')
        monkeypatch.undo()
        imp.reload(blessed)
    else:
        assert False, 'Exception should have been raised' 
开发者ID:QData,项目名称:deepWordBug,代码行数:19,代码来源:test_core.py

示例4: _get_sesh_info_sectn

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def _get_sesh_info_sectn(self):
        pf = platform.platform() + \
             ' (64-bit)' if sys.maxsize > 2 ** 32 else ' (32-bit)'

        major, minor, _ = platform.python_version_tuple()
        python_v = major + '.' + minor

        now = datetime.datetime.now()
        date = now.strftime('%Y-%m-%d')

        return {
            'Platform': pf,
            'Python': python_v,
            'Date': date
        }

    # methods used to initialize pkg_info field --------------------------- 
开发者ID:crew102,项目名称:reprexpy,代码行数:19,代码来源:session_info.py

示例5: default_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def default_environment():
    if hasattr(sys, "implementation"):
        iver = format_full_version(sys.implementation.version)
        implementation_name = sys.implementation.name
    else:
        iver = "0"
        implementation_name = ""

    return {
        "implementation_name": implementation_name,
        "implementation_version": iver,
        "os_name": os.name,
        "platform_machine": platform.machine(),
        "platform_release": platform.release(),
        "platform_system": platform.system(),
        "platform_version": platform.version(),
        "python_full_version": platform.python_version(),
        "platform_python_implementation": platform.python_implementation(),
        "python_version": ".".join(platform.python_version_tuple()[:2]),
        "sys_platform": sys.platform,
    } 
开发者ID:pantsbuild,项目名称:pex,代码行数:23,代码来源:markers.py

示例6: test_missing_ordereddict_uses_module

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def test_missing_ordereddict_uses_module(monkeypatch):
    "ordereddict module is imported when without collections.OrderedDict."
    import blessed.keyboard

    if hasattr(collections, 'OrderedDict'):
        monkeypatch.delattr('collections.OrderedDict')

    try:
        imp.reload(blessed.keyboard)
    except ImportError as err:
        assert err.args[0] in ("No module named ordereddict",  # py2
                               "No module named 'ordereddict'")  # py3
        sys.modules['ordereddict'] = mock.Mock()
        sys.modules['ordereddict'].OrderedDict = -1
        imp.reload(blessed.keyboard)
        assert blessed.keyboard.OrderedDict == -1
        del sys.modules['ordereddict']
        monkeypatch.undo()
        imp.reload(blessed.keyboard)
    else:
        assert platform.python_version_tuple() < ('2', '7')  # reached by py2.6 
开发者ID:QData,项目名称:deepWordBug,代码行数:23,代码来源:test_core.py

示例7: default_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def default_environment():
    # type: () -> Dict[str, str]
    if hasattr(sys, "implementation"):
        # Ignoring the `sys.implementation` reference for type checking due to
        # mypy not liking that the attribute doesn't exist in Python 2.7 when
        # run with the `--py27` flag.
        iver = format_full_version(sys.implementation.version)  # type: ignore
        implementation_name = sys.implementation.name  # type: ignore
    else:
        iver = "0"
        implementation_name = ""

    return {
        "implementation_name": implementation_name,
        "implementation_version": iver,
        "os_name": os.name,
        "platform_machine": platform.machine(),
        "platform_release": platform.release(),
        "platform_system": platform.system(),
        "platform_version": platform.version(),
        "python_full_version": platform.python_version(),
        "platform_python_implementation": platform.python_implementation(),
        "python_version": ".".join(platform.python_version_tuple()[:2]),
        "sys_platform": sys.platform,
    } 
开发者ID:pypa,项目名称:pipenv,代码行数:27,代码来源:markers.py

示例8: setUp

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def setUp(self):
        if self.iterator_class == chainer.iterators.MultiprocessIterator and \
                int(platform.python_version_tuple()[0]) < 3:
            pytest.skip('This test requires Python version >= 3')
        self.communicator = chainermn.create_communicator('naive')

        if self.communicator.size < 2:
            pytest.skip('This test is for multinode only')

        self.N = 100
        if self.paired_dataset:
            self.dataset = list(zip(
                np.arange(self.N).astype(np.float32),
                np.arange(self.N).astype(np.float32)))
        else:
            self.dataset = np.arange(self.N).astype(np.float32) 
开发者ID:chainer,项目名称:chainer,代码行数:18,代码来源:test_multi_node_iterator.py

示例9: test_is_precisely_correct_version

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def test_is_precisely_correct_version(self):

        toxenvname = 'TOX_%s' % os.environ['TOX_ENV_NAME'].upper().strip()
        expected_string = os.environ[toxenvname].strip(' "\'')
        print('\n\nTOX ENV NAME: %s' % toxenvname)
        if platform.python_implementation() == 'PyPy':
            actual_list = [str(_).strip() for _ in sys.pypy_version_info[:3]]
            expected_string = expected_string.split('-')[1].strip(' "\'')
            print('\nExpected version for this tox env: PyPy %s'
                  % expected_string)
            print('Actual version for this tox env: PyPy %s'
                  % '.'.join(actual_list))
        else:
            print('\nExpected version for this tox env: Python %s'
                  % expected_string)
            print('Actual version for this tox env: Python %s'
                  % platform.python_version())
            actual_list = list(platform.python_version_tuple())
        expected_list = expected_string.split('.')

        print('\n\nPYTHON VERSION (verbose)')
        print('*************************')
        print(sys.version)
        print('\n')
        self.assertEqual(actual_list, expected_list) 
开发者ID:stavxyz,项目名称:tox-pyenv,代码行数:27,代码来源:test_tox_pyenv.py

示例10: custom_module_loader

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def custom_module_loader():
    """
    Utility function for using different module loaders based on python version:
    * :meth:`dtale.cli.loaders.get_py35_loader`
    * :meth:`dtale.cli.loaders.get_py33_loader`
    * :meth:`dtale.cli.loaders.get_py2_loader`

    """
    major, minor, revision = [int(i) for i in platform.python_version_tuple()]
    if major == 2:
        return get_py2_loader
    if major == 3:
        if minor >= 5:
            return get_py35_loader
        elif minor in (3, 4):
            return get_py33_loader
    raise ValueError(unsupported_python_version(platform.python_version_tuple())) 
开发者ID:man-group,项目名称:dtale,代码行数:19,代码来源:__init__.py

示例11: get_default_library_patters

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def get_default_library_patters():
    """
    Returns library paths depending on the used platform.

    :return: a list of glob paths
    """
    python_version = platform.python_version_tuple()
    python_implementation = platform.python_implementation()
    system = platform.system()
    if python_implementation == "PyPy":
        if python_version[0] == "2":
            return ["*/lib-python/%s.%s/*" % python_version[:2], "*/site-packages/*"]
        else:
            return ["*/lib-python/%s/*" % python_version[0], "*/site-packages/*"]
    else:
        if system == "Windows":
            return [r"*\lib\*"]
        return ["*/lib/python%s.%s/*" % python_version[:2], "*/lib64/python%s.%s/*" % python_version[:2]] 
开发者ID:elastic,项目名称:apm-agent-python,代码行数:20,代码来源:compat.py

示例12: py_versioncheck

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def py_versioncheck(function, version):
    """
    :platform:
        any platform + any functions in python

    :param version:
        The python on the OS should be >= param version.
        *E.g. version=('2', '7', '0')*
        OS python version should >= 2.7.0
    """
    ind = 0
    py_version = platform.python_version_tuple()
    for i in py_version:
        if int(version(ind)) < int(i):
            raise cup.err.DecoratorException(
                'Python version check failed. You expect version >= %s,'
                'but python-version on this machine:%s' %
                (version, py_version)
            )
        ind += 1
    return function 
开发者ID:baidu,项目名称:CUP,代码行数:23,代码来源:decorators.py

示例13: get_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def get_environment():
    """
    Returns a dictionary describing the environment in which msprime
    is currently running.
    """
    env = {
        "libraries": {
        },
        "parameters" : {
            "command" : []
        },
        "os": {
            "system": platform.system(),
            "node": platform.node(),
            "release": platform.release(),
            "version": platform.version(),
            "machine": platform.machine(),
        },
        "python": {
            "implementation": platform.python_implementation(),
            "version": platform.python_version_tuple(),
        }
    }
    return env 
开发者ID:tskit-dev,项目名称:pyslim,代码行数:26,代码来源:provenance.py

示例14: benchmark

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def benchmark(n):
    global methods
    if "--onlyself" in sys.argv[1:]:
        methods = [m for m in methods if m[0].startswith("tabulate")]
    else:
        methods = methods

    results = [
        (desc, timeit(code, setup_code, number=n) / n * 1e6) for desc, code in methods
    ]
    mintime = min(map(lambda x: x[1], results))
    results = [
        (desc, t, t / mintime) for desc, t in sorted(results, key=lambda x: x[1])
    ]
    table = tabulate.tabulate(
        results, ["Table formatter", "time, μs", "rel. time"], "rst", floatfmt=".1f"
    )

    import platform

    if platform.platform().startswith("Windows"):
        print(table)
    elif python_version_tuple()[0] < "3":
        print(codecs.encode(table, "utf-8"))
    else:
        print(table) 
开发者ID:astanin,项目名称:python-tabulate,代码行数:28,代码来源:benchmark.py

示例15: py3test_require_py3

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_version_tuple [as 别名]
def py3test_require_py3():
    "Regression: py33 tests should actually use Python 3 (issue #13)"
    from platform import python_version_tuple

    print("Expected Python version: 3.x.x")
    print("Python version used for tests: %s.%s.%s" % python_version_tuple())
    assert_equal(python_version_tuple()[0], "3") 
开发者ID:astanin,项目名称:python-tabulate,代码行数:9,代码来源:test_regression.py


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