MCPcopy Index your code
hub / github.com/python/cpython / readconfig

Function readconfig

Lib/turtle.py:197–225  ·  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 import-dir

(cfgdict)

Source from the content-addressed store, hash-verified

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…