Load file object.
(self)
| 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.""" |