Skip to content

Commit

Permalink
tools/mpremote: Make RemoteFile objects iterable.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dpgeorge committed Oct 31, 2022
1 parent 3427e12 commit 3ed0176
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tools/mpremote/mpremote/pyboardextended.py
Expand Up @@ -143,6 +143,15 @@ def __enter__(self):
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()
Expand Down

0 comments on commit 3ed0176

Please sign in to comment.