Пример #1
0
    def __init__(self, config=None):
        """
        :param config: The path to the config file of Michael, must be a JSON or YML
        """
        # Initialize Logger
        LogFile("loggerConfig.yml")
        self.start_time = time.time()
        self.processed_messages = 0
        self.config_path = config
        self.log = logging.getLogger("{} notes".format("Bot Logger"))
        self.config = {}
        self.args = parse_args()
        self.bot = None
        self.updater = None
        self.dispatcher = None
        self.quit = False
        self.intruders = {} # List of all false ID messages
        self.blocked_user_ID = []
        self.Server = None
        self.Client = None
        self.newUserrequests = {} # Here all new user requests are stored as long as they are not processed


        # Do something
        self.log.info("Loading config file...")
        self._load_config()
        self.SuperUser = self.config["SuperUser"][0]
        self.name = self.config.get("Name", "Michael")
        self.log.info("Connecting to the Bothfather for guidance...")
        self._init_connection_to_Bot()
        self.log.info("Start listening carefully to the Botfather...")
Пример #2
0
    def __init__(self, configs=None):
        """Configs must be a list representation of valid args!"""

        self.data = {}
        self.rootdir = Path(__file__).parent.resolve()
        self.plotObjects = []
        self.backend = None

        # Initialize a logfile class
        self.logFile = LogFile(path="LogFiles\LoggerConfig.yml")

        self.log = logging.getLogger("mainPlotting")

        # Get the args parsed to this script if necessary
        if not configs:
            self.args = parse_args()
            self.log.critical("Arguments parsed: {}".format(self.args))
        else:
            self.args = parse_args(configs)
            self.log.critical("Arguments parsed: {}".format(self.args))

        # Load the config to a dictionary
        self.log.critical("Loading config file: {}".format(self.args.file))
        self.config = load_yaml(self.args.file)

        # Define backend for plotting
        self.backend = self.config.get("backend", "bokeh")
        hv.extension(self.backend)
        self.log.info("Plotting backend is {}".format(self.backend))

        self.log.critical("Loading data files...")
        self.data, load_order = read_in_files(self.config["Files"],
                                              self.config)
        self.config[
            "file_order"] = load_order  # To keep easy track of the names and not the pathes

        if not load_order:
            self.log.error("No data files could be loaded!")
        else:
            self.log.critical("Loading data files completed.")

        # Loading measurement plugins
        self.log.critical("Loading plot modules...")
        self.plugins = load_plugins(self.config, self.rootdir)