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 2022-10-27 13:36:20 +11:00
rodzic 3427e12e8f
commit 3ed017677b
1 zmienionych plików z 9 dodań i 0 usunięć

Wyświetl plik

@ -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()