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


Python platform.python_implementation方法代码示例

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


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

示例1: __init__

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def __init__(self):
        self.datetime_format = '%H:%M:%S %d/%m/%Y'
        self.__raw_boot_time = psutil.boot_time()
        self.__boot_time = datetime.fromtimestamp(self.raw_boot_time)
        self.__boot_time = self.__boot_time.strftime(self.datetime_format)
        self.__hostname = platform.node()
        self.__os = Computer.__get_os_name()
        self.__architecture = platform.machine()
        self.__python_version = '{} ver. {}'.format(
            platform.python_implementation(), platform.python_version()
        )
        self.__processor = Cpu(monitoring_latency=1)
        self.__nonvolatile_memory = NonvolatileMemory.instances_connected_devices(monitoring_latency=10)
        self.__nonvolatile_memory_devices = set(
            [dev_info.device for dev_info in self.__nonvolatile_memory]
        )
        self.__virtual_memory = VirtualMemory(monitoring_latency=1)
        self.__swap_memory = SwapMemory(monitoring_latency=1)
        self.__network_interface = NetworkInterface(monitoring_latency=3)
        super().__init__(monitoring_latency=3) 
开发者ID:it-geeks-club,项目名称:pyspectator,代码行数:22,代码来源:computer.py

示例2: setUp

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def setUp(self):
        if self._should_be_skipped_due_to_version():
            pytest.skip('Test cannot run with Python %s.' % (sys.version.split(' ')[0],))
        missing = []
        for req in self._test_file.options['requires']:
            try:
                __import__(req)
            except ImportError:
                missing.append(req)
        if missing:
            pytest.skip('Requires %s to be present.' % (','.join(missing),))
        if self._test_file.options['except_implementations']:
            implementations = [
                item.strip() for item in
                self._test_file.options['except_implementations'].split(",")
            ]
            implementation = platform.python_implementation()
            if implementation in implementations:
                pytest.skip(
                    'Test cannot run with Python implementation %r'
                    % (implementation, )) 
开发者ID:Shopify,项目名称:shopify_python,代码行数:23,代码来源:test_functional.py

示例3: test_large_read_until

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def test_large_read_until(self):
        # Performance test: read_until used to have a quadratic component
        # so a read_until of 4MB would take 8 seconds; now it takes 0.25
        # seconds.
        server, client = self.make_iostream_pair()
        try:
            # This test fails on pypy with ssl.  I think it's because
            # pypy's gc defeats moves objects, breaking the
            # "frozen write buffer" assumption.
            if (isinstance(server, SSLIOStream) and
                    platform.python_implementation() == 'PyPy'):
                raise unittest.SkipTest(
                    "pypy gc causes problems with openssl")
            NUM_KB = 4096
            for i in range(NUM_KB):
                client.write(b"A" * 1024)
            client.write(b"\r\n")
            server.read_until(b"\r\n", self.stop)
            data = self.wait()
            self.assertEqual(len(data), NUM_KB * 1024 + 2)
        finally:
            server.close()
            client.close() 
开发者ID:tao12345666333,项目名称:tornado-zh,代码行数:25,代码来源:iostream_test.py

示例4: configuration

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def configuration(parent_package='', top_path=None):
    import numpy
    from numpy.distutils.misc_util import Configuration

    config = Configuration('stimuli', parent_package, top_path)
    libraries = []
    if os.name == 'posix':
        libraries.append('m')

    if platform.python_implementation() != 'PyPy':
        config.add_extension('_base',
                             sources=['_base.pyx'],
                             include_dirs=[numpy.get_include()],
                             libraries=libraries)
    config.add_subpackage('tests')
    config.add_data_dir('data')

    return config 
开发者ID:pulse2percept,项目名称:pulse2percept,代码行数:20,代码来源:setup.py

示例5: configuration

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def configuration(parent_package='', top_path=None):
    import numpy
    from numpy.distutils.misc_util import Configuration

    config = Configuration('models', parent_package, top_path)
    libraries = []
    if os.name == 'posix':
        libraries.append('m')

    if platform.python_implementation() != 'PyPy':
        config.add_extension('_beyeler2019',
                             sources=['_beyeler2019.pyx'],
                             include_dirs=[numpy.get_include()],
                             libraries=libraries)
        config.add_extension('_horsager2009',
                             sources=['_horsager2009.pyx'],
                             include_dirs=[numpy.get_include()],
                             libraries=libraries)
        config.add_extension('_nanduri2012',
                             sources=['_nanduri2012.pyx'],
                             include_dirs=[numpy.get_include()],
                             libraries=libraries)
    config.add_subpackage("tests")

    return config 
开发者ID:pulse2percept,项目名称:pulse2percept,代码行数:27,代码来源:setup.py

示例6: __init__

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def __init__(self, default_timeout=300, cache=""):
        BaseCache.__init__(self, default_timeout)

        if platform.python_implementation() == "PyPy":
            raise RuntimeError(
                "uWSGI caching does not work under PyPy, see "
                "the docs for more details."
            )

        try:
            import uwsgi

            self._uwsgi = uwsgi
        except ImportError:
            raise RuntimeError(
                "uWSGI could not be imported, are you running under uWSGI?"
            )

        self.cache = cache 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:21,代码来源:cache.py

示例7: default_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [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": platform.python_version()[:3],
        "sys_platform": sys.platform,
    } 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:23,代码来源:markers.py

示例8: get_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def get_environment():
    """
    Returns a dictionary describing the environment in which stdpopsim
    is currently running.
    """
    env = {
        "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(),
        },
        "libraries": {
            "msprime": {"version": msprime.__version__},
            "tskit": {"version": tskit.__version__},
        }
    }
    return env 
开发者ID:popsim-consortium,项目名称:stdpopsim,代码行数:25,代码来源:cli.py

示例9: _called_from_setup

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def _called_from_setup(run_frame):
        """
        Attempt to detect whether run() was called from setup() or by another
        command.  If called by setup(), the parent caller will be the
        'run_command' method in 'distutils.dist', and *its* caller will be
        the 'run_commands' method.  If called any other way, the
        immediate caller *might* be 'run_command', but it won't have been
        called by 'run_commands'. Return True in that case or if a call stack
        is unavailable. Return False otherwise.
        """
        if run_frame is None:
            msg = "Call stack not available. bdist_* commands may fail."
            warnings.warn(msg)
            if platform.python_implementation() == 'IronPython':
                msg = "For best results, pass -X:Frames to enable call stack."
                warnings.warn(msg)
            return True
        res = inspect.getouterframes(run_frame)[2]
        caller, = res[:1]
        info = inspect.getframeinfo(caller)
        caller_module = caller.f_globals.get('__name__', '')
        return (
            caller_module == 'distutils.dist'
            and info.function == 'run_commands'
        ) 
开发者ID:jpush,项目名称:jbox,代码行数:27,代码来源:install.py

示例10: get_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [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

示例11: test_set_process_name

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def test_set_process_name(self):
    """
    Exercises the get_process_name() and set_process_name() methods.
    """

    if platform.python_implementation() == 'PyPy':
      self.skipTest('(unimplemented for pypy)')

    initial_name = stem.util.system.get_process_name()
    self.assertTrue('run_tests.py' in initial_name)

    try:
      stem.util.system.set_process_name('stem_integ')
      self.assertEqual('stem_integ', stem.util.system.get_process_name())
    finally:
      stem.util.system.set_process_name(initial_name) 
开发者ID:torproject,项目名称:stem,代码行数:18,代码来源:system.py

示例12: _client_properties

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def _client_properties():
        """AMQPStorm Client Properties.

        :rtype: dict
        """
        return {
            'product': 'AMQPStorm',
            'platform': 'Python %s (%s)' % (platform.python_version(),
                                            platform.python_implementation()),
            'capabilities': {
                'basic.nack': True,
                'connection.blocked': True,
                'publisher_confirms': True,
                'consumer_cancel_notify': True,
                'authentication_failure_close': True,
            },
            'information': 'See https://github.com/eandersson/amqpstorm',
            'version': __version__
        } 
开发者ID:fake-name,项目名称:ReadableWebProxy,代码行数:21,代码来源:channel0.py

示例13: setUp

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def setUp(self):
        if self._should_be_skipped_due_to_version():
            pytest.skip( 'Test cannot run with Python %s.' % (sys.version.split(' ')[0],))
        missing = []
        for req in self._test_file.options['requires']:
            try:
                __import__(req)
            except ImportError:
                missing.append(req)
        if missing:
            pytest.skip('Requires %s to be present.' % (','.join(missing),))
        if self._test_file.options['except_implementations']:
            implementations = [
                item.strip() for item in
                self._test_file.options['except_implementations'].split(",")
            ]
            implementation = platform.python_implementation()
            if implementation in implementations:
                pytest.skip(
                    'Test cannot run with Python implementation %r'
                    % (implementation, )) 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:23,代码来源:test_functional.py

示例14: default_environment

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [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": platform.python_version()[:3],
        "sys_platform": sys.platform,
    } 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:23,代码来源:markers.py

示例15: python_version

# 需要导入模块: import platform [as 别名]
# 或者: from platform import python_implementation [as 别名]
def python_version():
    """
    Find the version of Python we're running.

    This specifically returns a name that matches both of the following:

    - The name of the Debian package providing the current Python version.
    - The name of the interpreter executable for the current Python version.

    :returns: A string like ``python2.7``, ``python3.7`` or ``pypy``.
    """
    python_version = (
        'pypy' if platform.python_implementation() == 'PyPy'
        else 'python%d.%d' % sys.version_info[:2]
    )
    logger.debug("Detected Python version: %s", python_version)
    return python_version 
开发者ID:paylogic,项目名称:py2deb,代码行数:19,代码来源:utils.py


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