Name: BitField.fromByte(raw) Args: raw, the raw byte to make the BitField. Desc: Takes a byte, and modifies self to match. >>> bf = BitField() >>> bf.fromByte(123) # Modifies bf in place >>> print bf [ bit7 = 0, bit6 = 1, bit5 = 1, bi
(self, raw)
| 215 | self.fromByte(rawByte) |
| 216 | |
| 217 | def fromByte(self, raw): |
| 218 | """ |
| 219 | Name: BitField.fromByte(raw) |
| 220 | Args: raw, the raw byte to make the BitField. |
| 221 | Desc: Takes a byte, and modifies self to match. |
| 222 | |
| 223 | >>> bf = BitField() |
| 224 | >>> bf.fromByte(123) # Modifies bf in place |
| 225 | >>> print bf |
| 226 | [ bit7 = 0, bit6 = 1, bit5 = 1, bit4 = 1, bit3 = 1, bit2 = 0, bit1 = 1, |
| 227 | bit0 = 1 ] |
| 228 | """ |
| 229 | self.rawValue = raw |
| 230 | self.rawBits = [] |
| 231 | self.data = [] |
| 232 | |
| 233 | items = min(8, len(self.labelList)) |
| 234 | for i in reversed(list(range(items))): |
| 235 | self.rawBits.append( ((raw >> (i)) & 1) ) |
| 236 | self.data.append(self.oneLabel if bool(((raw >> (i)) & 1)) else self.zeroLabel) |
| 237 | |
| 238 | def asByte(self): |
| 239 | """ |
no outgoing calls
no test coverage detected