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


Python platform.platform方法代码示例

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


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

示例1: common_install

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def common_install():
    """Returns the common houdini install parent directory based on the
    platform as well as the regex for the install name pattern."""
    plat = platform.platform(terse=True)

    if plat.startswith('Win'):
        install = WIN_DEFAULT
        regex = '^Houdini.*'      # Houdini 13.0.376

    elif plat.startswith('Dar'):
        install = OSX_DEFAULT
        regex = '^Houdini.*'      # Houdini 13.0.376

    elif plat.startswith('Lin'):
        install = LIN_DEFAULT
        regex = '^hfs.*'          # hfs13.0.376

    else:
        raise Exception('Unknown platform, cannot find Houdini.')

    return (os.path.normpath(install), regex) 
开发者ID:WhileRomeBurns,项目名称:VEX_Syntax,代码行数:23,代码来源:compile_and_run.py

示例2: saveErrorMessage

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def saveErrorMessage():
    """
    Simpan pesan error ke directory ``error`` *brutemap*
    """

    errMsg = "Running version: %s\n" % VERSION_STRING
    errMsg += "Python version: %s\n" % sys.version.split()[0]
    errMsg += "Operating system: %s\n" % platform.platform()
    errMsg += "Command line: %s\n" % re.sub(
        r".+?%s.py\b" % TOOL_NAME,
        "%s.py" % TOOL_NAME,
        " ".join(sys.argv)
    )
    errMsg += ("=" * get_terminal_size()[0]) + "\n"
    errMsg += getErrorMessage()
    filename = time.strftime("%d-%m-%Y_%X").replace(":", "-") + ".txt"
    filepath = os.path.join(DEFAULT.ERROR_DIRECTORY, filename)
    with open(filepath, "w") as fp:
        fp.write(errMsg)

    return filepath 
开发者ID:brutemap-dev,项目名称:brutemap,代码行数:23,代码来源:core.py

示例3: build_model_process

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def build_model_process(self):
        self.train_data,self.train_labels = self.input_data('train_data',200000)
        self.test_data,self.test_labels = self.input_data('test_data',40000)

        self.train_verification_model()
        print( self.train_correct3,'\n' , self.test_correct3 )
        print( self.train_final_score,'\n', self.test_final_score )
        
        self.show_train_history()
        os.chdir(PATH)
        if 'cnn_weight' not in os.listdir():
            os.makedirs('cnn_weight')
        if 'Windows' in platform.platform():
            self.model.save_weights('{}\\cnn_weight\\verificatioin_code.h5'.format(PATH))
        else:
            self.model.save_weights('{}/cnn_weight/verificatioin_code.h5'.format(PATH))
    #=============================================================== 
开发者ID:linsamtw,项目名称:TaiwanTrainVerificationCode2text,代码行数:19,代码来源:build_verification_code_cnn_model.py

示例4: library_extensions

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def library_extensions(self):
        c = customized_ccompiler()
        static_exts = []
        if c.compiler_type != 'msvc':
            # MSVC doesn't understand binutils
            static_exts.append('.a')
        if sys.platform == 'win32':
            static_exts.append('.lib')  # .lib is used by MSVC and others
        if self.search_static_first:
            exts = static_exts + [so_ext]
        else:
            exts = [so_ext] + static_exts
        if sys.platform == 'cygwin':
            exts.append('.dll.a')
        if sys.platform == 'darwin':
            exts.append('.dylib')
        return exts 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:19,代码来源:system_info.py

示例5: _find_lib

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def _find_lib(self, lib_dir, lib, exts):
        assert is_string(lib_dir)
        # under windows first try without 'lib' prefix
        if sys.platform == 'win32':
            lib_prefixes = ['', 'lib']
        else:
            lib_prefixes = ['lib']
        # for each library name, see if we can find a file for it.
        for ext in exts:
            for prefix in lib_prefixes:
                p = self.combine_paths(lib_dir, prefix + lib + ext)
                if p:
                    break
            if p:
                assert len(p) == 1
                # ??? splitext on p[0] would do this for cygwin
                # doesn't seem correct
                if ext == '.dll.a':
                    lib += '.dll'
                if ext == '.lib':
                    lib = prefix + lib
                return lib

        return False 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:26,代码来源:system_info.py

示例6: calc_info

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def calc_info(self):
        lib_dirs = self.get_lib_dirs()
        incl_dirs = self.get_include_dirs()
        mkl_libs = self.get_libs('mkl_libs', self._lib_mkl)
        info = self.check_libs2(lib_dirs, mkl_libs)
        if info is None:
            return
        dict_append(info,
                    define_macros=[('SCIPY_MKL_H', None),
                                   ('HAVE_CBLAS', None)],
                    include_dirs=incl_dirs)
        if sys.platform == 'win32':
            pass  # win32 has no pthread library
        else:
            dict_append(info, libraries=['pthread'])
        self.set_info(**info) 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:18,代码来源:system_info.py

示例7: OSinfo

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def OSinfo():
    '''操作系统基本信息查看'''
    core_number = psutil.cpu_count()
    cpu_number = psutil.cpu_count(logical=True)
    cpu_usage_precent = psutil.cpu_times_percent()
    mem_info = psutil.virtual_memory()
    result = {
        "memtotal": mem_info[0],
        "memavail": mem_info[1],
        "memprecn": mem_info[2],
        "memusage": mem_info[3],
        "memfreed": mem_info[4],
    }
    print '''
        内核版本 : %s
        CORE数量 : %s
        CPU数量 : %s
        CPU使用率 : %s
        内存总量  : %s
        内存使用率 : %s
    '''%(str(platform.platform()),str(core_number),str(cpu_number),str(cpu_usage_precent),str(mem_info[0]),str(mem_info[2])) 
开发者ID:cisp,项目名称:LinuxEmergency,代码行数:23,代码来源:emergency.py

示例8: greengrass_hello_world_run

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def greengrass_hello_world_run():
    try:
        if not my_platform:
            client.publish(
                topic="hello/world", queueFullPolicy="AllOrException", payload="Hello world! Sent from Greengrass Core."
            )
        else:
            client.publish(
                topic="hello/world",
                queueFullPolicy="AllOrException",
                payload="Hello world! Sent from " "Greengrass Core running on platform: {}".format(my_platform),
            )
    except Exception as e:
        logger.error("Failed to publish message: " + repr(e))

    # Asynchronously schedule this function to be run again in 5 seconds
    Timer(5, greengrass_hello_world_run).start()


# Start executing the function above 
开发者ID:aws,项目名称:aws-greengrass-core-sdk-python,代码行数:22,代码来源:greengrassHelloWorld.py

示例9: _request

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def _request(self, url_path, params=None):
        """
        Executes request

        Params
        ------
        :param string url_path: API method URI
        :param dict params: parameters

        :rtype: dict
        """
        if params is None:
            params = {}

        params.update({
            'key': self.api_key,
        })
        url = self.end_point+url_path

        headers = {'X-W3W-Wrapper': 'what3words-Python/{} (Python {}; {})'.format(__version__, platform.python_version(), platform.platform())}
        r = requests.get(url, params=params, headers=headers)
        response = r.text
        return json.loads(response) 
开发者ID:what3words,项目名称:w3w-python-wrapper,代码行数:25,代码来源:what3words.py

示例10: _find_lib

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def _find_lib(self, lib_dir, lib, exts):
        assert is_string(lib_dir)
        # under windows first try without 'lib' prefix
        if sys.platform == 'win32':
            lib_prefixes = ['', 'lib']
        else:
            lib_prefixes = ['lib']
        # for each library name, see if we can find a file for it.
        for ext in exts:
            for prefix in lib_prefixes:
                p = self.combine_paths(lib_dir, prefix + lib + ext)
                if p:
                    break
            if p:
                assert len(p) == 1
                # ??? splitext on p[0] would do this for cygwin
                # doesn't seem correct
                if ext == '.dll.a':
                    lib += '.dll'
                return lib

        return False 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:24,代码来源:system_info.py

示例11: calc_info

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def calc_info(self):
        lib_dirs = self.get_lib_dirs()
        blas_libs = self.get_libs('blas_libs', self._lib_names)
        info = self.check_libs(lib_dirs, blas_libs, [])
        if info is None:
            return
        if platform.system() == 'Windows':
            # The check for windows is needed because has_cblas uses the
            # same compiler that was used to compile Python and msvc is
            # often not installed when mingw is being used. This rough
            # treatment is not desirable, but windows is tricky.
            info['language'] = 'f77'  # XXX: is it generally true?
        else:
            lib = self.has_cblas(info)
            if lib is not None:
                info['language'] = 'c'
                info['libraries'] = [lib]
                info['define_macros'] = [('HAVE_CBLAS', None)]
        self.set_info(**info) 
开发者ID:ryfeus,项目名称:lambda-packs,代码行数:21,代码来源:system_info.py

示例12: print_support_info

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def print_support_info():
    click.echo('''
    If you are having issues with pyinfra or wish to make feature requests, please
    check out the GitHub issues at https://github.com/Fizzadar/pyinfra/issues .
    When adding an issue, be sure to include the following:
''')

    click.echo('    System: {0}'.format(platform.system()))
    click.echo('      Platform: {0}'.format(platform.platform()))
    click.echo('      Release: {0}'.format(platform.uname()[2]))
    click.echo('      Machine: {0}'.format(platform.uname()[4]))
    click.echo('    pyinfra: v{0}'.format(__version__))
    click.echo('    Executable: {0}'.format(sys.argv[0]))
    click.echo('    Python: {0} ({1}, {2})'.format(
        platform.python_version(),
        platform.python_implementation(),
        platform.python_compiler(),
    )) 
开发者ID:Fizzadar,项目名称:pyinfra,代码行数:20,代码来源:prints.py

示例13: initialize

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def initialize():
    global config, parser
    from .util.printing import BOLD, RED, ENDC
    config = AegeaConfig(__name__, use_yaml=True, save_on_exit=False)
    if not os.path.exists(config.config_files[2]):
        config_dir = os.path.dirname(os.path.abspath(config.config_files[2]))
        try:
            os.makedirs(config_dir)
        except OSError as e:
            if not (e.errno == errno.EEXIST and os.path.isdir(config_dir)):
                raise
        shutil.copy(os.path.join(os.path.dirname(__file__), "user_config.yml"), config.config_files[2])
        logger.info("Wrote new config file %s with default values", config.config_files[2])
        config = AegeaConfig(__name__, use_yaml=True, save_on_exit=False)

    parser = argparse.ArgumentParser(
        description="{}: {}".format(BOLD() + RED() + __name__.capitalize() + ENDC(), fill(__doc__.strip())),
        formatter_class=AegeaHelpFormatter
    )
    parser.add_argument("--version", action="version", version="%(prog)s {}\n{} {}\n{}".format(
        __version__,
        platform.python_implementation(),
        platform.python_version(),
        platform.platform()
    ))

    def help(args):
        parser.print_help()
    register_parser(help) 
开发者ID:kislyuk,项目名称:aegea,代码行数:31,代码来源:__init__.py

示例14: _build_headers

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def _build_headers(cls, api_key=None, method="get", **kwargs):

        # The SDK's user agent info
        user_agent = _UA

        # (Optionally) the client's user agent info
        app_str = ""
        if codepost.app_info:
            app_str = cls._format_app_info(**codepost.app_info)
            user_agent += " " + app_str

        # Diagnostic information
        diag = {
            "sdk": _CODEPOST_SDK_VERSION,
            "lang": "python",
            "publisher": "codepost",
            "lang_version": _PY_VERSION,
            "platform": _platform.platform(),
            "uname": _platform.uname(),
            "app": app_str,
        }

        headers = {
            "Authorization": "Token {}".format(api_key),
            "User-Agent": user_agent,
            "X-codePost-SDK-User-Agent": _json.dumps(diag)
        }

        if method.upper() in ["POST", "PATCH"] and not "Content-Type" in headers:
            headers["Content-Type"] = "application/json"

        if method.upper() == "POST":
            headers.setdefault("Idempotency-Key", str(_uuid.uuid4()))

        return headers 
开发者ID:codepost-io,项目名称:codepost-python,代码行数:37,代码来源:api_requestor.py

示例15: check_python

# 需要导入模块: import platform [as 别名]
# 或者: from platform import platform [as 别名]
def check_python():
    print('----------Python Info----------')
    print('Version      :', platform.python_version())
    print('Compiler     :', platform.python_compiler())
    print('Build        :', platform.python_build())
    print('Arch         :', platform.architecture()) 
开发者ID:awslabs,项目名称:dynamic-training-with-apache-mxnet-on-aws,代码行数:8,代码来源:diagnose.py


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