def main(args): global alarm, interface_manager time.tzset() if "config" in args and args.config is not None: import os config_file = os.path.abspath(args.config) cfg.load(config_file) else: cfg.load() config_logger(logger) logger.info(f"Starting Paradox Alarm Interface {VERSION}") logger.info(f"Config loaded from {cfg.CONFIG_FILE_LOCATION}") logger.info(f"Console Log level set to {cfg.LOGGING_LEVEL_CONSOLE}") # Registering additional encodings register_encodings() # Start interacting with the alarm alarm = Paradox() loop = asyncio.get_event_loop() for signame in ("SIGINT", "SIGTERM"): sig = getattr(signal, signame) loop.add_signal_handler( sig, lambda: asyncio.ensure_future(exit_handler(signame))) interface_manager = InterfaceManager(alarm, config=cfg) interface_manager.start() loop = asyncio.get_event_loop() loop.run_until_complete(run_loop()) sys.exit(0)
import pytest from paradox.lib.encodings import en, register_encodings, ru register_encodings() test_data_en = [ (b"B", "B"), (b"0", "0"), (b"z", "z"), (bytes([131]), "Ü"), (bytes([142]), "ö"), (bytes([148]), "ê"), (bytes([151]), "ë"), (bytes([153]), "Ä"), (bytes([158]), "ä"), (bytes([159]), "A"), (bytes([161]), "Î"), (bytes([162]), "Ì"), (bytes([163]), "Í"), (bytes([164]), "Ï"), (bytes([177]), "±"), (bytes([183]), "£"), (bytes([185]), "⤈"), (bytes([186]), "⤉"), (bytes([206]), "Õ"), (bytes([207]), "õ"), ] @pytest.mark.parametrize("raw,expected", test_data_en)