MCPcopy Index your code
hub / github.com/Tencent/CodeAnalysis / __init__

Method __init__

client/util/configlib.py:18–33  ·  view source on GitHub ↗

构造函数 :param cfg_string: ini格式的字符串 :param cfg_file: ini文件 :param interpolation: 变量解析方式,默认为None,不解析变量 :return:

(self, cfg_string=None, cfg_file=None, interpolation=None, encoding="utf-8-sig")

Source from the content-addressed store, hash-verified

16class ConfigReader(object):
17 """配置文件读取工具类"""
18 def __init__(self, cfg_string=None, cfg_file=None, interpolation=None, encoding="utf-8-sig"):
19 """
20 构造函数
21 :param cfg_string: ini格式的字符串
22 :param cfg_file: ini文件
23 :param interpolation: 变量解析方式,默认为None,不解析变量
24 :return:
25 """
26 self._cfg = configparser.ConfigParser(interpolation=interpolation)
27 self._cfg.optionxform = str # 设置key值区分大小写
28 self._cfg_string = cfg_string
29 self._cfg_file = cfg_file
30 if self._cfg_string:
31 self._cfg.read_string(self._cfg_string)
32 else:
33 self._cfg.read(self._cfg_file, encoding=encoding)
34
35 def read(self, section_name):
36 """

Callers

nothing calls this directly

Calls 1

readMethod · 0.45

Tested by

no test coverage detected