本文整理匯總了Python中sys.version_info.minor方法的典型用法代碼示例。如果您正苦於以下問題:Python version_info.minor方法的具體用法?Python version_info.minor怎麽用?Python version_info.minor使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sys.version_info
的用法示例。
在下文中一共展示了version_info.minor方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _verify_python_version
# 需要導入模塊: from sys import version_info [as 別名]
# 或者: from sys.version_info import minor [as 別名]
def _verify_python_version(self, key, cafile, capath, cahostverify):
python_version_cur = ".".join([str(version_info.major),
str(version_info.minor),
str(version_info.micro)])
python_version_min = "2.7.9"
if StrictVersion(python_version_cur) < StrictVersion(python_version_min):
if cafile or capath:
raise AnsibleError('Unable to read %s from vault:'
' Using Python %s, and vault lookup plugin requires at least %s'
' to use an SSL context (VAULT_CACERT or VAULT_CAPATH)'
% (key, python_version_cur, python_version_min))
elif cahostverify:
raise AnsibleError('Unable to read %s from vault:'
' Using Python %s, and vault lookup plugin requires at least %s'
' to verify Vault certificate. (set VAULT_CAHOSTVERIFY to \'%s\''
' to disable certificate verification.)'
% (key, python_version_cur, python_version_min, DISABLE_VAULT_CAHOSTVERIFY))
示例2: _cli_print_version
# 需要導入模塊: from sys import version_info [as 別名]
# 或者: from sys.version_info import minor [as 別名]
def _cli_print_version(ctx: Context, _: Any, value: Any) -> None: # pragma: no cover
if not value or ctx.resilient_parsing:
return
location = dirname(__file__)
echo(f'{__version} from {location} (python {version_info.major}.{version_info.minor})')
ctx.exit()
示例3: test_wrong_initialisation
# 需要導入模塊: from sys import version_info [as 別名]
# 或者: from sys.version_info import minor [as 別名]
def test_wrong_initialisation(self):
if version_info.minor < 6:
self.submission_queue = mp.Queue(-1)
logger, listener, logging_queue = self.create_logger("test_wrong_initialisation", simple=False)
else:
logger, listener, logging_queue = self.create_logger("test_wrong_initialisation", simple=True)
kwds = {"batch_file": tempfile.mkstemp(),
"logging_queue": logging_queue,
"identifier": 0,
"shelve_stacks": [tempfile.mkstemp()],
"fasta_out": self.fasta_out,
"gtf_out": self.gtf_out,
"tmpdir": tempfile.gettempdir(),
"fasta": self.fasta,
"seed": None,
"log_level": "WARNING"
}
for key in ["batch_file", "logging_queue", "identifier", "lenient"]:
with self.subTest(key=key):
_kwds = kwds.copy()
_kwds[key] = None
if "queue" in key:
error = TypeError
else:
error = ValueError
with self.assertRaises(error):
checking.CheckingProcess(**_kwds)
with self.subTest(key="fasta"):
_kwds = kwds.copy()
_kwds["fasta"] = None
with self.assertRaises((AttributeError, TypeError)):
checking.CheckingProcess(**_kwds)
for tentative in [None, [], [("A", "G")], [("AG", bytes("GT", encoding="ascii"))]]:
with self.subTest(tentative=tentative):
_kwds = kwds.copy()
_kwds["canonical_splices"] = tentative
if tentative is None:
with self.assertRaises(TypeError):
checking.CheckingProcess(**_kwds)
else:
with self.assertRaises(ValueError):
checking.CheckingProcess(**_kwds)
_kwds = kwds.copy()
_kwds["canonical_splices"] = [("AG", "GT")]
# just test it does not raise
_ = checking.CheckingProcess(**_kwds)