MCPcopy Index your code
hub / github.com/ipython/ipython / find_profile_dir_by_name

Method find_profile_dir_by_name

IPython/core/profiledir.py:203–228  ·  view source on GitHub ↗

Find an existing profile dir by profile name, return its ProfileDir. This searches through a sequence of paths for a profile dir. If it is not found, a :class:`ProfileDirError` exception will be raised. The search path algorithm is: 1. ``os.getcwd()`` # removed for

(cls, ipython_dir, name=u'default', config=None)

Source from the content-addressed store, hash-verified

201
202 @classmethod
203 def find_profile_dir_by_name(cls, ipython_dir, name=u'default', config=None):
204 """Find an existing profile dir by profile name, return its ProfileDir.
205
206 This searches through a sequence of paths for a profile dir. If it
207 is not found, a :class:`ProfileDirError` exception will be raised.
208
209 The search path algorithm is:
210 1. ``os.getcwd()`` # removed for security reason.
211 2. ``ipython_dir``
212
213 Parameters
214 ----------
215 ipython_dir : unicode or str
216 The IPython directory to use.
217 name : unicode or str
218 The name of the profile. The name of the profile directory
219 will be "profile_<profile>".
220 """
221 dirname = u'profile_' + name
222 paths = [ipython_dir]
223 for p in paths:
224 profile_dir = os.path.join(p, dirname)
225 if os.path.isdir(profile_dir):
226 return cls(location=profile_dir, config=config)
227 else:
228 raise ProfileDirError('Profile directory not found in paths: %s' % dirname)
229
230 @classmethod
231 def find_profile_dir(cls, profile_dir, config=None):

Callers 4

locate_profileFunction · 0.80
load_subconfigMethod · 0.80
init_profile_dirMethod · 0.80
test_list_profiles_inFunction · 0.80

Calls 1

ProfileDirErrorClass · 0.85

Tested by 1

test_list_profiles_inFunction · 0.64