Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-10 08:38:58

0001 import json
0002 import os
0003 import sys
0004 
0005 from liveconfigparser.LiveConfigParser import LiveConfigParser, expand_values
0006 
0007 # get ConfigParser
0008 tmp_conf = LiveConfigParser()
0009 
0010 # read
0011 tmp_conf.read("panda_jedi.cfg")
0012 
0013 
0014 # dummy section class
0015 class _SectionClass:
0016     pass
0017 
0018 
0019 # load configmap
0020 config_map_data = {}
0021 if "PANDA_HOME" in os.environ:
0022     config_map_name = "panda_jedi_config.json"
0023     config_map_path = os.path.join(os.environ["PANDA_HOME"], "etc/config_json", config_map_name)
0024     if os.path.exists(config_map_path):
0025         with open(config_map_path) as f:
0026             config_map_data = json.load(f)
0027 
0028 # loop over all sections
0029 for tmp_section in tmp_conf.sections():
0030     # read section
0031     tmp_dict = getattr(tmp_conf, tmp_section)
0032     # load configmap
0033     if tmp_section in config_map_data:
0034         tmp_dict.update(config_map_data[tmp_section])
0035     # make section class
0036     tmp_self = _SectionClass()
0037     # update module dict
0038     sys.modules[__name__].__dict__[tmp_section] = tmp_self
0039     # expand all values
0040     expand_values(tmp_self, tmp_dict)