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
import os
import sys
from multiprocessing import cpu_count
import sh
@ -47,4 +45,5 @@ class BitmsghashRecipe(Recipe):
self.install_libs(arch, '{}/libbitmsghash.so'.format(dst_dir),
'libbitmsghash.so')
recipe = BitmsghashRecipe()

View File

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

View File

@ -14,6 +14,7 @@ from bitmessagekivy.baseclass.common import toast
class Login(Screen):
"""Login Screeen class for kivy Ui"""
# pylint: disable=too-few-public-methods
log_text1 = (
'You may generate addresses by using either random numbers'
' or by using a passphrase If you use a passphrase, the address'
@ -35,7 +36,7 @@ class Random(Screen):
is_active = BooleanProperty(False)
checked = StringProperty("")
def generateaddress(self, navApp):
def generateaddress(self):
"""Method for Address Generator"""
# entered_label = str(self.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'
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"""
state.kivyapp.loadMyAddressScreen(False)
state.kivyapp.root.ids.sc10.ids.ml.clear_widgets()
@ -94,7 +95,7 @@ class Random(Screen):
instance.error = False
instance.helper_text = 'This field is required'
def reset_address_label(self, n):
def reset_address_label(self):
"""Resetting address labels"""
if not self.ids.add_random_bx.children:
self.ids.add_random_bx.add_widget(RandomBoxlayout())
@ -102,7 +103,9 @@ class Random(Screen):
class InfoLayout(BoxLayout, RectangularElevationBehavior):
"""InfoLayout class for kivy Ui"""
# pylint: disable=too-few-public-methods
class RandomBoxlayout(BoxLayout):
"""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.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"""
if self.children[1].ids.btn.is_open:
self.children[1].ids.btn.is_open = False
@ -177,14 +177,15 @@ class DropDownWidget(BoxLayout):
self.address_error_message(msg)
@staticmethod
def callback_for_msgsend(dt=0):
def callback_for_msgsend(dt=0): # pylint: disable=unused-argument
"""Callback method for messagesend"""
state.kivyapp.root.ids.sc3.children[0].active = False
state.in_sent_method = True
state.kivyapp.back_press()
toast("sent")
def address_error_message(self, msg):
@staticmethod
def address_error_message(msg):
"""Generates error message"""
width = .8 if platform == 'android' else .55
dialog_box = MDDialog(
@ -217,11 +218,14 @@ class DropDownWidget(BoxLayout):
self.ids.ti.focus = True
def is_camara_attached(self):
"""Checks the camera availability in device"""
self.parent.parent.parent.ids.sc23.check_camera()
is_available = self.parent.parent.parent.ids.sc23.camera_avaialbe
return is_available
def camera_alert(self):
@staticmethod
def camera_alert():
"""Show camera availability alert message"""
width = .8 if platform == 'android' else .55
altet_txt = 'Currently this feature is not avaialbe!'if platform == 'android' else 'Camera is not available!'
dialog_box = MDDialog(
@ -255,7 +259,7 @@ class MyTextInput(TextInput):
super(MyTextInput, self).__init__(**kwargs)
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"""
self.parent.parent.parent.parent.parent.ids.rv.data = []
matches = [self.word_list[i] for i in range(

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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