kopia lustrzana https://github.com/peterhinch/micropython-samples
Tests: tidy up printbuf().
rodzic
2693472af6
commit
ee1dd76bdc
|
@ -11,8 +11,7 @@ MP_STREAM_POLL = const(3)
|
|||
MP_STREAM_ERROR = const(-1)
|
||||
|
||||
def printbuf(this_io):
|
||||
for ch in this_io.wbuf[:this_io.wprint_len]:
|
||||
print(chr(ch), end='')
|
||||
print(bytes(this_io.wbuf[:this_io.wprint_len]).decode(), end='')
|
||||
|
||||
class MyIO(io.IOBase):
|
||||
def __init__(self):
|
||||
|
|
|
@ -12,8 +12,7 @@ MP_STREAM_POLL = const(3)
|
|||
MP_STREAM_ERROR = const(-1)
|
||||
|
||||
def printbuf(this_io):
|
||||
for ch in this_io.wbuf[:this_io.wprint_len]:
|
||||
print(chr(ch), end='')
|
||||
print(bytes(this_io.wbuf[:this_io.wprint_len]).decode(), end='')
|
||||
this_io.wbuf = b''
|
||||
|
||||
class MyIO(io.IOBase):
|
||||
|
|
|
@ -51,8 +51,7 @@ class MyIOR(io.IOBase):
|
|||
# a ready status. For the demo it stores the characters in .wbuf for printing.
|
||||
|
||||
def printbuf(this_io):
|
||||
for x in range(this_io.wprint_len):
|
||||
print(chr(this_io.wbuf[x]), end = '')
|
||||
print(bytes(this_io.wbuf[:this_io.wprint_len]).decode(), end='')
|
||||
|
||||
class MyIOW(io.IOBase):
|
||||
def __init__(self):
|
||||
|
|
|
@ -20,8 +20,7 @@ MP_STREAM_POLL = const(3)
|
|||
MP_STREAM_ERROR = const(-1)
|
||||
|
||||
def printbuf(this_io):
|
||||
for ch in this_io.wbuf[:this_io.wprint_len]:
|
||||
print(chr(ch), end='')
|
||||
print(bytes(this_io.wbuf[:this_io.wprint_len]).decode(), end='')
|
||||
|
||||
class MyIO(io.IOBase):
|
||||
def __init__(self, read=False, write=False):
|
||||
|
|
|
@ -20,8 +20,7 @@ MP_STREAM_POLL = const(3)
|
|||
MP_STREAM_ERROR = const(-1)
|
||||
|
||||
def printbuf(this_io):
|
||||
for ch in this_io.wbuf[:this_io.wprint_len]:
|
||||
print(chr(ch), end='')
|
||||
print(bytes(this_io.wbuf[:this_io.wprint_len]).decode(), end='')
|
||||
|
||||
class MyIO(io.IOBase):
|
||||
def __init__(self, read=False, write=False):
|
||||
|
|
Ładowanie…
Reference in New Issue