Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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

  • Loading branch information...
commit 29445bf0278b7387cc72d827ae4ae18b65c8514d 1 parent 55cb587
Mark Fickett authored

Showing 1 changed file with 8 additions and 3 deletions. Show diff stats Hide diff stats

  1. +8 3 DataSender.py
11 DataSender.py
@@ -173,16 +173,21 @@ def Format(**kwargs):
173 173
174 174 class DummySerialGuard:
175 175 """
176   - Match SerialGuard, but print to stdout.
  176 + Match SerialGuard, but print to stdout (or do not print at all).
177 177 """
178   - def __init__(self, serialDevice, readTimeout=TIMEOUT_DEFAULT):
  178 + def __init__(self, serialDevice, readTimeout=TIMEOUT_DEFAULT,
  179 + silent=False):
179 180 self.__sentReady = False
  181 + self.__silent = silent
180 182 def __enter__(self):
181 183 return self
182 184 def __exit__(self, excClass, excObj, tb):
183 185 pass
184 186 def write(self, s):
185   - print s
  187 + if not self.__silent:
  188 + print s
  189 + def flush(self):
  190 + pass
186 191 def readline(self):
187 192 if not self.__sentReady:
188 193 self.__sentReady = True

0 comments on commit 29445bf

Please sign in to comment.
Something went wrong with that request. Please try again.