本文整理汇总了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)
示例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, ))
示例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()
示例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
示例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
示例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
示例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,
}
示例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
示例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'
)
示例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
示例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)
示例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__
}
示例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, ))
示例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,
}
示例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