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

Method fload

IPython/lib/demo.py:288–298  ·  view source on GitHub ↗

Load file object.

(self)

Source from the content-addressed store, hash-verified

286 self.reload()
287
288 def fload(self):
289 """Load file object."""
290 # read data and parse into blocks
291 if hasattr(self, 'fobj') and self.fobj is not None:
292 self.fobj.close()
293 if hasattr(self.src, "read"):
294 # It seems to be a file or a file-like object
295 self.fobj = self.src
296 else:
297 # Assume it's a string or something that can be converted to one
298 self.fobj = openpy.open(self.fname)
299
300 def reload(self):
301 """Reload source from disk and initialize state."""

Callers 2

reloadMethod · 0.95
reloadMethod · 0.80

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected