當前位置: 首頁>>代碼示例>>Python>>正文


Python platform.release方法代碼示例

本文整理匯總了Python中platform.release方法的典型用法代碼示例。如果您正苦於以下問題:Python platform.release方法的具體用法?Python platform.release怎麽用?Python platform.release使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在platform的用法示例。


在下文中一共展示了platform.release方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_os_type

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def get_os_type():
	os_type = platform.system()
	if os_type == "Linux":
		return OS_LINUX

	if os_type == "Darwin":
		return OS_MACOSX

	if os_type == "Windows":
		return OS_WINDOWS

	if os_type == "FreeBSD":
		return OS_FREEBSD

	if os_type == "OpenBSD":
		return OS_OPENBSD

	return OS_UNKNOWN

# get the release of the OS 
開發者ID:earthquake,項目名稱:XFLTReaT,代碼行數:22,代碼來源:common.py

示例2: init

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def init(debug :bool =False) -> Dict[int, Tuple[int, int, int, int]]:
        """Finds the game window and returns its coords."""
        if platform.release() == "10":
            ctypes.windll.shcore.SetProcessDpiAwareness(2)
        else:
            ctypes.windll.user32.SetProcessDPIAware()

        def window_enumeration_handler(hwnd, top_windows):
            """Add window title and ID to array."""
            top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))

        if debug:
            window_name = "debugg"
        else:
            window_name = "play ngu idle"

        top_windows = []
        windows = []
        candidates = {}
        win32gui.EnumWindows(window_enumeration_handler, top_windows)
        windows = [window[0] for window in top_windows if window_name in window[1].lower()]
        for window in windows:
            candidates[window] = Window.winRect(window)
        return candidates 
開發者ID:kujan,項目名稱:NGU-scripts,代碼行數:26,代碼來源:window.py

示例3: _requires_unix_version

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def _requires_unix_version(sysname, min_version):
    """Decorator raising SkipTest if the OS is `sysname` and the version is less
    than `min_version`.

    For example, @_requires_unix_version('FreeBSD', (7, 2)) raises SkipTest if
    the FreeBSD version is less than 7.2.
    """
    def decorator(func):
        @functools.wraps(func)
        def wrapper(*args, **kw):
            if platform.system() == sysname:
                version_txt = platform.release().split('-', 1)[0]
                try:
                    version = tuple(map(int, version_txt.split('.')))
                except ValueError:
                    pass
                else:
                    if version < min_version:
                        min_version_txt = '.'.join(map(str, min_version))
                        raise unittest.SkipTest(
                            "%s version %s or higher required, not %s"
                            % (sysname, min_version_txt, version_txt))
        return wrapper
    return decorator 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:26,代碼來源:support.py

示例4: default_environment

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [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

示例5: get_environment

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [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

示例6: get_environment

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [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

示例7: log

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def log(txt):
        if not os.path.exists(folder):
            os.mkdir(folder)
            
	try:
		fileLock.acquire()
		FILE  = open (filename,"a" )
	except IOError:
		if console:
			print "[-] Can not open log.txt!\n"
		log("[-] Hata: Can not open log.txt!")
		sys.exit(1)
		
	start = str(datetime.datetime.now())
	txt = "(" + start + ")" + " " + txt + "\r\n"
	FILE.writelines(txt)
	FILE.close()
	fileLock.release() 
開發者ID:mertsarica,項目名稱:hack4career,代碼行數:20,代碼來源:cryptokiller.py

示例8: error_log

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def error_log(txt):
        try:
		fileLock.acquire()
                FILE  = open (filename_err,"a" )                                
        except IOError:
		if console:
                	print "[-] Can not open error.txt!\n"
		error_log("[-] Can not open error.txt!")
                sys.exit(1)

        start = datetime.datetime.now()
        txt = "(" + str(start) + ")" + " " + txt + "\r\n"
        FILE.writelines(txt)   
        FILE.close()
	fileLock.release()

# Reference: http://stackoverflow.com/questions/20303291/issue-with-redirecting-stdout-to-tkinter-text-widget-with-threads 
開發者ID:mertsarica,項目名稱:hack4career,代碼行數:19,代碼來源:cryptokiller.py

示例9: build_header

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def build_header(self, req, req_inter):
        if req.request_id is not None:
            req_inter.header["x-mns-user-request-id"] = req.request_id
        if self.http.is_keep_alive():
            req_inter.header["Connection"] = "Keep-Alive"
        if req_inter.data != "":
            req_inter.header["content-md5"] = base64.b64encode(hashlib.md5(req_inter.data).hexdigest().encode('UTF-8')).decode()
            req_inter.header["content-type"] = "text/xml;charset=UTF-8"
        req_inter.header["x-mns-version"] = self.version
        req_inter.header["host"] = self.host
        req_inter.header["date"] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime())
        req_inter.header["user-agent"] = "aliyun-sdk-python/%s(%s/%s;%s)" % \
                                         (pkg_info.version, platform.system(), platform.release(), platform.python_version())
        req_inter.header["Authorization"] = self.get_signature(req_inter.method, req_inter.header, req_inter.uri)
        if self.security_token != "":
            req_inter.header["security-token"] = self.security_token 
開發者ID:gikoluo,項目名稱:aliyun-mns,代碼行數:18,代碼來源:mns_client.py

示例10: default_environment

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [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

示例11: test_uname_win32_ARCHITEW6432

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def test_uname_win32_ARCHITEW6432(self):
        # Issue 7860: make sure we get architecture from the correct variable
        # on 64 bit Windows: if PROCESSOR_ARCHITEW6432 exists we should be
        # using it, per
        # http://blogs.msdn.com/david.wang/archive/2006/03/26/HOWTO-Detect-Process-Bitness.aspx
        try:
            with support.EnvironmentVarGuard() as environ:
                if 'PROCESSOR_ARCHITEW6432' in environ:
                    del environ['PROCESSOR_ARCHITEW6432']
                environ['PROCESSOR_ARCHITECTURE'] = 'foo'
                platform._uname_cache = None
                system, node, release, version, machine, processor = platform.uname()
                self.assertEqual(machine, 'foo')
                environ['PROCESSOR_ARCHITEW6432'] = 'bar'
                platform._uname_cache = None
                system, node, release, version, machine, processor = platform.uname()
                self.assertEqual(machine, 'bar')
        finally:
            platform._uname_cache = None 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:21,代碼來源:test_platform.py

示例12: test_parse_release_file

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def test_parse_release_file(self):

        for input, output in (
            # Examples of release file contents:
            ('SuSE Linux 9.3 (x86-64)', ('SuSE Linux ', '9.3', 'x86-64')),
            ('SUSE LINUX 10.1 (X86-64)', ('SUSE LINUX ', '10.1', 'X86-64')),
            ('SUSE LINUX 10.1 (i586)', ('SUSE LINUX ', '10.1', 'i586')),
            ('Fedora Core release 5 (Bordeaux)', ('Fedora Core', '5', 'Bordeaux')),
            ('Red Hat Linux release 8.0 (Psyche)', ('Red Hat Linux', '8.0', 'Psyche')),
            ('Red Hat Linux release 9 (Shrike)', ('Red Hat Linux', '9', 'Shrike')),
            ('Red Hat Enterprise Linux release 4 (Nahant)', ('Red Hat Enterprise Linux', '4', 'Nahant')),
            ('CentOS release 4', ('CentOS', '4', None)),
            ('Rocks release 4.2.1 (Cydonia)', ('Rocks', '4.2.1', 'Cydonia')),
            ('', ('', '', '')), # If there's nothing there.
            ):
            self.assertEqual(platform._parse_release_file(input), output) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:18,代碼來源:test_platform.py

示例13: _sendData

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def _sendData():
        # disable collection of data if requested
        if "UW_NO_USAGE_METRICS" not in os.environ:
            # get platform info
            import platform
            label  =        platform.system()
            label += "__" + platform.release()
            # check if docker
            import os.path
            if (os.path.isfile("/.dockerinit")):
                label += "__docker"

            # send info async
            import threading
            thread = threading.Thread(target=_net.PostGAEvent,
                                      args=("runtime",
                                            "import",
                                            label,
                                            nProcs))
            thread.daemon = True
            thread.start() 
開發者ID:underworldcode,項目名稱:UWGeodynamics,代碼行數:23,代碼來源:__init__.py

示例14: default_environment

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [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

示例15: register_metadata

# 需要導入模塊: import platform [as 別名]
# 或者: from platform import release [as 別名]
def register_metadata(ctx):
    """Attach additional data to sentry events."""
    with configure_scope() as scope:
        scope.user = {"id": ctx.author.id, "username": str(ctx.author)}
        scope.set_context("client_os", {"name": system(), "version": release()})
        scope.set_tag("command", ctx.message.content)
        scope.set_tag("channel", str(ctx.channel)) 
開發者ID:CyberDiscovery,項目名稱:cyberdisc-bot,代碼行數:9,代碼來源:bot.py


注:本文中的platform.release方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。