MCPcopy Create free account
hub / github.com/EasyIME/PIME / load

Method load

python/cinbase/config.py:105–123  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

103 return self._lastTime
104
105 def load(self):
106 filename = self.getConfigFile()
107 try:
108 if not os.path.exists(filename) or os.stat(filename).st_size == 0:
109 filename = os.path.join(os.path.expanduser("~"), "PIME", self.imeDirName, "config.json")
110
111 if not os.path.exists(filename) or os.stat(filename).st_size == 0:
112 filename = os.path.join(self.getDefaultConfigDir(), "config.json")
113 else:
114 src_dir = os.path.join(os.path.expanduser("~"), "PIME", self.imeDirName)
115 dst_dir = self.getConfigDir()
116 self.copytree(src_dir, dst_dir)
117 filename = self.getConfigFile()
118
119 with open(filename, "r") as f:
120 self.__dict__.update(json.load(f))
121 except Exception:
122 self.save()
123 self.update()
124
125 def toJson(self):
126 return {key: value for key, value in self.__dict__.items() if not key.startswith("_") and not key in self.ignoreSaveList}

Callers 15

updateMethod · 0.95
loadFromJsonMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
loadDebugLogMethod · 0.45
load_configMethod · 0.45
load_cindataMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45
saveCountFileMethod · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 7

getConfigFileMethod · 0.95
getDefaultConfigDirMethod · 0.95
getConfigDirMethod · 0.95
copytreeMethod · 0.95
updateMethod · 0.95
saveMethod · 0.95
joinMethod · 0.80

Tested by

no test coverage detected