validate:launcher: Support mixed str/bytes control sequences.
authorBrady J. Garvin <bgarvin@cse.unl.edu>
Sun, 5 Jan 2020 20:09:07 +0000 (14:09 -0600)
committerBrady J. Garvin <bgarvin@cse.unl.edu>
Sun, 5 Jan 2020 20:09:07 +0000 (14:09 -0600)
commit06822b519bdc911690d7ecb5ed0e40125d10a314
tree9a3b8bfdf6d66fdae614561d3b973f0e4eebf49f
parent195d3a3edcacd79b8aeb8f585916297e78df1009
validate:launcher: Support mixed str/bytes control sequences.

It is not safe for `_preformat_levels` to assume that all of the fields in a
`TerminalController` have the same type; at least in my environment, some of
these fields are populated with `bytes` while others remain strings.

This change conditionally applies decoding to each control sequence separately
using a helper function `_as_string`.  As a side-effect, it also eliminates some
code repetition in `_preformat_levels`.

Closes #50.
validate/launcher/loggable.py