__init__
PYL-W020146 except ValueError:
47 logger.info("Try Shadowsocks Clash Parser.")
48 pssc = ParserShadowsocksClash(self._get_shadowsocks_base_config())
49 self._config_list = pssc.parse_subs_config(res)50 logger.info(f"Read {len(self._config_list)} node(s).")
51
52 def read_gui_config(self, filename: str):
27 if res[:6] == "ssd://":
28 logger.info("Try ShadowsocksD Parser.")
29 pssd = ParserShadowsocksD(self._get_shadowsocks_base_config())
30 self._config_list = pssd.parse_subs_config(31 b64plus.decode(res[6:]).decode("utf-8")
32 )
33 else:
62 logger.info("Not Clash Configs.")
63 cfg = []
64 logger.critical("Unsupported config file.")
65 self._config_list = cfg66 logger.info(f"Read {len(self._config_list)} node(s).")
42 pssip002 = ParserShadowsocksSIP002(
43 self._get_shadowsocks_base_config()
44 )
45 self._config_list = pssip002.parse_subs_config(links_arr)46 except ValueError:
47 logger.info("Try Shadowsocks Clash Parser.")
48 pssc = ParserShadowsocksClash(self._get_shadowsocks_base_config())
36 links_arr = (b64plus.decode(res).decode("utf-8")).split("\n")
37 try:
38 pssb = ParserShadowsocksBasic(self._get_shadowsocks_base_config())
39 self._config_list = pssb.parse_subs_config(links_arr)40 except ValueError:
41 logger.info("Try Shadowsocks SIP002 Parser.")
42 pssip002 = ParserShadowsocksSIP002(
Defining an instance attribute outside __init__
affects the readability of code. It is expected to find all the attributes an instance may have by reading its __init__
method. If there is a need to initialize attribute via sub-initialization methods, it is recommended to assign attributes to None
in the init then call the sub-initialization methods.