fixed flake8, pycodestyle and pylint issues

This commit is contained in:
navjot 2020-05-13 21:31:22 +05:30
parent a8e1e7a760
commit b4a7bcc3b2
No known key found for this signature in database
GPG Key ID: 9EE70AFD71357F1C
2 changed files with 20 additions and 20 deletions

View File

@ -3,6 +3,7 @@ Bitmessage android(mobile) interface
""" """
# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument # 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=too-many-ancestors,too-many-locals,useless-super-delegation
# pylint: disable=protected-access
import os import os
import time import time
from bitmessagekivy import identiconGeneration from bitmessagekivy import identiconGeneration
@ -118,7 +119,7 @@ def AddTimeWidget(time): # pylint: disable=redefined-outer-name
text=str(ShowTimeHistoy(time)), text=str(ShowTimeHistoy(time)),
font_style='Caption', font_style='Caption',
size=[120, 140] if platform == 'android' else [64, 80]) size=[120, 140] if platform == 'android' else [64, 80])
action_time.font_size='11sp' action_time.font_size = '11sp'
return action_time return action_time
@ -126,7 +127,7 @@ def chipTag(text):
"""This method is used for showing chip tag""" """This method is used for showing chip tag"""
obj = MDChip() obj = MDChip()
# obj.size_hint = (None, None) # obj.size_hint = (None, None)
obj.size_hint = (.16 if platform == 'android' else .07 , None) obj.size_hint = (.16 if platform == 'android' else .07, None)
obj.label = text obj.label = text
obj.icon = '' obj.icon = ''
obj.pos_hint = {'center_x': .91 if platform == 'android' else .94, 'center_y': .3} obj.pos_hint = {'center_x': .91 if platform == 'android' else .94, 'center_y': .3}
@ -221,7 +222,7 @@ class Inbox(Screen):
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
meny._txt_right_pad=dp(70) meny._txt_right_pad = dp(70)
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format( source='./images/text_images/{}.png'.format(
avatarImageFirstLetter(item['secondary_text'].strip())))) avatarImageFirstLetter(item['secondary_text'].strip()))))
@ -407,7 +408,7 @@ class MyAddress(Screen):
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom' if is_enable == 'true' else 'Primary', theme_text_color='Custom' if is_enable == 'true' else 'Primary',
text_color=NavigateApp().theme_cls.primary_color,) text_color=NavigateApp().theme_cls.primary_color,)
meny._txt_right_pad=dp(70) meny._txt_right_pad = dp(70)
try: try:
meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5]
except Exception: except Exception:
@ -420,11 +421,11 @@ class MyAddress(Screen):
if state.association == item['secondary_text']: if state.association == item['secondary_text']:
badge_obj = BadgeText( badge_obj = BadgeText(
size_hint=(None, None), size_hint=(None, None),
size=[85 if platform == 'android' else 50, 60],
text='Active', halign='center', text='Active', halign='center',
# font_size = '50sp', font_style='Body1', theme_text_color='Custom',
font_style='Body1', size=[85 if platform == 'android' else 50, 60], text_color=NavigateApp().theme_cls.primary_color
theme_text_color='Custom', )
text_color=NavigateApp().theme_cls.primary_color)
badge_obj.font_size = '13sp' badge_obj.font_size = '13sp'
meny.add_widget(badge_obj) meny.add_widget(badge_obj)
else: else:
@ -1127,7 +1128,7 @@ class Sent(Screen):
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
meny._txt_right_pad=dp(70) meny._txt_right_pad = dp(70)
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format( source='./images/text_images/{}.png'.format(
avatarImageFirstLetter(item['secondary_text'].strip())))) avatarImageFirstLetter(item['secondary_text'].strip()))))
@ -1346,7 +1347,7 @@ class Trash(Screen):
subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
meny._txt_right_pad=dp(70) meny._txt_right_pad = dp(70)
img_latter = './images/text_images/{}.png'.format( img_latter = './images/text_images/{}.png'.format(
subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!') subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!')
meny.add_widget(AvatarSampleWidget(source=img_latter)) meny.add_widget(AvatarSampleWidget(source=img_latter))
@ -2604,7 +2605,7 @@ class Draft(Screen):
text='Draft', secondary_text=item['text'], text='Draft', secondary_text=item['text'],
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
meny._txt_right_pad=dp(70) meny._txt_right_pad = dp(70)
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/avatar.png')) source='./images/avatar.png'))
meny.bind(on_press=partial( meny.bind(on_press=partial(
@ -2807,7 +2808,7 @@ class Allmails(Screen):
subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''),
theme_text_color='Custom', theme_text_color='Custom',
text_color=NavigateApp().theme_cls.primary_color) text_color=NavigateApp().theme_cls.primary_color)
meny._txt_right_pad=dp(70) meny._txt_right_pad = dp(70)
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source='./images/text_images/{}.png'.format( source='./images/text_images/{}.png'.format(
avatarImageFirstLetter(body.strip())))) avatarImageFirstLetter(body.strip()))))

View File

@ -11,13 +11,12 @@ class TestCharMessage(unittest.TestCase):
""" """
def test_decode(self): def test_decode(self):
"""Test various types of decode method""" """Test various types of decode method"""
chat_obj = Chatmsg()
import messagetypes import messagetypes
result = messagetypes.constructObject({'': 'chatmsg', 'message': 'hello world'}) result = messagetypes.constructObject({'': 'chatmsg', 'message': 'hello world'})
self.assertTrue(isinstance(result.message, str)) self.assertTrue(isinstance(result.message, str))
def test_encode(self): def test_encode(self):
"""Test various types of encode method"""
chat_obj = Chatmsg() chat_obj = Chatmsg()
result = chat_obj.encode({'message':'hello world'}) result = chat_obj.encode({'message': 'hello world'})
self.assertTrue(True if result['message'] else False) self.assertTrue(True if result['message'] else False)