Fix spacing in trilobytes comment

This commit is contained in:
Neale Pickett 2018-07-10 19:50:44 +00:00
parent cbc05b4afb
commit 92731f5c74
1 changed files with 31 additions and 31 deletions

View File

@ -7,37 +7,37 @@ import itertools
class TriloBytes: class TriloBytes:
"""Three-level byte array (0, 1, Missing). """Three-level byte array (0, 1, Missing).
This allows you to represent on-wire transactions with holes in the middle, This allows you to represent on-wire transactions with holes in the middle,
due to eg. dropped packets. due to eg. dropped packets.
>>> tb = TriloBytes(b'hi') >>> tb = TriloBytes(b'hi')
>>> bytes(tb) >>> bytes(tb)
b'hi' b'hi'
>>> bytes(tb[:40]) >>> bytes(tb[:40])
b'hi' b'hi'
>>> tb = TriloBytes(b'hi') + [None] * 3 >>> tb = TriloBytes(b'hi') + [None] * 3
>>> bytes(tb) >>> bytes(tb)
b'hi???' b'hi???'
>>> bytes(tb[:40]) >>> bytes(tb[:40])
b'hi???' b'hi???'
>>> bytes(tb[:3]) >>> bytes(tb[:3])
b'hi?' b'hi?'
>>> bytes(tb[-4:]) >>> bytes(tb[-4:])
b'i???' b'i???'
>>> bytes(tb + tb) >>> bytes(tb + tb)
b'hi???hi???' b'hi???hi???'
>>> bytes(tb ^ 1) >>> bytes(tb ^ 1)
b'ih???' b'ih???'
>>> bytes(tb ^ [32, 1]) >>> bytes(tb ^ [32, 1])
b'Hh???' b'Hh???'
>>> tb = TriloBytes(b'hi', drop=b'DROP') >>> tb = TriloBytes(b'hi', drop=b'DROP')
>>> bytes(tb) >>> bytes(tb)
b'hi' b'hi'
>>> tb += [None] * 7 >>> tb += [None] * 7
>>> bytes(tb) >>> bytes(tb)
b'hiOPDROPD' b'hiOPDROPD'
""" """