Instantiate from data and nVersion
(cls, data, nVersion)
| 108 | |
| 109 | @classmethod |
| 110 | def from_bytes(cls, data, nVersion): |
| 111 | """Instantiate from data and nVersion""" |
| 112 | if not (0 <= nVersion <= 255): |
| 113 | raise ValueError('nVersion must be in range 0 to 255 inclusive; got %d' % nVersion) |
| 114 | self = bytes.__new__(cls, data) |
| 115 | self.nVersion = nVersion |
| 116 | |
| 117 | return self |
| 118 | |
| 119 | def to_bytes(self): |
| 120 | """Convert to bytes instance |