From 5b3e9aaa14c815542cdfbaa735128778c3c8f5a2 Mon Sep 17 00:00:00 2001 From: navjot Date: Fri, 17 Apr 2020 17:26:05 +0530 Subject: [PATCH] fixed code quality for flake8, pylint and pycodestyle --- src/bitmessagekivy/mpybit.py | 8 +++++--- src/depends.py | 13 +++++++------ src/network/tls.py | 2 +- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 1ab9314e..b462f85d 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1011,7 +1011,8 @@ class Random(Screen): state.kivyapp.root.ids.sc10.init_ui() toast('New address created') - def add_validation(self, instance): + @staticmethod + def add_validation(instance): """Checking validation at address creation time""" entered_label = str(instance.text.strip()) lables = [BMConfigParser().get(obj, 'label') @@ -1995,6 +1996,7 @@ class NavigateApp(MDApp): toast('Copied') def reset_login_screen(self): + """This method is used for clearing random screen""" if self.root.ids.sc7.ids.add_random_bx.children: self.root.ids.sc7.ids.add_random_bx.clear_widgets() @@ -2045,7 +2047,7 @@ class GrashofPopup(Popup): # my_addresses = ( # self.parent.children[1].children[0].children[0].ids.btn.values) my_addresses = ( - state.kivyapp.root.children[0].children[0].ids.btn.values) + state.kivyapp.root.children[0].children[0].ids.btn.values) add_book = [addr[1] for addr in kivy_helper_search.search_sql( folder="addressbook")] entered_text = str(instance.text).strip() @@ -3015,4 +3017,4 @@ class ToAddrBoxlayout(BoxLayout): class RandomBoxlayout(BoxLayout): """class for BoxLayout behaviour""" - pass \ No newline at end of file + pass diff --git a/src/depends.py b/src/depends.py index e359724f..01bc3c5f 100755 --- a/src/depends.py +++ b/src/depends.py @@ -4,6 +4,10 @@ and suggest how it may be installed """ import sys +import logging +import os +import state +from importlib import import_module # Only really old versions of Python don't have sys.hexversion. We don't # support them. The logging module was introduced in Python 2.3 @@ -14,10 +18,6 @@ if not hasattr(sys, 'hexversion') or sys.hexversion < 0x20300F0: % sys.version ) -import logging -import os -from importlib import import_module -import state # We can now use logging so set up a simple configuration formatter = logging.Formatter('%(levelname)s: %(message)s') handler = logging.StreamHandler(sys.stdout) @@ -304,7 +304,7 @@ def check_openssl(): ' OpenSSL 0.9.8b or later with AES, Elliptic Curves (EC),' ' ECDH, and ECDSA enabled.') return False - if sys.version_info >=(3,0,0): + if sys.version_info >= (3, 0, 0): matches = cflags_regex.findall(str(openssl_cflags)) else: matches = cflags_regex.findall(openssl_cflags) @@ -359,7 +359,8 @@ def check_curses(): # The pythondialog author does not like Python2 str, so we have to use # unicode for just the version otherwise we get the repr form which # includes the module and class names along with the actual version. - logger.info('dialog Utility Version %s', unicode(dialog_util_version)) + # logger.info('dialog Utility Version %s', unicode(dialog_util_version)) + logger.info('dialog Utility Version {}'.format(str(dialog_util_version))) return True diff --git a/src/network/tls.py b/src/network/tls.py index c8bee8b8..1611a1e9 100644 --- a/src/network/tls.py +++ b/src/network/tls.py @@ -172,7 +172,7 @@ class TLSDispatcher(AdvancedDispatcher): self.handle_close() return - def tls_handshake(self): + def tls_handshake(self): # pylint:disable=too-many-branches """Perform TLS handshake and handle its stages""" # wait for flush # self.sslSocket.setblocking(0)