diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 3d8d33aa..7b7dcf07 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -1,11 +1,8 @@ """Coding: utf-8.""" import time from functools import partial - from bmconfigparser import BMConfigParser - from helper_sql import sqlExecute, sqlQuery - from kivy.app import App from kivy.clock import Clock from kivy.core.window import Window @@ -33,9 +30,7 @@ from kivy.uix.screenmanager import Screen from kivy.uix.spinner import Spinner from kivy.uix.textinput import TextInput from kivy.utils import platform - import kivy_helper_search - from kivymd.button import MDIconButton from kivymd.dialog import MDDialog from kivymd.label import MDLabel @@ -52,23 +47,14 @@ from kivymd.navigationdrawer import ( from kivymd.selectioncontrols import MDCheckbox from kivymd.textfields import MDTextField from kivymd.theming import ThemeManager - import queues - from semaphores import kivyuisignaler - import state - from uikivysignaler import UIkivySignaler - import identiconGeneration - import os - from kivy.core.clipboard import Clipboard - -# pylint: disable=unused-argument -# pylint: disable=broad-except +# pylint: disable=unused-argument, too-few-public-methods def toast(text): @@ -82,7 +68,6 @@ def toast(text): class Navigatorss(MDNavigationDrawer): """Navigators class contains image, title and logo.""" - # pylint: disable=too-few-public-methods image_source = StringProperty('images/qidenticon_two.png') title = StringProperty('Navigation') drawer_logo = StringProperty() @@ -258,10 +243,12 @@ class MyAddress(Screen): def init_ui(self, dt=0): """Clock Schdule for method inbox accounts.""" + # pylint: disable=unnecessary-lambda, deprecated-lambda addresses_list = state.kivyapp.variable_1 if state.searcing_text: - filtered_list = filter(lambda addr: self.filter_address( - addr), BMConfigParser().addresses()) + filtered_list = filter( + lambda addr: self.filter_address( + addr), BMConfigParser().addresses()) addresses_list = filtered_list if addresses_list: data = [] @@ -324,6 +311,7 @@ class MyAddress(Screen): @staticmethod def filter_address(address): """Method will filter the my address list data.""" + # pylint: disable=deprecated-lambda if filter(lambda x: (state.searcing_text).lower() in x, [ BMConfigParser().get( address, 'label').lower(), address.lower()]): @@ -416,7 +404,6 @@ class SelectableRecycleBoxLayout(FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout): """Adds selection and focus behaviour to the view.""" - # pylint: disable=too-few-public-methods pass @@ -453,8 +440,7 @@ class SelectableLabel(RecycleDataViewBehavior, Label): class RV(RecycleView): """Recycling View.""" - # pylint: disable=too-few-public-methods - def __init__(self, **kwargs): + def __init__(self, **kwargs): # pylint: disable=useless-super-delegation """Recycling Method.""" super(RV, self).__init__(**kwargs) @@ -465,7 +451,7 @@ class DropDownWidget(BoxLayout): txt_input = ObjectProperty() rv = ObjectProperty() - def send(self, navApp): + def send(self, navApp): # pylint: disable=too-many-statements, inconsistent-return-statements """Send message from one address to another.""" # pylint: disable=too-many-locals fromAddress = str(self.ids.ti.text) @@ -604,7 +590,7 @@ class MyTextInput(TextInput): starting_no = NumericProperty(3) suggestion_text = '' - def __init__(self, **kwargs): + def __init__(self, **kwargs): # pylint: disable=useless-super-delegation """Getting Text Input.""" super(MyTextInput, self).__init__(**kwargs) @@ -635,21 +621,18 @@ class MyTextInput(TextInput): class Payment(Screen): """Payment Method.""" - # pylint: disable=too-few-public-methods pass class Login(Screen): """Login Screeen.""" - # pylint: disable=too-few-public-methods pass class NetworkStat(Screen): """Method used to show network stat.""" - # pylint: disable=too-few-public-methods text_variable_1 = StringProperty( '{0}::{1}'.format('Total Connections', '0')) text_variable_2 = StringProperty( @@ -685,14 +668,12 @@ class NetworkStat(Screen): class ContentNavigationDrawer(Navigatorss): """Navigate Content Drawer.""" - # pylint: disable=too-few-public-methods pass class Random(Screen): """Generates Random Address.""" - # pylint: disable=too-few-public-methods is_active = BooleanProperty(False) checked = StringProperty("") @@ -723,7 +704,6 @@ class Random(Screen): class AddressSuccessful(Screen): """Getting Address Detail.""" - # pylint: disable=too-few-public-methods pass @@ -883,8 +863,6 @@ class Sent(Screen): class Trash(Screen): """Trash Screen uses screen to show widgets of screens.""" - # pylint: disable=too-few-public-methods - def __init__(self, *args, **kwargs): """Trash method, delete sent message and add in Trash.""" super(Trash, self).__init__(*args, **kwargs) @@ -956,15 +934,12 @@ class Trash(Screen): class Page(Screen): """Page Screen show widgets of page.""" - # pylint: disable=too-few-public-methods pass class Create(Screen): """Creates the screen widgets.""" - # pylint: disable=too-few-public-methods - def __init__(self, **kwargs): """Getting Labels and address from addressbook.""" super(Create, self).__init__(**kwargs) @@ -979,11 +954,10 @@ class Create(Screen): class Setting(Screen): """Setting the Screen components.""" - # pylint: disable=too-few-public-methods pass -class NavigateApp(App): +class NavigateApp(App): # pylint: disable=too-many-public-methods """Navigation Layout of class.""" theme_cls = ThemeManager() @@ -1111,15 +1085,18 @@ class NavigateApp(App): return BMConfigParser().addresses()[0] return 'Select Address' - def createFolder(self, directory): + @staticmethod + def createFolder(directory): """This method is used to create the directory when app starts""" try: if not os.path.exists(directory): os.makedirs(directory) except OSError: - print('Error: Creating directory. ' + directory) + print 'Error: Creating directory. ' + directory - def get_default_image(self): + @staticmethod + def get_default_image(): + """Getting default image on address""" if BMConfigParser().addresses(): # BMConfigParser().addresses()[0] return './images/default_identicon/{}.png'.format(BMConfigParser().addresses()[0]) @@ -1316,7 +1293,9 @@ class NavigateApp(App): img.x = 5 self.root.children[2].children[0].ids.btn.add_widget(img) - def address_identicon(self): + @staticmethod + def address_identicon(): + """Address identicon""" return './images/drawer_logo1.png' @@ -1381,6 +1360,7 @@ class GrashofPopup(Popup): toast('Canceled') def checkAddress_valid(self, instance): + """Checking is address is valid or not""" my_addresses = self.parent.children[1].children[2].children[0].ids.btn.values add_book = [addr[1] for addr in kivy_helper_search.search_sql( folder="addressbook")] @@ -1408,21 +1388,18 @@ class GrashofPopup(Popup): class AvatarSampleWidget(ILeftBody, Image): """Avatar Sample Widget.""" - # pylint: disable=too-few-public-methods pass class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton): """Left icon sample widget.""" - # pylint: disable=too-few-public-methods pass class IconRightSampleWidget(IRightBodyTouch, MDCheckbox): """Right icon sample widget.""" - # pylint: disable=too-few-public-methods pass @@ -1560,7 +1537,8 @@ class MailDetail(Screen): self.parent.parent.current = 'create' navApp.set_navbar_for_composer() - def copy_composer_text(self, instance, *args): + @staticmethod + def copy_composer_text(instance, *args): """This method is used for copying the data from mail detail page""" if len(instance.parent.text.split(':')) > 1: cpy_text = instance.parent.text.split(':')[1].strip() @@ -1659,8 +1637,6 @@ class AddbookDetailPopup(Popup): class ShowQRCode(Screen): """ShowQRCode Screen uses to show the detail of mails.""" - # pylint: disable=too-few-public-methods - def qrdisplay(self): """Method used for showing QR Code.""" self.manager.parent.parent.parent.ids.search_bar.clear_widgets() @@ -1844,8 +1820,6 @@ class Draft(Screen): class CustomSpinner(Spinner): """This class is used for setting spinner size.""" - # pylint: disable=too-few-public-methods - def __init__(self, *args, **kwargs): """Method used for setting size of spinner.""" super(CustomSpinner, self).__init__(*args, **kwargs)