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