From 2303a4d4e54d36da64c9b4b48090d6416e1b32ef Mon Sep 17 00:00:00 2001 From: "kuldeep.k@cisinlabs.com" Date: Fri, 27 Aug 2021 21:31:23 +0530 Subject: [PATCH] Updated code quality ignore bare except warning & replaced unicode by decode function --- src/class_smtpServer.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/class_smtpServer.py b/src/class_smtpServer.py index 2133c7f9..c84461ba 100644 --- a/src/class_smtpServer.py +++ b/src/class_smtpServer.py @@ -55,7 +55,7 @@ class smtpServerChannel(smtpd.SMTPChannel): self.push('235 2.7.0 Authentication successful') else: raise Exception("Auth fail") - except: + except: # noqa:E722 self.push('501 Authentication fail') def smtp_DATA(self, arg): @@ -108,7 +108,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer): ret = [] for h in decode_header(self.msg_headers[hdr]): if h[1]: - ret.append(unicode(h[0], h[1])) + ret.append(h[0].decode(h[1])) else: ret.append(h[0].decode("utf-8", errors='replace')) @@ -123,7 +123,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer): return try: self.msg_headers = Parser().parsestr(data) - except: + except: # noqa:E722 logger.error('Invalid headers') return @@ -149,7 +149,7 @@ class smtpServerPyBitmessage(smtpd.SMTPServer): try: msg_subject = self.decode_header('subject')[0] - except: + except: # noqa:E722 msg_subject = "Subject missing..." msg_tmp = email.message_from_string(data)