Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Update DummySerialGuard to have flush(), optionally not print.

  • Loading branch information...
commit 29445bf0278b7387cc72d827ae4ae18b65c8514d 1 parent 55cb587
@markfickett authored
Showing with 8 additions and 3 deletions.
  1. +8 −3 DataSender.py
View
11 DataSender.py
@@ -173,16 +173,21 @@ def Format(**kwargs):
class DummySerialGuard:
"""
- Match SerialGuard, but print to stdout.
+ Match SerialGuard, but print to stdout (or do not print at all).
"""
- def __init__(self, serialDevice, readTimeout=TIMEOUT_DEFAULT):
+ def __init__(self, serialDevice, readTimeout=TIMEOUT_DEFAULT,
+ silent=False):
self.__sentReady = False
+ self.__silent = silent
def __enter__(self):
return self
def __exit__(self, excClass, excObj, tb):
pass
def write(self, s):
- print s
+ if not self.__silent:
+ print s
+ def flush(self):
+ pass
def readline(self):
if not self.__sentReady:
self.__sentReady = True
Please sign in to comment.
Something went wrong with that request. Please try again.