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


Python importlib_metadata.version方法代碼示例

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


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

示例1: determine_prefix

# 需要導入模塊: import importlib_metadata [as 別名]
# 或者: from importlib_metadata import version [as 別名]
def determine_prefix():
    """Placeholder docstring"""
    prefix = "AWS-SageMaker-Python-SDK/{} Python/{} {}/{} Boto3/{} Botocore/{}".format(
        SDK_VERSION, PYTHON_VERSION, OS_NAME, OS_VERSION, boto3.__version__, botocore.__version__
    )

    try:
        with open("/etc/opt/ml/sagemaker-notebook-instance-version.txt") as sagemaker_nbi_file:
            prefix = "AWS-SageMaker-Notebook-Instance/{} {}".format(
                sagemaker_nbi_file.read().strip(), prefix
            )
    except IOError:
        # This file isn't expected to always exist, and we DO want to silently ignore failures.
        pass

    return prefix 
開發者ID:aws,項目名稱:sagemaker-python-sdk,代碼行數:18,代碼來源:user_agent.py

示例2: main

# 需要導入模塊: import importlib_metadata [as 別名]
# 或者: from importlib_metadata import version [as 別名]
def main() -> None:
    args = _options.options.parse_args()

    if args.help:
        _options.options.print_help()
        return

    if args.version:
        print(metadata.version("nox"), file=sys.stderr)
        return

    setup_logging(
        color=args.color, verbose=args.verbose, add_timestamp=args.add_timestamp
    )

    # Execute the appropriate tasks.
    exit_code = workflow.execute(
        global_config=args,
        workflow=(
            tasks.load_nox_module,
            tasks.merge_noxfile_options,
            tasks.discover_manifest,
            tasks.filter_manifest,
            tasks.honor_list_request,
            tasks.verify_manifest_nonempty,
            tasks.run_manifest,
            tasks.print_summary,
            tasks.create_report,
            tasks.final_reduce,
        ),
    )

    # Done; exit.
    sys.exit(exit_code) 
開發者ID:theacodes,項目名稱:nox,代碼行數:36,代碼來源:__main__.py

示例3: test_main_version

# 需要導入模塊: import importlib_metadata [as 別名]
# 或者: from importlib_metadata import version [as 別名]
def test_main_version(capsys, monkeypatch):
    monkeypatch.setattr(sys, "argv", [sys.executable, "--version"])

    with contexter.ExitStack() as stack:
        execute = stack.enter_context(mock.patch("nox.workflow.execute"))
        exit_mock = stack.enter_context(mock.patch("sys.exit"))
        nox.__main__.main()
        _, err = capsys.readouterr()
        assert VERSION in err
        exit_mock.assert_not_called()
        execute.assert_not_called() 
開發者ID:theacodes,項目名稱:nox,代碼行數:13,代碼來源:test_main.py

示例4: version

# 需要導入模塊: import importlib_metadata [as 別名]
# 或者: from importlib_metadata import version [as 別名]
def version(self, server=""):
        """Send a VERSION command."""
        self.send_items('VERSION', server) 
開發者ID:jaraco,項目名稱:irc,代碼行數:5,代碼來源:client.py


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