本文整理汇总了Python中misc.Misc.random3digit方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.random3digit方法的具体用法?Python Misc.random3digit怎么用?Python Misc.random3digit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc.Misc
的用法示例。
在下文中一共展示了Misc.random3digit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: generate_ec2_unique_name
# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import random3digit [as 别名]
def generate_ec2_unique_name(self, env, puppet_role, num):
"""
This function generates x number of unique ec2 instance names
:param env: Which environment should the names be generated to
:param puppet_role: What is the puppet_role being used
:param num: How many name should be generated
:return: An array of of names generated
"""
ret = []
for i in range(num):
name = None
logger.debug("Arguments are: env: %s, puppet_role: %s" % (env, puppet_role))
while name is None:
name = env + '-' + puppet_role + '-' + Misc.random3digit()
name = self.ec2_instance_name_exist(name=name)
logger.info("Generated instance name is %s" % (name,))
if name and name not in ret:
ret.append(name)
else:
name = None
return ret
示例2: test_random3digit
# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import random3digit [as 别名]
def test_random3digit(self):
random = Misc.random3digit()
self.assertRegexpMatches(random,"\d{1,3}")