Browse Source

tools/mpremote: Make RemoteFile objects iterable.

So that filesystems mounted with "mpremote mount" can have their files
iterated over, making them consistent with other files.

Signed-off-by: Damien George <damien@micropython.org>
pull/9754/head
Damien George 2 years ago
parent
commit
3ed017677b
  1. 9
      tools/mpremote/mpremote/pyboardextended.py

9
tools/mpremote/mpremote/pyboardextended.py

@ -143,6 +143,15 @@ class RemoteFile(uio.IOBase):
def __exit__(self, a, b, c):
self.close()
def __iter__(self):
return self
def __next__(self):
l = self.readline()
if not l:
raise StopIteration
return l
def ioctl(self, request, arg):
if request == 1: # FLUSH
self.flush()

Loading…
Cancel
Save