def load_methods(self, module, user_modules):
if not self.module_class:<EOL><INDENT>if self.module_name in user_modules:<EOL><INDENT>include_path, f_name = user_modules[self.module_name]<EOL>module_path = os.path.join(include_path, f_name)<EOL>self._py3_wrapper.log(<EOL>'<STR_LIT>'.format(module, module_path)<EOL>)<EOL>self.module_class = self.load_from_file(module_path)<EOL><DEDENT>else:<EOL><INDENT>self._py3_wrapper.log(<EOL>'<STR_LIT>'.format(<EOL>module, self.module_name<EOL>)<EOL>)<EOL>self.module_class = self.load_from_namespace(self.module_name)<EOL><DEDENT><DEDENT>class_inst = self.module_class<EOL>if class_inst:<EOL><INDENT>try:<EOL><INDENT>if class_inst.Meta.container:<EOL><INDENT>class_inst.items = []<EOL><DEDENT><DEDENT>except AttributeError:<EOL><INDENT>pass<EOL><DEDENT>mod_config = self.config["<STR_LIT>"].get(module, {})<EOL>try:<EOL><INDENT>deprecated = class_inst.Meta.deprecated<EOL><DEDENT>except AttributeError:<EOL><INDENT>deprecated = None<EOL><DEDENT>if deprecated:<EOL><INDENT>def deprecation_log(item):<EOL><INDENT>if "<STR_LIT>" in item:<EOL><INDENT>msg = item["<STR_LIT>"]<EOL>param = item.get("<STR_LIT>")<EOL>if param:<EOL><INDENT>msg = "<STR_LIT>".format(param, msg)<EOL><DEDENT>msg = "<STR_LIT>".format(<EOL>self.module_full_name, msg<EOL>)<EOL>self._py3_wrapper.log(msg)<EOL><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>param = item["<STR_LIT>"]<EOL>new_name = item["<STR_LIT>"]<EOL>if param in mod_config:<EOL><INDENT>if new_name not in mod_config:<EOL><INDENT>mod_config[new_name] = mod_config[param]<EOL>del mod_config[param]<EOL><DEDENT>deprecation_log(item)<EOL><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>param = item["<STR_LIT>"]<EOL>placeholder = item["<STR_LIT>"]<EOL>if "<STR_LIT:{}>" in mod_config.get(param, "<STR_LIT>"):<EOL><INDENT>mod_config[param] = mod_config[param].replace(<EOL>"<STR_LIT:{}>", "<STR_LIT>" % placeholder<EOL>)<EOL>deprecation_log(item)<EOL><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>placeholders = {}<EOL>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>placeholders[item["<STR_LIT>"]] = item["<STR_LIT>"]<EOL>format_strings = item["<STR_LIT>"]<EOL>for format_param in format_strings:<EOL><INDENT>format_string = mod_config.get(format_param)<EOL>if not format_string:<EOL><INDENT>continue<EOL><DEDENT>format = Formatter().update_placeholders(<EOL>format_string, placeholders<EOL>)<EOL>mod_config[format_param] = format<EOL><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>placeholder_formats = item.get("<STR_LIT>", {})<EOL>if "<STR_LIT>" in item:<EOL><INDENT>placeholder_formats.update(item["<STR_LIT>"](mod_config))<EOL><DEDENT>format_strings = item["<STR_LIT>"]<EOL>for format_param in format_strings:<EOL><INDENT>format_string = mod_config.get(format_param)<EOL>if not format_string:<EOL><INDENT>continue<EOL><DEDENT>format = Formatter().update_placeholder_formats(<EOL>format_string, placeholder_formats<EOL>)<EOL>mod_config[format_param] = format<EOL><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>param = item["<STR_LIT>"]<EOL>value = item["<STR_LIT:value>"]<EOL>substitute = item["<STR_LIT>"]<EOL>substitute_param = substitute["<STR_LIT>"]<EOL>substitute_value = substitute["<STR_LIT:value>"]<EOL>if (<EOL>mod_config.get(param) == value<EOL>and substitute_param not in mod_config<EOL>):<EOL><INDENT>mod_config[substitute_param] = substitute_value<EOL>deprecation_log(item)<EOL><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>updates = item["<STR_LIT>"](mod_config)<EOL>for name, value in updates.items():<EOL><INDENT>if name not in mod_config:<EOL><INDENT>mod_config[name] = value<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if "<STR_LIT>" in deprecated:<EOL><INDENT>for item in deprecated["<STR_LIT>"]:<EOL><INDENT>param = item["<STR_LIT>"]<EOL>if param in mod_config:<EOL><INDENT>del mod_config[param]<EOL>deprecation_log(item)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>for config, value in mod_config.items():<EOL><INDENT>if not config.startswith("<STR_LIT:.>"):<EOL><INDENT>setattr(self.module_class, config, value)<EOL><DEDENT><DEDENT>try:<EOL><INDENT>update_config = class_inst.Meta.update_config<EOL><DEDENT>except AttributeError:<EOL><INDENT>update_config = None<EOL><DEDENT>if update_config:<EOL><INDENT>if "<STR_LIT>" in update_config:<EOL><INDENT>for item in update_config["<STR_LIT>"]:<EOL><INDENT>placeholder_formats = item.get("<STR_LIT>", {})<EOL>format_strings = item["<STR_LIT>"]<EOL>for format_param in format_strings:<EOL><INDENT>format_string = getattr(class_inst, format_param, None)<EOL>if not format_string:<EOL><INDENT>continue<EOL><DEDENT>format = Formatter().update_placeholder_formats(<EOL>format_string, placeholder_formats<EOL>)<EOL>setattr(class_inst, format_param, format)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if not hasattr(self.module_class, "<STR_LIT>"):<EOL><INDENT>setattr(self.module_class, "<STR_LIT>", Py3(self))<EOL><DEDENT>for param in dir(self.module_class):<EOL><INDENT>if param.startswith("<STR_LIT>"):<EOL><INDENT>trigger_action = getattr(self.module_class, param)<EOL>self.add_udev_trigger(trigger_action, param[<NUM_LIT:8>:])<EOL><DEDENT><DEDENT>fn = self._py3_wrapper.get_config_attribute<EOL>param = fn(self.module_full_name, "<STR_LIT>")<EOL>if hasattr(param, "<STR_LIT>"):<EOL><INDENT>param = True<EOL><DEDENT>self.allow_urgent = param<EOL>urgent_background = fn(self.module_full_name, "<STR_LIT>")<EOL>if not hasattr(urgent_background, "<STR_LIT>"):<EOL><INDENT>color = self.module_class.py3._get_color(urgent_background)<EOL>if not color:<EOL><INDENT>err = "<STR_LIT>"<EOL>err += "<STR_LIT>".format(urgent_background)<EOL>raise ValueError(err)<EOL><DEDENT>self.i3bar_gaps_urgent_options["<STR_LIT>"] = color<EOL><DEDENT>urgent_foreground = fn(self.module_full_name, "<STR_LIT>")<EOL>if not hasattr(urgent_foreground, "<STR_LIT>"):<EOL><INDENT>color = self.module_class.py3._get_color(urgent_foreground)<EOL>if not color:<EOL><INDENT>err = "<STR_LIT>"<EOL>err += "<STR_LIT>".format(urgent_foreground)<EOL>raise ValueError(err)<EOL><DEDENT>self.i3bar_gaps_urgent_options["<STR_LIT>"] = color<EOL><DEDENT>urgent_border = fn(self.module_full_name, "<STR_LIT>")<EOL>if not hasattr(urgent_border, "<STR_LIT>"):<EOL><INDENT>color = self.module_class.py3._get_color(urgent_border)<EOL>if not color:<EOL><INDENT>err = "<STR_LIT>"<EOL>err += "<STR_LIT>".format(urgent_border)<EOL>raise ValueError(err)<EOL><DEDENT>self.i3bar_gaps_urgent_options["<STR_LIT>"] = color<EOL>urgent_borders = ["<STR_LIT>", "<STR_LIT:right>", "<STR_LIT>", "<STR_LIT:left>"]<EOL>for name in ["<STR_LIT>" + x for x in urgent_borders]:<EOL><INDENT>param = fn(self.module_full_name, name)<EOL>if hasattr(param, "<STR_LIT>"):<EOL><INDENT>param = <NUM_LIT:1><EOL><DEDENT>elif not isinstance(param, int):<EOL><INDENT>err = "<STR_LIT>".format(name)<EOL>err += "<STR_LIT>"<EOL>err += "<STR_LIT>".format(param)<EOL>raise TypeError(err)<EOL><DEDENT>self.i3bar_gaps_urgent_options[name[<NUM_LIT:7>:]] = param<EOL><DEDENT><DEDENT>for method in sorted(dir(class_inst)):<EOL><INDENT>if method.startswith("<STR_LIT:_>"):<EOL><INDENT>continue<EOL><DEDENT>else:<EOL><INDENT>m_type = type(getattr(class_inst, method))<EOL>if "<STR_LIT>" in str(m_type):<EOL><INDENT>params_type = self._params_type(method, class_inst)<EOL>if method == "<STR_LIT>":<EOL><INDENT>self.click_events = params_type<EOL><DEDENT>elif method == "<STR_LIT>":<EOL><INDENT>self.has_kill = params_type<EOL><DEDENT>elif method == "<STR_LIT>":<EOL><INDENT>self.has_post_config_hook = True<EOL><DEDENT>else:<EOL><INDENT>method_obj = {<EOL>"<STR_LIT>": time(),<EOL>"<STR_LIT>": params_type,<EOL>"<STR_LIT>": None,<EOL>"<STR_LIT>": {"<STR_LIT:name>": method, "<STR_LIT>": "<STR_LIT>"},<EOL>"<STR_LIT>": method,<EOL>"<STR_LIT:name>": None,<EOL>}<EOL>self.methods[method] = method_obj<EOL><DEDENT><DEDENT><DEDENT><DEDENT><DEDENT>if self.config["<STR_LIT>"]:<EOL><INDENT>self._py3_wrapper.log(<EOL>'<STR_LIT>'.format(<EOL>module, self.click_events, self.has_kill, self.methods.keys()<EOL>)<EOL>)<EOL><DEDENT>
Read the given user-written py3status class file and store its methods.
Those methods will be executed, so we will deliberately ignore:
    - private methods starting with _
    - decorated methods such as @property or @staticmethod
    - 'on_click' methods as they'll be called upon a click_event
    - 'kill' methods as they'll be called upon this thread's exit