当前位置: 首页>>代码示例>>Python>>正文


Python Misc.str2bool方法代码示例

本文整理汇总了Python中misc.Misc.str2bool方法的典型用法代码示例。如果您正苦于以下问题:Python Misc.str2bool方法的具体用法?Python Misc.str2bool怎么用?Python Misc.str2bool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在misc.Misc的用法示例。


在下文中一共展示了Misc.str2bool方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create_method

# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import str2bool [as 别名]
 def create_method(self, restid, resourceid, method, authorizationtype, apikeyreq=False, further_opts=None):
     """
     This function creates a method object
     :param method: the method that is requested
     :type method: basestring
     :param restid: the id of the rest api object
     :type restid: basestring
     :param resourceid: id of a single resource object
     :type resourceid: basestring
     :param authorizationtype:
     :type authorizationtype: basestring
     :param apikeyreq: should apikey be required
     :type apikeyreq: bool
     :param further_opts: This opt passes in json_data fur not mandatory options
     :type further_opts: dict
     :return: the created method object
     """
     if self.dryrun:
         logger.info("Dryrun requested no changes will be done")
         return None
     if isinstance(apikeyreq, bool) is False:
         logger.debug("apikey is not boolean, converting")
         apikeyreq = Misc.str2bool(apikeyreq)
     opts = {'restApiId': restid, 'resourceId': resourceid, 'httpMethod': method,
             'authorizationType': authorizationtype, 'apiKeyRequired': apikeyreq}
     if 'requestParameters' in further_opts:
         opts['requestParameters'] = further_opts['requestParameters']
     if 'requestModels' in further_opts:
         opts['requestModels'] = further_opts['requestModels']
     logger.debug("The opts sent to create method %s" % opts)
     resp = self.apigateway_client.put_method(**opts)
     super(Apigateway, self).query_information(query=resp)
     return resp
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:35,代码来源:apigateway.py

示例2: test_str2bool_false

# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import str2bool [as 别名]
 def test_str2bool_false(self):
     self.assertFalse(Misc.str2bool("false"))
     self.assertFalse(Misc.str2bool("False"))
     self.assertFalse(Misc.str2bool("f"))
     self.assertFalse(Misc.str2bool("0"))
     self.assertFalse(Misc.str2bool("no"))
     self.assertFalse(Misc.str2bool("ILIKECARS"))
开发者ID:s4mur4i,项目名称:kerrigan,代码行数:9,代码来源:test_Misc.py

示例3: get_all_subnets

# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import str2bool [as 别名]
 def get_all_subnets(self, filters=None, subnetids=None):
     """
     This function returns all subnets, or filters them as requested
     :param filters: A dict list with the boto3 filters
     :param subnetids: A list of subnetids that should only be returned
     :return: A list of subnets that were requested
     """
     if subnetids:
         response = self.vpc_client.describe_subnets(SubnetIds=subnetids)
     elif filters:
         response = self.vpc_client.describe_subnets(Filters=filters)
     else:
         response = self.vpc_client.describe_subnets()
     result = []
     for s in response['Subnets']:
         allowed = Misc.get_value_from_array_hash(dictlist=s.get('Tags'), key="Allowed")
         if Misc.str2bool(allowed):
             result.append(s)
     logger.debug("Allowed az subnets are: %s" % (result,))
     return result
开发者ID:s4mur4i,项目名称:char-libv2,代码行数:22,代码来源:vpc.py

示例4: test_str2bool_true

# 需要导入模块: from misc import Misc [as 别名]
# 或者: from misc.Misc import str2bool [as 别名]
 def test_str2bool_true(self):
     self.assertTrue(Misc.str2bool("true"))
     self.assertTrue(Misc.str2bool("True"))
     self.assertTrue(Misc.str2bool("t"))
     self.assertTrue(Misc.str2bool("1"))
     self.assertTrue(Misc.str2bool("yes"))
开发者ID:s4mur4i,项目名称:kerrigan,代码行数:8,代码来源:test_Misc.py


注:本文中的misc.Misc.str2bool方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。