(cls, other)
| 512 | """ |
| 513 | @classmethod |
| 514 | def __coerce_instance(cls, other): |
| 515 | # Coerce other into bytes |
| 516 | if isinstance(other, CScriptOp): |
| 517 | other = bytes([other]) |
| 518 | elif isinstance(other, int): |
| 519 | if 0 <= other <= 16: |
| 520 | other = bytes([CScriptOp.encode_op_n(other)]) |
| 521 | elif other == -1: |
| 522 | other = bytes([OP_1NEGATE]) |
| 523 | else: |
| 524 | other = CScriptOp.encode_op_pushdata(bitcoin.core._bignum.bn2vch(other)) |
| 525 | elif isinstance(other, (bytes, bytearray)): |
| 526 | other = CScriptOp.encode_op_pushdata(other) |
| 527 | return other |
| 528 | |
| 529 | def __add__(self, other): |
| 530 | # Do the coercion outside of the try block so that errors in it are |
no test coverage detected