def setUp(self): injection.configure() settings.using({ 'log_to_console': True, 'single_light_discover': True, 'use_fakes': True }).configure() self._group0 = 'Group 0' self._group1 = 'Group 1' self._group2 = 'Group 2' self._location0 = 'Location 0' self._location1 = 'Location 1' self._location2 = 'Location 2' self._light0 = 'Light 0' self._light1 = 'Light 1' self._light2 = 'Light 2' self._light3 = 'Light 3' self._color = [1, 2, 3, 4] fake_lifx.using([ (self._light0, self._group0, self._location0, self._color, False), (self._light1, self._group0, self._location1, self._color, False), (self._light2, self._group1, self._location0, self._color, False), (self._light3, self._group1, self._location1, self._color, False) ]).configure() light_set.configure()
def configure(): injection.configure() settings.using({ 'log_level': logging.ERROR, 'log_to_console': True, 'single_light_discover': True, 'use_fakes': True }).configure() log_config.configure() fake_clock.configure() fake_lifx.configure() light_set.configure()
def main(): parser = argparse.ArgumentParser() parser.add_argument('-l', '--list', help='output instruction list', action='store_true') parser.add_argument('-d', '--dict', help='output dictionary format', action='store_true') parser.add_argument('-f', '--use-fakes', help='use fake lights', action='store_true') arg_helper.add_n_argument(parser) parser.add_argument('-p', '--py', help='output Python code', action='store_true') parser.add_argument('-s', '--script', help='output script format', action='store_true') parser.add_argument('-t', '--text', help='output text format', action='store_true') args = parser.parse_args() do_script = args.script do_dict = args.dict do_list = args.list do_py = args.py do_text = args.text or (not (do_py or do_script or do_dict or do_list)) injection.configure() settings_init = settings.using(config_values.functional).add_overrides( {'single_light_discover': True}) settings_init.apply_env() if args.use_fakes: settings_init.add_overrides({'use_fakes': True}) n_arg = arg_helper.get_overrides(args) if n_arg is not None: settings_init.add_overrides(n_arg) settings_init.configure() light_module.configure() if do_dict: _do_gen(DictSnapshot) if do_list: _do_gen(InstructionSnapshot) if do_script: _do_gen(ScriptSnapshot) if do_text: _do_gen(TextSnapshot) if do_py: snap = InstructionSnapshot() text = ' OpCode.MOVEQ, UnitMode.RAW, Register.UNIT_MODE,\n' text += snap.generate().text lsc.output_python(lsc.program_code(text))
def main(): injection.configure() ap = argparse.ArgumentParser() ap.add_argument('-v', '--verbose', help='do debug-level logging', action='store_true') ap.add_argument('-f', '--fakes', help='use fake lights', action='store_true') arg_helper.add_n_argument(ap) args = ap.parse_args() overrides = {'sleep_time': 0.1} if args.verbose: overrides['log_level'] = logging.DEBUG overrides['log_to_console'] = True if args.fakes: overrides['use_fakes'] = True n_arg = arg_helper.get_overrides(args) if n_arg is not None and not args.fakes: overrides.update(n_arg) settings_init = settings.using(config_values.functional) settings_init.add_overrides(overrides).configure() light_module.configure() machine.Machine().run(build_instructions())
def configure(): injection.configure() settings_init = settings.using(config_values.functional) settings_init.add_overrides({'log_to_console': False}) ini = os.getenv('BARDOLPH_INI') if ini: settings_init.apply_file(ini) settings_init.configure() light_module.configure() injection.bind_instance(web_app.WebApp()).to(i_web.WebApp)
def configure(): injection.configure() settings.using(config_values.functional).apply_env().configure() light_module.configure()
def test_apply_file(self): settings.using(base).apply_file('tests/test_apply_file.ini').configure() s = settings.Settings() self.assertEqual('11', s.get_value('one')) self.assertEqual('22', s.get_value('two'))
def test_override(self): settings.using(base).add_overrides(override).configure() s = settings.Settings() self.assertEqual(1, s.get_value('one')) self.assertEqual(22, s.get_value('two')) self.assertEqual(4, s.get_value('four'))
def test_base(self): settings.using(base).configure() s = settings.Settings() self.assertEqual(1, s.get_value('one')) self.assertEqual(2, s.get_value('two'))
def setUp(self): injection.configure() settings.using(_log_settings).configure()
def setUp(self): injection.configure() settings.using({'manifest_name': None}).configure()
def setUp(self): injection.configure() self._precision = 0.1 settings.using({'sleep_time': self._precision}).configure()