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


Python platform.machine方法代码示例

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


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

示例1: wait_until_server_loaded

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def wait_until_server_loaded(self, timeout_s=900, port=2552):
        """
        This function will wait until the LabVIEW server is loaded on the local
        machine.

        :param timeout_s: How long to wait for the LabVIEW server to load.
            Default is 15 minutes (900 seconds).
        :raises TimeoutError: Raised when timeout exceeded while waiting
        """
        waiting = True
        start_time = time.time()
        while waiting:
            try:
                with self.client():
                    pass
            except Exception:
                if time.time() - start_time > timeout_s:
                    raise TimeoutError('Timed out while waiting for LabVIEW'
                                       ' server to load')
            else:
                waiting = False 
开发者ID:ni,项目名称:python_labview_automation,代码行数:23,代码来源:labview.py

示例2: _open_windows_native_key

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def _open_windows_native_key(self, key, sub_key):
        """
        Opens a windows registry key using the OS bitness-based version of the
        registry view.
        This method eventually calls the _winreg.OpenKey() method.

        This is useful because if we're running a 32-bit python interpreter, by
        default _winreg accesses the 32-bit registry view. This is a problem on
        64-bit OSes as it limits us to registries of 32-bit applications.
        """
        import _winreg

        python_bitness, linkage = platform.architecture()

        # If we're running 32-bit python, by default _winreg accesses the
        # 32-bit registry view. This is a problem on 64-bit OSes.
        if python_bitness == '32bit' and platform.machine().endswith('64'):
            # Force _winreg to access the 64-bit registry view with the access
            # map as _winreg.KEY_WOW64_64KEY
            return _winreg.OpenKey(key, sub_key, 0, _winreg.KEY_READ | _winreg.KEY_WOW64_64KEY)
        else:
            return _winreg.OpenKey(key, sub_key)

        return key 
开发者ID:ni,项目名称:python_labview_automation,代码行数:26,代码来源:labview.py

示例3: detectArch

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def detectArch():
  try:
    with open("/etc/os-release") as osr:
      osReleaseLines = osr.readlines()
    hasOsRelease = True
  except (IOError,OSError):
    osReleaseLines = []
    hasOsRelease = False
  try:
    import platform
    if platform.system() == "Darwin":
      return "osx_x86-64"
  except:
    pass
  try:
    import platform, distro
    platformTuple = distro.linux_distribution()
    platformSystem = platform.system()
    platformProcessor = platform.processor()
    if " " in platformProcessor:
      platformProcessor = platform.machine()
    return doDetectArch(hasOsRelease, osReleaseLines, platformTuple, platformSystem, platformProcessor)
  except:
    return doDetectArch(hasOsRelease, osReleaseLines, ["unknown", "", ""], "", "") 
开发者ID:alisw,项目名称:alibuild,代码行数:26,代码来源:utilities.py

示例4: __init__

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

示例5: best_float

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def best_float():
    """ Floating point type with best precision

    This is nearly always np.longdouble, except on Windows, where np.longdouble
    is Intel80 storage, but with float64 precision for calculations.  In that
    case we return float64 on the basis it's the fastest and smallest at the
    highest precision.

    Returns
    -------
    best_type : numpy type
        floating point type with highest precision
    """
    if (type_info(np.longdouble)['nmant'] > type_info(np.float64)['nmant'] and
        machine() != 'sparc64'): # sparc has crazy-slow float128
        return np.longdouble
    return np.float64 
开发者ID:ME-ICA,项目名称:me-ica,代码行数:19,代码来源:casting.py

示例6: _selected_real_kind_func

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def _selected_real_kind_func(p, r=0, radix=0):
    # XXX: This should be processor dependent
    # This is only good for 0 <= p <= 20
    if p < 7:
        return 4
    if p < 16:
        return 8
    machine = platform.machine().lower()
    if machine.startswith(('aarch64', 'power', 'ppc64', 's390x', 'sparc')):
        if p <= 20:
            return 16
    else:
        if p < 19:
            return 10
        elif p <= 20:
            return 16
    return -1 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:19,代码来源:crackfortran.py

示例7: default_environment

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

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def __init__(self, base_path, home_path=Path.home(), apps=None, input_enabled=True):
        self.base_path = base_path
        self.home_path = home_path
        self.dot_briefcase_path = home_path / ".briefcase"

        self.global_config = None
        self.apps = {} if apps is None else apps

        # Some details about the host machine
        self.host_arch = platform.machine()
        self.host_os = platform.system()

        # External service APIs.
        # These are abstracted to enable testing without patching.
        self.cookiecutter = cookiecutter
        self.requests = requests
        self.input = Console(enabled=input_enabled)
        self.os = os
        self.sys = sys
        self.shutil = shutil
        self.subprocess = Subprocess(self)

        # The internal Briefcase integrations API.
        self.integrations = integrations 
开发者ID:beeware,项目名称:briefcase,代码行数:26,代码来源:base.py

示例9: get_environment

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

示例10: get_build_platform

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def get_build_platform():
    """Return this platform's string for platform-specific distributions

    XXX Currently this is the same as ``distutils.util.get_platform()``, but it
    needs some hacks for Linux and Mac OS X.
    """
    try:
        # Python 2.7 or >=3.2
        from sysconfig import get_platform
    except ImportError:
        from distutils.util import get_platform

    plat = get_platform()
    if sys.platform == "darwin" and not plat.startswith('macosx-'):
        try:
            version = _macosx_vers()
            machine = os.uname()[4].replace(" ", "_")
            return "macosx-%d.%d-%s" % (int(version[0]), int(version[1]),
                _macosx_arch(machine))
        except ValueError:
            # if someone is running a non-Mac darwin system, this will fall
            # through to the default implementation
            pass
    return plat 
开发者ID:jpush,项目名称:jbox,代码行数:26,代码来源:__init__.py

示例11: get_environment

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

示例12: _pv_linux_machine

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def _pv_linux_machine(machine):
    if machine == 'x86_64':
        return machine

    cpu_info = subprocess.check_output(['cat', '/proc/cpuinfo']).decode()

    hardware_info = [x for x in cpu_info.split('\n') if 'Hardware' in x][0]
    model_info = [x for x in cpu_info.split('\n') if 'model name' in x][0]

    if 'BCM' in hardware_info:
        if 'rev 7' in model_info:
            return 'arm11'
        elif 'rev 5' in model_info:
            return 'cortex-a7'
        elif 'rev 4' in model_info:
            return 'cortex-a53'
        elif 'rev 3' in model_info:
            return 'cortex-a72'
    elif 'AM33' in hardware_info:
        return 'beaglebone'
    else:
        raise NotImplementedError('unsupported CPU:\n%s' % cpu_info) 
开发者ID:Picovoice,项目名称:porcupine,代码行数:24,代码来源:util.py

示例13: spawn

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def spawn(self, cmd, expect_timeout=10.0):
        """Run a command using pexpect.

        The pexpect child is returned.

        """
        pexpect = pytest.importorskip("pexpect", "3.0")
        if hasattr(sys, "pypy_version_info") and "64" in platform.machine():
            pytest.skip("pypy-64 bit not supported")
        if sys.platform.startswith("freebsd"):
            pytest.xfail("pexpect does not work reliably on freebsd")
        logfile = self.tmpdir.join("spawn.out").open("wb")

        # Do not load user config.
        env = os.environ.copy()
        env.update(self._env_run_update)

        child = pexpect.spawn(cmd, logfile=logfile, env=env)
        self.request.addfinalizer(logfile.close)
        child.timeout = expect_timeout
        return child 
开发者ID:sofia-netsurv,项目名称:python-netsurv,代码行数:23,代码来源:pytester.py

示例14: default_environment

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

# 需要导入模块: import platform [as 别名]
# 或者: from platform import machine [as 别名]
def is_host_target_supported(host_target, msvc_version):
    """Check if the given (host, target) tuple is supported for given version.

    Args:
        host_target: tuple
            tuple of (canonalized) host-targets, e.g. ("x86", "amd64")
            for cross compilation from 32 bit Windows to 64 bits.
        msvc_version: str
            msvc version (major.minor, e.g. 10.0)

    Returns:
        bool:

    Note:
        This only checks whether a given version *may* support the given (host,
        target), not that the toolchain is actually present on the machine.
    """
    # We assume that any Visual Studio version supports x86 as a target
    if host_target[1] != "x86":
        maj, min = msvc_version_to_maj_min(msvc_version)
        if maj < 8:
            return False

    return True 
开发者ID:Autodesk,项目名称:arnold-usd,代码行数:26,代码来源:vc.py


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