FakeIO IO Interface¶
A module for the FakeIO class.
-
class
larpix.fakeio.
FakeIO
[source]¶ An IO stand-in that sends output to stdout (i.e. print) and reads input from a data member that can be set in advance.
The queue is implemented as a
collections.deque
object. Data can be queued up in advance through repeated calls toqueue.append()
. The first element of the queue will be passed on to theController.read
method each time it is called. This is a true queue, i.e. first-in, first-out.The format for an element of the queue is a tuple:
([list_of_Packets], b'corresponding bytes')
.Although meaningless in terms of the internal implementation,
FakeIO
objects contain an internal state determining whether the object is currently “listening,” and will raise aRuntimeError
ifempty_queue
is called when the object is not listening.