]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
Overridden methods should have identical parameters
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Sun, 26 Sep 2021 08:47:01 +0000 (10:47 +0200)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Sat, 26 Feb 2022 15:51:05 +0000 (16:51 +0100)
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
www/html.py

index 227be35e0a0b5c857d7ed68499f9ea4605189591..0c918a64f0627f50b8974a17f6b73368368fe243 100755 (executable)
@@ -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()
index 2b7b69db4582f6622e178e8ea3966de489ef54b2..21c46149b79c9dace205b57d1dd523c89aeb43ec 100755 (executable)
@@ -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):