本文整理匯總了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)