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

Method fload

IPython/lib/demo.py:289–299  ·  view source on GitHub ↗

Load file object.

(self)

Source from the content-addressed store, hash-verified

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