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


Python datatypes.boolean函数代码示例

本文整理汇总了Python中supervisor.datatypes.boolean函数的典型用法代码示例。如果您正苦于以下问题:Python boolean函数的具体用法?Python boolean怎么用?Python boolean使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: server_configs_from_parser

 def server_configs_from_parser(self, parser):
     """ The following has nothing to deal with Supervisor's server configurations.
     It gets Supvisors configuration.
     Supervisor's ServerOptions has not been designed to be specialized.
     This method is overriden just to have an access point to the Supervisor parser. """
     configs = ServerOptions.server_configs_from_parser(self, parser)
     # set section
     if not parser.has_section(SupvisorsServerOptions._Section):
         raise ValueError('.ini file ({}) does not include a [{}] section'.format(self.configfile, self._Section))
     temp, parser.mysection = parser.mysection, self._Section
     # get values
     opt = self.supvisors_options
     opt.address_list = list(OrderedDict.fromkeys(filter(None, list_of_strings(parser.getdefault('address_list', gethostname())))))
     opt.rules_file = parser.getdefault('rules_file', None)
     if opt.rules_file:
         opt.rules_file = existing_dirpath(opt.rules_file)
     opt.internal_port = self.to_port_num(parser.getdefault('internal_port', '65001'))
     opt.event_port = self.to_port_num(parser.getdefault('event_port', '65002'))
     opt.auto_fence = boolean(parser.getdefault('auto_fence', 'false'))
     opt.synchro_timeout = self.to_timeout(parser.getdefault('synchro_timeout', '15'))
     opt.conciliation_strategy = self.to_conciliation_strategy(parser.getdefault('conciliation_strategy', 'USER'))
     opt.starting_strategy = self.to_starting_strategy(parser.getdefault('starting_strategy', 'CONFIG'))
     # configure statistics
     opt.stats_periods = self.to_periods(list_of_strings(parser.getdefault('stats_periods', '10')))
     opt.stats_histo = self.to_histo(parser.getdefault('stats_histo', 200))
     opt.stats_irix_mode = boolean(parser.getdefault('stats_irix_mode', 'false'))
     # configure logger
     opt.logfile = existing_dirpath(parser.getdefault('logfile', '{}.log'.format(SupvisorsServerOptions._Section)))
     opt.logfile_maxbytes = byte_size(parser.getdefault('logfile_maxbytes', '50MB'))
     opt.logfile_backups = integer(parser.getdefault('logfile_backups', 10))
     opt.loglevel = logging_level(parser.getdefault('loglevel', 'info'))
     # reset mysection and return original result
     parser.mysection = temp
     return configs
开发者ID:julien6387,项目名称:supervisors,代码行数:34,代码来源:options.py

示例2: load_process_rules

 def load_process_rules(self, process):
     self.logger.trace('searching program element for {}'.format(process.namespec()))
     program_elt = self.get_program_element(process)
     rules = process.rules
     if program_elt is not None:
         # get addresses rule
         self.get_program_addresses(program_elt, rules)
         # get start_sequence rule
         value = program_elt.findtext('start_sequence')
         try:
             rules.start_sequence = int(value)
             if rules.start_sequence < 0:
                 raise
         except:
             rules.start_sequence = 0
         # get stop_sequence rule
         value = program_elt.findtext('stop_sequence')
         try:
             rules.stop_sequence = int(value)
             if rules.stop_sequence < 0:
                 raise
         except:
             rules.stop_sequence = 0
         # get required rule
         value = program_elt.findtext('required')
         try:
             rules.required = boolean(value)
         except:
             rules.required = False
         # get wait_exit rule
         value = program_elt.findtext('wait_exit')
         try:
             rules.wait_exit = boolean(value)
         except:
             rules.wait_exit = False
         # get expected_loading rule
         value = program_elt.findtext('expected_loading')
         try:
             rules.expected_loading = int(value)
             if not 0 <= rules.expected_loading <= 100:
                 raise
         except:
             rules.expected_loading = 1
         # get running_failure_strategy rule
         value = program_elt.findtext('running_failure_strategy')
         if value:
             strategy = RunningFailureStrategies._from_string(value)
             if strategy:
                 rules.running_failure_strategy = strategy
         # check that rules are compliant with dependencies
         rules.check_dependencies(process.namespec())
         self.logger.debug('process {} - rules {}'.format(process.namespec(), rules))
开发者ID:julien6387,项目名称:supervisors,代码行数:52,代码来源:sparser.py

示例3: test_boolean_returns_false_for_upper_falsy_values

 def test_boolean_returns_false_for_upper_falsy_values(self):
     for s in map(str.upper, datatypes.FALSY_STRINGS):
         actual = datatypes.boolean(s)
         self.assertEqual(actual, False)
开发者ID:hellhovnd,项目名称:supervisor,代码行数:4,代码来源:test_datatypes.py

示例4: test_boolean_returns_true_for_upper_truthy_values

 def test_boolean_returns_true_for_upper_truthy_values(self):
     for s in map(str.upper, datatypes.TRUTHY_STRINGS):
         actual = datatypes.boolean(s)
         self.assert_(actual, True)
开发者ID:hellhovnd,项目名称:supervisor,代码行数:4,代码来源:test_datatypes.py

示例5: test_boolean_returns_true_for_truthy_values

 def test_boolean_returns_true_for_truthy_values(self):
     for s in datatypes.TRUTHY_STRINGS:
         actual = datatypes.boolean(s)
         self.assertEqual(actual, True)
开发者ID:hellhovnd,项目名称:supervisor,代码行数:4,代码来源:test_datatypes.py

示例6: _callFUT

 def _callFUT(self, arg):
     return datatypes.boolean(arg)
开发者ID:Girgitt,项目名称:supervisor,代码行数:2,代码来源:test_datatypes.py

示例7: authorization

 def authorization(self, data):
     """ Extract authorization and address from data and process event. """
     self.logger.trace('got authorization event: {}'.format(data))
     # split the line received
     address_name, authorized = tuple(x.split(':')[1] for x in data.split())
     self.fsm.on_authorization(address_name, boolean(authorized))
开发者ID:julien6387,项目名称:supervisors,代码行数:6,代码来源:listener.py


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