MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / readconfig

Function readconfig

tools/python-3.11.9-amd64/Lib/turtle.py:201–229  ·  view source on GitHub ↗

Read config-files, change configuration-dict accordingly. If there is a turtle.cfg file in the current working directory, read it from there. If this contains an importconfig-value, say 'myway', construct filename turtle_mayway.cfg else use turtle.cfg and read it from the impor

(cfgdict)

Source from the content-addressed store, hash-verified

199 return cfgdict
200
201def readconfig(cfgdict):
202 """Read config-files, change configuration-dict accordingly.
203
204 If there is a turtle.cfg file in the current working directory,
205 read it from there. If this contains an importconfig-value,
206 say 'myway', construct filename turtle_mayway.cfg else use
207 turtle.cfg and read it from the import-directory, where
208 turtle.py is located.
209 Update configuration dictionary first according to config-file,
210 in the import directory, then according to config-file in the
211 current working directory.
212 If no config-file is found, the default configuration is used.
213 """
214 default_cfg = "turtle.cfg"
215 cfgdict1 = {}
216 cfgdict2 = {}
217 if isfile(default_cfg):
218 cfgdict1 = config_dict(default_cfg)
219 if "importconfig" in cfgdict1:
220 default_cfg = "turtle_%s.cfg" % cfgdict1["importconfig"]
221 try:
222 head, tail = split(__file__)
223 cfg_file2 = join(head, default_cfg)
224 except Exception:
225 cfg_file2 = ""
226 if isfile(cfg_file2):
227 cfgdict2 = config_dict(cfg_file2)
228 _CFG.update(cfgdict2)
229 _CFG.update(cfgdict1)
230
231try:
232 readconfig(_CFG)

Callers 1

turtle.pyFile · 0.85

Calls 5

isfileFunction · 0.90
splitFunction · 0.90
joinFunction · 0.90
config_dictFunction · 0.85
updateMethod · 0.45

Tested by

no test coverage detected