summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Ewalds <timo@ewalds.ca>2023-05-12 10:33:10 +0100
committerGitHub <noreply@github.com>2023-05-12 11:33:10 +0200
commit440365bb424e33c69ad1aafe3c3faa96cbc43043 (patch)
tree88ee68f53fa1b0e7006984d241bb49998b52c9d1
parent0fa5669fbd1d57a4bb1da580b3879f68d15a6d57 (diff)
downloadwebsocket-client-master.tar.gz
Fix a few errors found by pytype. (#906)HEADmaster
* Fix pytype error: File "websocket/_wsdump.py", line 107, in <module>: Overriding method signature mismatch [signature-mismatch] Base signature: 'def code.InteractiveConsole.raw_input(self, prompt: str = ...) -> str'. Subclass signature: 'def RawInput.raw_input(self, prompt) -> Any'. Parameter 'prompt' must have a default value. * Fix pytype error: File "websocket/tests/echo-server.py", line 18, in main: Function Serve.__init__ was called with the wrong arguments [wrong-arg-types] Expected: (self, ws_handler, host, port: Optional[int] = ..., ...) Actually passed: (self, ws_handler, host, port: str) * Fix undefined variable error found by pytype: File "compliance/test_fuzzingclient.py", line 57, in <module>: Name 'case' is not defined [name-error]
-rw-r--r--compliance/test_fuzzingclient.py1
-rwxr-xr-xwebsocket/_wsdump.py2
-rw-r--r--websocket/tests/echo-server.py2
3 files changed, 3 insertions, 2 deletions
diff --git a/compliance/test_fuzzingclient.py b/compliance/test_fuzzingclient.py
index 48db6e1..2d33d54 100644
--- a/compliance/test_fuzzingclient.py
+++ b/compliance/test_fuzzingclient.py
@@ -30,6 +30,7 @@ count = json.loads(ws.recv())
ws.close()
+case = 0
for case in range(1, count + 1):
url = SERVER + '/runCase?case={0}&agent={1}'.format(case, AGENT)
status = websocket.STATUS_NORMAL
diff --git a/websocket/_wsdump.py b/websocket/_wsdump.py
index 757c359..d8f9bdc 100755
--- a/websocket/_wsdump.py
+++ b/websocket/_wsdump.py
@@ -93,7 +93,7 @@ def parse_args():
class RawInput:
- def raw_input(self, prompt):
+ def raw_input(self, prompt=""):
line = input(prompt)
if ENCODING and ENCODING != "utf-8" and not isinstance(line, str):
diff --git a/websocket/tests/echo-server.py b/websocket/tests/echo-server.py
index 08d108a..42dd9e4 100644
--- a/websocket/tests/echo-server.py
+++ b/websocket/tests/echo-server.py
@@ -6,7 +6,7 @@ import asyncio
import websockets
import os
-LOCAL_WS_SERVER_PORT = os.environ.get('LOCAL_WS_SERVER_PORT', '8765')
+LOCAL_WS_SERVER_PORT = int(os.environ.get('LOCAL_WS_SERVER_PORT', '8765'))
async def echo(websocket, path):