MCPcopy Create free account
hub / github.com/ipython/ipython / init_config_files

Method init_config_files

IPython/core/application.py:407–435  ·  view source on GitHub ↗

[optionally] copy default config files into profile dir.

(self)

Source from the content-addressed store, hash-verified

405 self._in_init_profile_dir = False
406
407 def init_config_files(self):
408 """[optionally] copy default config files into profile dir."""
409 self.config_file_paths.extend(ENV_CONFIG_DIRS)
410 self.config_file_paths.extend(SYSTEM_CONFIG_DIRS)
411 # copy config files
412 path = self.builtin_profile_dir
413 if self.copy_config_files:
414 src = self.profile
415
416 cfg = self.config_file_name
417 if path and os.path.exists(os.path.join(path, cfg)):
418 self.log.warning("Staging %r from %s into %r [overwrite=%s]"%(
419 cfg, src, self.profile_dir.location, self.overwrite)
420 )
421 self.profile_dir.copy_config_file(cfg, path=path, overwrite=self.overwrite)
422 else:
423 self.stage_default_config_file()
424 else:
425 # Still stage *bundled* config files, but not generated ones
426 # This is necessary for `ipython profile=sympy` to load the profile
427 # on the first go
428 files = glob.glob(os.path.join(path, '*.py'))
429 for fullpath in files:
430 cfg = os.path.basename(fullpath)
431 if self.profile_dir.copy_config_file(cfg, path=path, overwrite=False):
432 # file was copied
433 self.log.warning("Staging bundled %s from %s into %r"%(
434 cfg, self.profile, self.profile_dir.location)
435 )
436
437
438 def stage_default_config_file(self):

Callers 3

initializeMethod · 0.95
test_unicode_cwdFunction · 0.95
test_unicode_ipdirFunction · 0.95

Calls 2

copy_config_fileMethod · 0.80

Tested by 2

test_unicode_cwdFunction · 0.76
test_unicode_ipdirFunction · 0.76