Merge pull request #5 from jaicis/py3codequality

Code Quality fixes based on Flake8, Pycodestyle, Pylint.
This commit is contained in:
lakshyacis 2019-10-22 20:03:51 +05:30 committed by GitHub
commit bc748acada
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 17 additions and 15 deletions

View File

@ -50,16 +50,14 @@ from kivymd.uix.navigationdrawer import (
NavigationDrawerHeaderBase)
from kivymd.uix.selectioncontrol import MDCheckbox
from kivymd.theming import ThemeManager
import queues
from semaphores import kivyuisignaler
import state
from bitmessagekivy.uikivysignaler import UIkivySignaler
# pylint: disable=unused-argument, too-few-public-methods, import-error
from bitmessagekivy import identiconGeneration
import os
from kivy.core.clipboard import Clipboard
# pylint: disable=unused-argument, too-few-public-methods
@ -986,7 +984,6 @@ class NavigateApp(App): # pylint: disable=too-many-public-methods
def build(self):
"""Method builds the widget."""
import os
main_widget = Builder.load_file(
os.path.join(os.path.dirname(__file__), 'main.kv'))
self.nav_drawer = Navigatorss()

View File

@ -16,7 +16,9 @@ def makeCryptor(privkey):
private_key = a.changebase(privkey, 16, 256, minlen=32)
public_key = pointMult(private_key)
privkey_bin = '\x02\xca\x00\x20'.encode('raw_unicode_escape') + private_key
pubkey_bin = '\x02\xca\x00\x20'.encode('raw_unicode_escape') + public_key[1:-32] + '\x00\x20'.encode('utf-8') + public_key[-32:]
pubkey_bin = '\x02\xca\x00\x20'.encode(
'raw_unicode_escape') + public_key[1:-32] + '\x00\x20'.encode(
'utf-8') + public_key[-32:]
cryptor = pyelliptic.ECC(curve='secp256k1', privkey=privkey_bin, pubkey=pubkey_bin)
return cryptor

View File

@ -1,4 +1,4 @@
0# pylint: disable=missing-docstring,too-many-function-args
# pylint: disable=missing-docstring,too-many-function-args
import hashlib
import re
@ -30,7 +30,7 @@ def get_code_string(base):
elif base == 58:
return "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
elif base == 256:
'''raw_unicode_escape is used because in the python3 after range(161) its genreate the'
'''raw_unicode_escape is used because in the python3 after range(161) its genreate
the speical character so avoiding that function we have used the raw_unicode method '''
return bytes(range(0, 256))
else:
@ -39,7 +39,7 @@ def get_code_string(base):
def encode(val, base, minlen=0):
code_string = get_code_string(base)
result = str.encode('') if type(code_string) == bytes else ''
result = str.encode('') if type(code_string) is bytes else ''
while val > 0:
result = code_string[val % base:val % base + 1] + result
val = val // base
@ -47,6 +47,7 @@ def encode(val, base, minlen=0):
result = code_string[0] * (minlen - len(result)) + result
return result
def decode(string, base):
code_string = get_code_string(base)
result = 0

View File

@ -89,6 +89,7 @@ def isAddressInMyAddressBookSubscriptionsListOrWhitelist(address):
return True
return False
def decodeWalletImportFormat(WIFstring):
fullString = arithmetic.changebase(WIFstring, 58, 256)
privkey = fullString[:-4]
@ -171,8 +172,9 @@ def reloadBroadcastSendersForWhichImWatching():
# we should create Cryptor objects in a dictionary which we will
# use to attempt to decrypt encrypted broadcast messages.
if addressVersionNumber <= 3:
privEncryptionKey = hashlib.sha512((encodeVarint(addressVersionNumber) \
+ encodeVarint(streamNumber) + hash)).digest()[:32]
privEncryptionKey = hashlib.sha512((
encodeVarint(addressVersionNumber) +
encodeVarint(streamNumber) + hash)).digest()[:32]
MyECSubscriptionCryptorObjects[hash] = \
highlevelcrypto.makeCryptor(hexlify(privEncryptionKey))
else: