mpybit pylint fixes

This commit is contained in:
lakshyacis 2019-09-09 19:47:07 +05:30
parent 8043adcff0
commit dfe518520b
No known key found for this signature in database
GPG Key ID: D2C539C8EC63E9EB

View File

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