|
57 | 57 | For further examples please reference `.tests.test_api`. |
58 | 58 | """ |
59 | 59 |
|
| 60 | +# pylint: disable=too-many-lines,relative-import |
| 61 | + |
60 | 62 | import base64 |
61 | 63 | import errno |
62 | 64 | import hashlib |
@@ -112,48 +114,48 @@ class ErrorCodes(type): |
112 | 114 | 0: 'Invalid command parameters number', |
113 | 115 | 1: 'The specified passphrase is blank.', |
114 | 116 | 2: 'The address version number currently must be 3, 4, or 0' |
115 | | - ' (which means auto-select).', |
| 117 | + ' (which means auto-select).', |
116 | 118 | 3: 'The stream number must be 1 (or 0 which means' |
117 | | - ' auto-select). Others aren\'t supported.', |
| 119 | + ' auto-select). Others aren\'t supported.', |
118 | 120 | 4: 'Why would you ask me to generate 0 addresses for you?', |
119 | 121 | 5: 'You have (accidentally?) specified too many addresses to' |
120 | | - ' make. Maximum 999. This check only exists to prevent' |
121 | | - ' mischief; if you really want to create more addresses than' |
122 | | - ' this, contact the Bitmessage developers and we can modify' |
123 | | - ' the check or you can do it yourself by searching the source' |
124 | | - ' code for this message.', |
| 122 | + ' make. Maximum 999. This check only exists to prevent' |
| 123 | + ' mischief; if you really want to create more addresses than' |
| 124 | + ' this, contact the Bitmessage developers and we can modify' |
| 125 | + ' the check or you can do it yourself by searching the source' |
| 126 | + ' code for this message.', |
125 | 127 | 6: 'The encoding type must be 2 or 3.', |
126 | 128 | 7: 'Could not decode address', |
127 | 129 | 8: 'Checksum failed for address', |
128 | 130 | 9: 'Invalid characters in address', |
129 | 131 | 10: 'Address version number too high (or zero)', |
130 | 132 | 11: 'The address version number currently must be 2, 3 or 4.' |
131 | | - ' Others aren\'t supported. Check the address.', |
| 133 | + ' Others aren\'t supported. Check the address.', |
132 | 134 | 12: 'The stream number must be 1. Others aren\'t supported.' |
133 | | - ' Check the address.', |
| 135 | + ' Check the address.', |
134 | 136 | 13: 'Could not find this address in your keys.dat file.', |
135 | 137 | 14: 'Your fromAddress is disabled. Cannot send.', |
136 | 138 | 15: 'Invalid ackData object size.', |
137 | 139 | 16: 'You are already subscribed to that address.', |
138 | 140 | 17: 'Label is not valid UTF-8 data.', |
139 | 141 | 18: 'Chan name does not match address.', |
140 | 142 | 19: 'The length of hash should be 32 bytes (encoded in hex' |
141 | | - ' thus 64 characters).', |
| 143 | + ' thus 64 characters).', |
142 | 144 | 20: 'Invalid method:', |
143 | 145 | 21: 'Unexpected API Failure', |
144 | 146 | 22: 'Decode error', |
145 | 147 | 23: 'Bool expected in eighteenByteRipe', |
146 | 148 | 24: 'Chan address is already present.', |
147 | 149 | 25: 'Specified address is not a chan address.' |
148 | | - ' Use deleteAddress API call instead.', |
| 150 | + ' Use deleteAddress API call instead.', |
149 | 151 | 26: 'Malformed varint in address: ', |
150 | 152 | 27: 'Message is too long.', |
151 | 153 | 28: 'Invalid parameter' |
152 | 154 | } |
153 | 155 |
|
154 | 156 | def __new__(mcs, name, bases, namespace): |
155 | 157 | result = super(ErrorCodes, mcs).__new__(mcs, name, bases, namespace) |
156 | | - for code in six.iteritems(mcs._CODES): |
| 158 | + for code in six.iteritems(mcs._CODES): # pylint: disable=no-member |
157 | 159 | # beware: the formatting is adjusted for list-table |
158 | 160 | result.__doc__ += """ * - %04i |
159 | 161 | - %s |
@@ -466,6 +468,7 @@ def APIAuthenticateClient(self): |
466 | 468 | class BMRPCDispatcher(object): |
467 | 469 | """This class is used to dispatch API commands""" |
468 | 470 |
|
| 471 | + # pylint: disable=inconsistent-return-statements |
469 | 472 | @staticmethod |
470 | 473 | def _decode(text, decode_type): |
471 | 474 | try: |
@@ -722,8 +725,8 @@ def HandleDeleteWhitelistEntry(self, address): |
722 | 725 |
|
723 | 726 | @command('createRandomAddress') |
724 | 727 | def HandleCreateRandomAddress( |
725 | | - self, label, eighteenByteRipe=False, totalDifficulty=0, |
726 | | - smallMessageDifficulty=0 |
| 728 | + self, label, eighteenByteRipe=False, totalDifficulty=0, |
| 729 | + smallMessageDifficulty=0 |
727 | 730 | ): |
728 | 731 | """ |
729 | 732 | Create one address using the random number generator. |
@@ -763,9 +766,9 @@ def HandleCreateRandomAddress( |
763 | 766 |
|
764 | 767 | @command('createDeterministicAddresses') |
765 | 768 | def HandleCreateDeterministicAddresses( |
766 | | - self, passphrase, numberOfAddresses=1, addressVersionNumber=0, |
767 | | - streamNumber=0, eighteenByteRipe=False, totalDifficulty=0, |
768 | | - smallMessageDifficulty=0 |
| 769 | + self, passphrase, numberOfAddresses=1, addressVersionNumber=0, |
| 770 | + streamNumber=0, eighteenByteRipe=False, totalDifficulty=0, |
| 771 | + smallMessageDifficulty=0 |
769 | 772 | ): |
770 | 773 | """ |
771 | 774 | Create many addresses deterministically using the passphrase. |
@@ -1190,8 +1193,8 @@ def HandleTrashSentMessage(self, msgid): |
1190 | 1193 |
|
1191 | 1194 | @command('sendMessage') |
1192 | 1195 | def HandleSendMessage( |
1193 | | - self, toAddress, fromAddress, subject, message, |
1194 | | - encodingType=2, TTL=4 * 24 * 60 * 60 |
| 1196 | + self, toAddress, fromAddress, subject, message, |
| 1197 | + encodingType=2, TTL=4 * 24 * 60 * 60 |
1195 | 1198 | ): |
1196 | 1199 | """ |
1197 | 1200 | Send the message and return ackdata (hex encoded string). |
@@ -1242,7 +1245,7 @@ def HandleSendMessage( |
1242 | 1245 |
|
1243 | 1246 | @command('sendBroadcast') |
1244 | 1247 | def HandleSendBroadcast( |
1245 | | - self, fromAddress, subject, message, encodingType=2, |
| 1248 | + self, fromAddress, subject, message, encodingType=2, |
1246 | 1249 | TTL=4 * 24 * 60 * 60): |
1247 | 1250 | """Send the broadcast message. Similiar to *sendMessage*.""" |
1248 | 1251 |
|
@@ -1361,9 +1364,9 @@ def ListSubscriptions(self): |
1361 | 1364 |
|
1362 | 1365 | @command('disseminatePreEncryptedMsg', 'disseminatePreparedObject') |
1363 | 1366 | def HandleDisseminatePreparedObject( |
1364 | | - self, encryptedPayload, |
1365 | | - nonceTrialsPerByte=networkDefaultProofOfWorkNonceTrialsPerByte, |
1366 | | - payloadLengthExtraBytes=networkDefaultPayloadLengthExtraBytes |
| 1367 | + self, encryptedPayload, |
| 1368 | + nonceTrialsPerByte=networkDefaultProofOfWorkNonceTrialsPerByte, |
| 1369 | + payloadLengthExtraBytes=networkDefaultPayloadLengthExtraBytes |
1367 | 1370 | ): |
1368 | 1371 | """ |
1369 | 1372 | Handle a request to disseminate an encrypted message. |
|
0 commit comments