CQ fixes for pylint

This commit is contained in:
navjot 2021-05-21 17:06:11 +05:30
parent 44133f1e74
commit 8576e9244f
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
11 changed files with 60 additions and 38 deletions

View File

@ -1,7 +1,5 @@
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory from pythonforandroid.toolchain import Recipe, shprint, current_directory
from os.path import exists, join from os.path import exists, join
import os
import sys
from multiprocessing import cpu_count from multiprocessing import cpu_count
import sh import sh
@ -47,4 +45,5 @@ class BitmsghashRecipe(Recipe):
self.install_libs(arch, '{}/libbitmsghash.so'.format(dst_dir), self.install_libs(arch, '{}/libbitmsghash.so'.format(dst_dir),
'libbitmsghash.so') 'libbitmsghash.so')
recipe = BitmsghashRecipe() recipe = BitmsghashRecipe()

View File

@ -15,7 +15,7 @@ from kivy.uix.screenmanager import Screen
import state import state
from bitmessagekivy.baseclass.common import ( from bitmessagekivy.baseclass.common import (
AvatarSampleWidget, avatarImageFirstLetter, toast, avatarImageFirstLetter, toast,
ThemeClsColor, SwipeToDeleteItem ThemeClsColor, SwipeToDeleteItem
) )
from bitmessagekivy.baseclass.popup import AddbookDetailPopup from bitmessagekivy.baseclass.popup import AddbookDetailPopup

View File

@ -14,6 +14,7 @@ from bitmessagekivy.baseclass.common import toast
class Login(Screen): class Login(Screen):
"""Login Screeen class for kivy Ui""" """Login Screeen class for kivy Ui"""
# pylint: disable=too-few-public-methods
log_text1 = ( log_text1 = (
'You may generate addresses by using either random numbers' 'You may generate addresses by using either random numbers'
' or by using a passphrase If you use a passphrase, the address' ' or by using a passphrase If you use a passphrase, the address'
@ -35,7 +36,7 @@ class Random(Screen):
is_active = BooleanProperty(False) is_active = BooleanProperty(False)
checked = StringProperty("") checked = StringProperty("")
def generateaddress(self, navApp): def generateaddress(self):
"""Method for Address Generator""" """Method for Address Generator"""
# entered_label = str(self.ids.lab.text).strip() # entered_label = str(self.ids.lab.text).strip()
entered_label = str(self.ids.add_random_bx.children[0].ids.lab.text).strip() entered_label = str(self.ids.add_random_bx.children[0].ids.lab.text).strip()
@ -59,7 +60,7 @@ class Random(Screen):
self.manager.current = 'myaddress' self.manager.current = 'myaddress'
Clock.schedule_once(self.address_created_callback, 6) Clock.schedule_once(self.address_created_callback, 6)
def address_created_callback(self, dt=0): def address_created_callback(self, dt=0): # pylint: disable=unused-argument
"""New address created""" """New address created"""
state.kivyapp.loadMyAddressScreen(False) state.kivyapp.loadMyAddressScreen(False)
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets() state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
@ -94,7 +95,7 @@ class Random(Screen):
instance.error = False instance.error = False
instance.helper_text = 'This field is required' instance.helper_text = 'This field is required'
def reset_address_label(self, n): def reset_address_label(self):
"""Resetting address labels""" """Resetting address labels"""
if not self.ids.add_random_bx.children: if not self.ids.add_random_bx.children:
self.ids.add_random_bx.add_widget(RandomBoxlayout()) self.ids.add_random_bx.add_widget(RandomBoxlayout())
@ -102,7 +103,9 @@ class Random(Screen):
class InfoLayout(BoxLayout, RectangularElevationBehavior): class InfoLayout(BoxLayout, RectangularElevationBehavior):
"""InfoLayout class for kivy Ui""" """InfoLayout class for kivy Ui"""
# pylint: disable=too-few-public-methods
class RandomBoxlayout(BoxLayout): class RandomBoxlayout(BoxLayout):
"""RandomBoxlayout class for BoxLayout behaviour""" """RandomBoxlayout class for BoxLayout behaviour"""
# pylint: disable=too-few-public-methods

View File

@ -48,7 +48,7 @@ class Create(Screen):
self.add_widget(widget_1) self.add_widget(widget_1)
self.children[0].ids.id_scroll.bind(scroll_y=self.check_scroll_y) self.children[0].ids.id_scroll.bind(scroll_y=self.check_scroll_y)
def check_scroll_y(self, instance, somethingelse): def check_scroll_y(self, instance, somethingelse): # pylint: disable=unused-argument
"""show data on scroll down""" """show data on scroll down"""
if self.children[1].ids.btn.is_open: if self.children[1].ids.btn.is_open:
self.children[1].ids.btn.is_open = False self.children[1].ids.btn.is_open = False
@ -177,14 +177,15 @@ class DropDownWidget(BoxLayout):
self.address_error_message(msg) self.address_error_message(msg)
@staticmethod @staticmethod
def callback_for_msgsend(dt=0): def callback_for_msgsend(dt=0): # pylint: disable=unused-argument
"""Callback method for messagesend""" """Callback method for messagesend"""
state.kivyapp.root.ids.sc3.children[0].active = False state.kivyapp.root.ids.sc3.children[0].active = False
state.in_sent_method = True state.in_sent_method = True
state.kivyapp.back_press() state.kivyapp.back_press()
toast("sent") toast("sent")
def address_error_message(self, msg): @staticmethod
def address_error_message(msg):
"""Generates error message""" """Generates error message"""
width = .8 if platform == 'android' else .55 width = .8 if platform == 'android' else .55
dialog_box = MDDialog( dialog_box = MDDialog(
@ -217,11 +218,14 @@ class DropDownWidget(BoxLayout):
self.ids.ti.focus = True self.ids.ti.focus = True
def is_camara_attached(self): def is_camara_attached(self):
"""Checks the camera availability in device"""
self.parent.parent.parent.ids.sc23.check_camera() self.parent.parent.parent.ids.sc23.check_camera()
is_available = self.parent.parent.parent.ids.sc23.camera_avaialbe is_available = self.parent.parent.parent.ids.sc23.camera_avaialbe
return is_available return is_available
def camera_alert(self): @staticmethod
def camera_alert():
"""Show camera availability alert message"""
width = .8 if platform == 'android' else .55 width = .8 if platform == 'android' else .55
altet_txt = 'Currently this feature is not avaialbe!'if platform == 'android' else 'Camera is not available!' altet_txt = 'Currently this feature is not avaialbe!'if platform == 'android' else 'Camera is not available!'
dialog_box = MDDialog( dialog_box = MDDialog(
@ -255,7 +259,7 @@ class MyTextInput(TextInput):
super(MyTextInput, self).__init__(**kwargs) super(MyTextInput, self).__init__(**kwargs)
self.__lineBreak__ = 0 self.__lineBreak__ = 0
def on_text(self, instance, value): def on_text(self, instance, value): # pylint: disable=unused-argument
"""Find all the occurrence of the word""" """Find all the occurrence of the word"""
self.parent.parent.parent.parent.parent.ids.rv.data = [] self.parent.parent.parent.parent.parent.ids.rv.data = []
matches = [self.word_list[i] for i in range( matches = [self.word_list[i] for i in range(

View File

@ -1,15 +1,19 @@
from bmconfigparser import BMConfigParser '''
This is for pamyent related part
from bitmessagekivy.baseclass.common import toast '''
from kivy.uix.boxlayout import BoxLayout from kivy.uix.boxlayout import BoxLayout
from kivymd.uix.behaviors.elevation import RectangularElevationBehavior from kivymd.uix.behaviors.elevation import RectangularElevationBehavior
from kivy.uix.screenmanager import Screen from kivy.uix.screenmanager import Screen
from kivymd.uix.label import MDLabel from kivymd.uix.label import MDLabel
from kivymd.uix.list import ( from kivymd.uix.list import (
IRightBodyTouch, IRightBodyTouch,
OneLineAvatarIconListItem OneLineAvatarIconListItem
) )
from bmconfigparser import BMConfigParser
from bitmessagekivy.baseclass.common import toast
import queues import queues
import state import state
@ -31,20 +35,21 @@ class Payment(Screen):
state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format( state.kivyapp.root.ids.sc18.ids.cred.text = '{0}'.format(
state.availabe_credit) state.availabe_credit)
def create_hidden_payment_address(self, instance): @staticmethod
def create_hidden_payment_address():
"""This is basically used for creating hidden address used in payment for purchasing credits""" """This is basically used for creating hidden address used in payment for purchasing credits"""
if BMConfigParser().paymentaddress(): # if BMConfigParser().paymentaddress():
toast('hidden payment address already exist for buying subscription...') # toast('hidden payment address already exist for buying subscription...')
else: # else:
streamNumberForAddress = 1 # streamNumberForAddress = 1
eighteenByteRipe = False # eighteenByteRipe = False
nonceTrialsPerByte = 1000 # nonceTrialsPerByte = 1000
payloadLengthExtraBytes = 1000 # payloadLengthExtraBytes = 1000
queues.addressGeneratorQueue.put(( # queues.addressGeneratorQueue.put((
'createPaymentAddress', 4, streamNumberForAddress, '', 1, # 'createPaymentAddress', 4, streamNumberForAddress, '', 1,
"", eighteenByteRipe, nonceTrialsPerByte, # "", eighteenByteRipe, nonceTrialsPerByte,
payloadLengthExtraBytes)) # payloadLengthExtraBytes))
toast('hidden payment address Creating for buying subscription....') # toast('hidden payment address Creating for buying subscription....')
class Category(BoxLayout, RectangularElevationBehavior): class Category(BoxLayout, RectangularElevationBehavior):

View File

@ -36,6 +36,9 @@ from kivy.uix.screenmanager import Screen
class ScanScreen(Screen): class ScanScreen(Screen):
"""ScanScreen is for scaning Qr code"""
# pylint: disable=unused-argument
# pylint: disable=W0212
camera_avaialbe = BooleanProperty(False) camera_avaialbe = BooleanProperty(False)
previous_open_screen = StringProperty() previous_open_screen = StringProperty()
pop_up_instance = ObjectProperty() pop_up_instance = ObjectProperty()
@ -88,6 +91,7 @@ class ScanScreen(Screen):
Clock.schedule_once(self.start_camera, 0) Clock.schedule_once(self.start_camera, 0)
def on_leave(self): def on_leave(self):
"""this methos will call on leave"""
# pass # pass
Clock.schedule_once(self.stop_camera, 0) Clock.schedule_once(self.stop_camera, 0)

View File

@ -186,7 +186,7 @@
MDFillRoundFlatIconButton: MDFillRoundFlatIconButton:
icon: "chevron-double-right" icon: "chevron-double-right"
text: app.tr._("Proceed Next") text: app.tr._("Proceed Next")
on_release: app.root.ids.sc7.generateaddress(app) on_release: app.root.ids.sc7.generateaddress()
Widget: Widget:

View File

@ -51,9 +51,9 @@ import state
from kivymd.uix.bottomsheet import MDCustomBottomSheet from kivymd.uix.bottomsheet import MDCustomBottomSheet
from kivy.lang import Observable from kivy.lang import Observable
import gettext # import gettext
import l10n # import l10n
import locale # import locale
import ast import ast
from bitmessagekivy.baseclass.common import toast from bitmessagekivy.baseclass.common import toast
@ -234,8 +234,8 @@ class NavigateApp(MDApp):
Builder.load_file( Builder.load_file(
os.path.join( os.path.join(
os.path.dirname(__file__), os.path.dirname(__file__),
"kv", 'kv',
f"{all_data[kv]['kv_string']}.kv", f'{all_data[kv]["kv_string"]}.kv',
) )
) )
# self.obj_1 = AddressBook() # self.obj_1 = AddressBook()

View File

@ -1,17 +1,23 @@
"""
This module is used for running test cases ui order.
"""
import unittest import unittest
def make_ordered_test(): def make_ordered_test():
"""this method is for compairing and arranging in order"""
order = {} order = {}
def ordered(f): def ordered_method(f):
"""method for ordering"""
order[f.__name__] = len(order) order[f.__name__] = len(order)
return f return f
def compare(a, b): def compare_method(a, b):
"""method for compairing order of methods"""
return [1, -1][order[a] < order[b]] return [1, -1][order[a] < order[b]]
return ordered, compare return ordered_method, compare_method
ordered, compare = make_ordered_test() ordered, compare = make_ordered_test()

View File

@ -8,6 +8,7 @@ from string import ascii_lowercase
class CreateRandomAddress(TeleniumTestProcess): class CreateRandomAddress(TeleniumTestProcess):
"""This is for testing randrom address creation"""
@classmethod @classmethod
def setUpClass(cls): def setUpClass(cls):

View File

@ -10,7 +10,7 @@ class NetwrokStatusScreen(TeleniumTestProcess):
self.cli.sleep(4) self.cli.sleep(4)
self.cli.execute('app.clickNavDrawer()') self.cli.execute('app.clickNavDrawer()')
self.cli.sleep(3) self.cli.sleep(3)
self.cli.drag("//NavigationItem[@text=\"Sent\"]","//NavigationItem[@text=\"Inbox\"]",1) self.cli.drag("//NavigationItem[@text=\"Sent\"]", "//NavigationItem[@text=\"Inbox\"]", 1)
self.cli.sleep(3) self.cli.sleep(3)
self.cli.click_on('//NavigationItem[10]') self.cli.click_on('//NavigationItem[10]')
self.cli.sleep(4) self.cli.sleep(4)