Code quality

This commit is contained in:
Peter Šurda 2024-02-22 13:27:21 +08:00
parent b3c5900eb3
commit d545630ac7
Signed by: PeterSurda
GPG Key ID: 3E47497CF67ABB95
4 changed files with 8 additions and 13 deletions

View File

@ -116,10 +116,8 @@ class MyAddress(Screen, HelperMyAddress):
text=item['text'], secondary_text=item['secondary_text'], text=item['text'], secondary_text=item['secondary_text'],
theme_text_color='Custom' if is_enable else 'Primary', theme_text_color='Custom' if is_enable else 'Primary',
text_color=ThemeClsColor,) text_color=ThemeClsColor,)
try: meny.canvas.children[3].rgba = \
meny.canvas.children[3].rgba = self.canvas_color_black if is_enable else self.canvas_color self.canvas_color_black if is_enable else self.canvas_color
except Exception:
pass
meny.add_widget(AvatarSampleWidget( meny.add_widget(AvatarSampleWidget(
source=os.path.join( source=os.path.join(
self.image_dir, "text_images", "{}.png".format(avatar_image_first_letter( self.image_dir, "text_images", "{}.png".format(avatar_image_first_letter(

View File

@ -40,7 +40,7 @@ def generate_hash(string):
try: try:
# make input case insensitive # make input case insensitive
string = str.lower(string) string = str.lower(string)
hash_object = hashlib.md5(str.encode(string)) hash_object = hashlib.md5(str.encode(string)) # nosec B303
print(hash_object.hexdigest()) print(hash_object.hexdigest())
# returned object is a hex string # returned object is a hex string
return hash_object.hexdigest() return hash_object.hexdigest()

View File

@ -405,13 +405,10 @@ class NavigateApp(MDApp):
img_path = os.path.join( img_path = os.path.join(
self.image_dir, 'default_identicon', '{}.png'.format(self.kivy_state_obj.selected_address) self.image_dir, 'default_identicon', '{}.png'.format(self.kivy_state_obj.selected_address)
) )
try:
if os.path.exists(img_path): if os.path.exists(img_path):
os.remove(img_path) os.remove(img_path)
self.root.ids.content_drawer.ids.reset_image.opacity = 0 self.root.ids.content_drawer.ids.reset_image.opacity = 0
self.root.ids.content_drawer.ids.reset_image.disabled = True self.root.ids.content_drawer.ids.reset_image.disabled = True
except Exception as e:
pass
toast('Avatar reset') toast('Avatar reset')
def get_default_logo(self, instance): def get_default_logo(self, instance):

View File

@ -479,7 +479,7 @@ class objectProcessor(threading.Thread):
logger.info( logger.info(
'EC decryption successful using key associated' 'EC decryption successful using key associated'
' with ripe hash: %s.', hexlify(key)) ' with ripe hash: %s.', hexlify(key))
except Exception: except Exception: # nosec B110
pass pass
if not initialDecryptionSuccessful: if not initialDecryptionSuccessful:
# This is not a message bound for me. # This is not a message bound for me.