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

Method __init__

IPython/core/history.py:278–306  ·  view source on GitHub ↗

Create a new history accessor. Parameters ---------- profile : str The name of the profile from which to open history. hist_file : str Path to an SQLite history database stored by IPython. If specified, hist_file overrides profile.

(
        self, profile: str = "default", hist_file: str = "", **traits: typing.Any
    )

Source from the content-addressed store, hash-verified

276 raise TraitError(msg)
277
278 def __init__(
279 self, profile: str = "default", hist_file: str = "", **traits: typing.Any
280 ) -> None:
281 """Create a new history accessor.
282
283 Parameters
284 ----------
285 profile : str
286 The name of the profile from which to open history.
287 hist_file : str
288 Path to an SQLite history database stored by IPython. If specified,
289 hist_file overrides profile.
290 config : :class:`~traitlets.config.loader.Config`
291 Config object. hist_file can also be set through this.
292 """
293 super(HistoryAccessor, self).__init__(**traits)
294 # defer setting hist_file from kwarg until after init,
295 # otherwise the default kwarg value would clobber any value
296 # set by config
297 if hist_file:
298 self.hist_file = hist_file
299
300 try:
301 self.hist_file
302 except TraitError:
303 # No one has set the hist_file, yet.
304 self.hist_file = self._get_hist_file_name(profile)
305
306 self.init_db()
307
308 def _get_hist_file_name(self, profile: str = "default") -> Path:
309 """Find the history file for the given profile name.

Callers

nothing calls this directly

Calls 3

_get_hist_file_nameMethod · 0.95
init_dbMethod · 0.95
__init__Method · 0.45

Tested by

no test coverage detected