fixed pylint and flake8 code quality errors

This commit is contained in:
shekhar-cis 2022-01-06 20:55:38 +05:30
parent c987da1224
commit 895651dd76
Signed by untrusted user: shekhar-cis
GPG Key ID: F4F00AB04E83F9A7
23 changed files with 235 additions and 45 deletions

View File

@ -1,6 +1,15 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement, no-method-argument, too-many-function-args
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
Bitmessage mock
"""
from pybitmessage.class_addressGenerator import addressGenerator
from pybitmessage.inventory import Inventory
from pybitmessage.bmconfigparser import BMConfigParser
@ -12,7 +21,7 @@ class MockMain:
def start(self):
"""Start main application"""
# pylint: disable=too-many-statements,too-many-branches,too-many-locals, unused-variable
# pylint: disable=too-many-statements,too-many-branches, unused-variable
config = BMConfigParser()
daemon = config.safeGetBoolean('bitmessagesettings', 'daemon')
# Start the address generation thread
@ -26,8 +35,6 @@ class MockMain:
state.kivyapp.run()
def main():
"""Triggers main module"""
mainprogram = MockMain()

View File

@ -1,3 +1,11 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable, chained-comparison
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init, no-self-use
# pylint: disable=protected-access, super-with-arguments, pointless-statement, no-method-argument, too-many-function-args
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ, too-few-public-methods
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
Operations with addresses
"""
@ -6,8 +14,6 @@ import hashlib
from binascii import hexlify, unhexlify
from struct import pack, unpack
# from debug import logger
ALPHABET = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

View File

@ -1,3 +1,13 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init, no-self-use
# pylint: disable=protected-access, super-with-arguments, pointless-statement, no-method-argument, too-many-function-args
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ, too-few-public-methods
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
'''
Address book screen
'''
from pybitmessage.get_platform import platform
from kivy.clock import Clock
from kivy.properties import (

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
All Mails Screen Functionality
"""
from functools import partial
from kivy.clock import Clock
from kivy.properties import (

View File

@ -1,6 +1,16 @@
from pybitmessage.bmconfigparser import BMConfigParser
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
"""
Draft Screen
"""
from functools import partial
from pybitmessage.addresses import decodeAddress
from kivy.clock import Clock
from kivy.properties import (
ListProperty,
@ -10,7 +20,8 @@ from kivy.uix.screenmanager import Screen
from kivymd.uix.label import MDLabel
from pybitmessage import state
from pybitmessage.bmconfigparser import BMConfigParser
from pybitmessage.addresses import decodeAddress
from pybitmessage.baseclass.common import (
showLimitedCnt, toast, ThemeClsColor,
SwipeToDeleteItem, ShowTimeHistoy
@ -43,7 +54,7 @@ class Draft(Screen):
# self.account = state.association
self.loadDraft()
def loadDraft(self, where="", what=""):
def loadDraft(self):
"""Load draft list for Draft messages"""
self.account = state.association
xAddress = 'fromaddress'
@ -99,13 +110,13 @@ class Draft(Screen):
updated_msg = len(self.ids.ml.children)
self.has_refreshed = True if total_draft_msg != updated_msg else False
def check_scroll_y(self, instance, somethingelse):
def check_scroll_y(self):
"""Load data on scroll"""
if self.ids.scroll_y.scroll_y <= -0.0 and self.has_refreshed:
self.ids.scroll_y.scroll_y = 0.06
total_draft_msg = len(self.ids.ml.children)
def draft_detail(self, ackdata, instance, *args):
def draft_detail(self, ackdata, instance):
"""Show draft Details"""
if instance.state == 'closed':
instance.ids.delete_msg.disabled = True
@ -122,7 +133,7 @@ class Draft(Screen):
else:
instance.ids.delete_msg.disabled = False
def delete_draft(self, data_index, instance, *args):
def delete_draft(self, instance):
"""Delete draft message permanently"""
if int(state.draft_count) > 0:
state.draft_count = str(int(state.draft_count) - 1)

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
All Mails Screen Functionality
"""
from kivy.clock import Clock
from kivy.properties import (
ListProperty,

View File

@ -1,14 +1,25 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation
# pylint: disable=protected-access
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
"""
Login screen
"""
# pylint: disable=redefined-outer-name,inconsistent-return-statements
from kivy.clock import Clock
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import Screen
from kivy.properties import StringProperty, BooleanProperty
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from pybitmessage import queues
from pybitmessage.bmconfigparser import BMConfigParser
from pybitmessage import state
from pybitmessage.baseclass.common import toast
from kivy.clock import Clock
from kivy.properties import StringProperty, BooleanProperty
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivy.uix.screenmanager import Screen
class Login(Screen):
"""Login Screeen class for kivy Ui"""
@ -85,7 +96,7 @@ class Random(Screen):
if entered_label in lables:
instance.error = True
instance.helper_text = 'it is already exist you'\
' can try this Ex. ( {0}_1, {0}_2 )'.format(
'can try this Ex. ( {0}_1, {0}_2 )'.format(
entered_label)
elif entered_label:
instance.error = False

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
Mail Detail Screen Functionality
"""
from datetime import datetime
from kivy.core.clipboard import Clipboard

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
"""
Message Composer
"""
from pybitmessage.get_platform import platform
from pybitmessage.bmconfigparser import BMConfigParser
from kivy.clock import Clock

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method
"""
My Addresses Screen
"""
from pybitmessage.get_platform import platform
from functools import partial
from pybitmessage.bmconfigparser import BMConfigParser

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements, unnecessary-pass
"""
Network Screen
"""
from kivy.clock import Clock
from kivy.properties import StringProperty
from kivy.uix.screenmanager import Screen

View File

@ -1,6 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init, no-self-use
# pylint: disable=protected-access, super-with-arguments, pointless-statement, no-method-argument, too-many-function-args
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ, too-few-public-methods
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
'''
This is for payment related part
'''
from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivy.uix.screenmanager import Screen

View File

@ -1,3 +1,13 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
Popup Screen Functionality
"""
from kivy.clock import Clock
from kivy.metrics import dp

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements, unnecessary-pass
"""
QR Code Generator
"""
from pybitmessage import state
from pybitmessage.baseclass.common import toast
from kivy.uix.screenmanager import Screen

View File

@ -1,3 +1,13 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements, unnecessary-pass
"""
Scan screen
"""
import os
from pybitmessage.get_platform import platform

View File

@ -1,3 +1,14 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access, super-with-arguments, pointless-statement
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements, unnecessary-pass
"""
Sent Screen
"""
from functools import partial
from kivy.clock import Clock
from kivy.properties import StringProperty, ListProperty

View File

@ -1,3 +1,8 @@
# pylint: disable=unnecessary-pass
"""
Setting screen
"""
from kivy.uix.screenmanager import Screen

View File

@ -1,3 +1,15 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init, no-self-use
# pylint: disable=protected-access, super-with-arguments, pointless-statement, no-method-argument, too-many-function-args
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ, too-few-public-methods
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member, consider-using-in
# pylint: disable=too-many-return-statements, unnecessary-pass, bad-option-value, abstract-method, consider-using-f-string
"""
Trash Screen
"""
from kivy.clock import Clock
from kivy.properties import (
ListProperty,

View File

@ -1,3 +1,10 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init
# pylint: disable=protected-access
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
"""
BMConfigParser class definition and default configuration settings
"""

View File

@ -1,3 +1,10 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation
# pylint: disable=protected-access
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
from sys import platform as _sys_platform
from os import environ
@ -35,6 +42,7 @@ def _get_platform():
return "linux"
return "unknown"
platform = _get_platform()
if platform not in ("android", "unknown"):

View File

@ -37,7 +37,7 @@ from kivymd.uix.list import (
OneLineListItem
)
from kivy.uix.screenmanager import RiseInTransition, SlideTransition, FallOutTransition
from kivy.uix.screenmanager import SlideTransition, FallOutTransition
from pybitmessage import queues
from pybitmessage import state
@ -53,7 +53,7 @@ if platform != "android":
from kivy.config import Config
Config.set("input", "mouse", "mouse, multitouch_on_demand")
elif platform == "android":
from jnius import autoclass, cast
from jnius import autoclass, cast # noqa:F401
from android.runnable import run_on_ui_thread
from android import python_act as PythonActivity
@ -97,7 +97,7 @@ class Lang(Observable):
if name == "_":
self.observers.append((func, args, kwargs))
else:
return super(Lang, self).fbind(name, func, *largs, **kwargs)
return super(Lang, self).fbind(name, func, **args, **kwargs)
def funbind(self, name, func, args, **kwargs):
if name == "_":
@ -337,7 +337,6 @@ class NavigateApp(MDApp):
# self.add_popup.set_normal_height()
self.add_popup.auto_dismiss = False
self.add_popup.open()
# p = GrashofPopup()
# p.open()
def scan_qr_code(self, instance):
@ -406,10 +405,8 @@ class NavigateApp(MDApp):
if self.variable_1:
first_addr = self.variable_1[0]
if BMConfigParser().get(str(first_addr), 'enabled') == 'true':
if os.path.exists(
state.imageDir + '/default_identicon/{}.png'.format(first_addr)):
return state.imageDir + '/default_identicon/{}.png'.format(
first_addr)
if os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(first_addr)):
return state.imageDir + '/default_identicon/{}.png'.format(first_addr)
else:
return
return state.imageDir + '/drawer_logo1.png'
@ -617,7 +614,7 @@ class NavigateApp(MDApp):
def set_message_count(self):
"""Setting message count"""
pass
def on_start(self):
"""Setting message count"""
self.set_message_count()
@ -626,7 +623,7 @@ class NavigateApp(MDApp):
def current_address_label(current_add_label=None, current_addr=None):
"""Getting current address labels"""
addresses = [addr for addr in BMConfigParser().addresses()
if BMConfigParser().get(str(addr), 'enabled') == 'true']
if BMConfigParser().get(str(addr), 'enabled') == 'true']
if addresses:
if current_add_label:
first_name = current_add_label
@ -775,7 +772,7 @@ class NavigateApp(MDApp):
def on_request_close(self, *args): # pylint: disable=no-self-use
"""This method is for app closing request"""
AppClosingPopup().open()
AppClosingPopup().open() # noqa:F821
return True
def file_manager_open(self):
@ -874,9 +871,6 @@ class NavigateApp(MDApp):
print("Purchasing {} through {}".format(self.product_id, method_name))
def _after_scan(self, text):
# if platform == 'android':
# toast_txt = cast(CharSequence, String(text))
# show_toast(toast_txt, Toast.LENGTH_SHORT)
if self.root.ids.sc23.previous_open_screen == 'composer':
self.root.ids.sc3.children[1].ids.txt_input.text = text
self.root.ids.scr_mngr.current = 'create'

View File

@ -1,3 +1,10 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation
# pylint: disable=protected-access
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
"""Most of the queues used by bitmessage threads are defined here."""
import threading
@ -39,8 +46,6 @@ addressGeneratorQueue = queue.Queue()
#: `.network.ReceiveQueueThread` instances dump objects they hear
#: on the network into this queue to be processed.
objectProcessorQueue = ObjectProcessorQueue()
# invQueue = MultiQueue()
# addrQueue = MultiQueue()
portCheckerQueue = queue.Queue()
receiveDataQueue = queue.Queue()
#: The address generator thread uses this queue to get information back

View File

@ -1,5 +1,12 @@
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument
# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation
# pylint: disable=protected-access
# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ
# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member
# pylint: disable=too-many-return-statements
"""shutdown function"""
import os
import queue as Queue
import threading
import time
@ -73,12 +80,3 @@ def doCleanShutdown():
queue.task_done()
except Queue.Empty:
break
# if state.thisapp.daemon or not state.enableGUI:
# logger.info('Clean shutdown complete.')
# state.thisapp.cleanup()
# os._exit(0) # pylint: disable=protected-access
# else:
# logger.info('Core shutdown complete.')
# for thread in threading.enumerate():
# logger.debug('Thread %s still running', thread.name)