From 4a0601fac2c679e7af7b6948ce9d11d54de7f0a0 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> Date: Sun, 26 Sep 2021 10:47:01 +0200 Subject: [PATCH] Overridden methods should have identical parameters This fixes a DeepSource alert: Mismatched parameters in overridden method Python will allow this, but if the overridden method is intended to be executed from external code, you may want to reconsider this. Overriding a method without ensuring that both methods accept the same number and type of parameters has the potential to cause an error when the overriding method is called with a number of parameters that is illegal for the overridden method. This violates the Liskov substitution principle. Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com> --- trojans/tncc-emulate.py | 4 ++-- www/html.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/trojans/tncc-emulate.py b/trojans/tncc-emulate.py index 227be35e..0c918a64 100755 --- a/trojans/tncc-emulate.py +++ b/trojans/tncc-emulate.py @@ -655,8 +655,8 @@ def fingerprint_checking_SSLSocket(_fingerprint): class SSLSocket(ssl.SSLSocket): fingerprint = _fingerprint - def do_handshake(self, *args, **kw): - res = super().do_handshake(*args, **kw) + def do_handshake(self): + res = super().do_handshake() der_bytes = self.getpeercert(True) cert = asn1crypto.x509.Certificate.load(der_bytes) pubkey = cert.public_key.dump() diff --git a/www/html.py b/www/html.py index 2b7b69db..21c46149 100755 --- a/www/html.py +++ b/www/html.py @@ -137,8 +137,8 @@ class docHandler(xml.sax.ContentHandler): writeHtml(" " + name + "=\"" + attrs.get(name) + "\"") writeHtml(" />" if name == "br" else ">") - def characters(self, ch): - self.content += ch + def characters(self, content): + self.content += content def endElement(self, name): -- 2.49.0