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>
This commit is contained in:
parent
3427e12e8f
commit
3ed017677b
@ -143,6 +143,15 @@ class RemoteFile(uio.IOBase):
|
|||||||
def __exit__(self, a, b, c):
|
def __exit__(self, a, b, c):
|
||||||
self.close()
|
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):
|
def ioctl(self, request, arg):
|
||||||
if request == 1: # FLUSH
|
if request == 1: # FLUSH
|
||||||
self.flush()
|
self.flush()
|
||||||
|
Loading…
Reference in New Issue
Block a user