Skip to content

Commit 3af6388

Browse files
committed
Fix minor typechecking issues
These changes ought to be no-ops. There are a few spots where PyLance flags inconsistent return types or the lack of a method definition and this plugs those small holes.
1 parent c34e90f commit 3af6388

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

src/waitress/channel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def writable(self):
8585
# the channel (possibly by our server maintenance logic), run
8686
# handle_write
8787

88-
return self.total_outbufs_len or self.will_close or self.close_when_flushed
88+
return self.total_outbufs_len > 0 or self.will_close or self.close_when_flushed
8989

9090
def handle_write(self):
9191
# Precondition: there's data in the out buffer to be sent, or
@@ -135,6 +135,8 @@ def _flush_exception(self, flush, do_close=True):
135135

136136
return (False, True)
137137

138+
return (False, False)
139+
138140
def readable(self):
139141
# We might want to read more requests. We can only do this if:
140142
# 1. We're not already about to close the connection.

src/waitress/task.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,9 @@ def remove_content_length_header(self):
295295
def start(self):
296296
self.start_time = time.time()
297297

298+
def execute(self):
299+
raise NotImplementedError # pragma: no cover
300+
298301
def finish(self):
299302
if not self.wrote_header:
300303
self.write(b"")

src/waitress/wasyncore.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ def del_channel(self, map=None):
328328
def create_socket(self, family=socket.AF_INET, type=socket.SOCK_STREAM):
329329
self.family_and_type = family, type
330330
sock = socket.socket(family, type)
331-
sock.setblocking(0)
331+
sock.setblocking(False)
332332
self.set_socket(sock)
333333

334334
def set_socket(self, sock, map=None):
@@ -353,10 +353,10 @@ def set_reuse_addr(self):
353353
# to pass to select().
354354
# ==================================================
355355

356-
def readable(self):
356+
def readable(self) -> bool:
357357
return True
358358

359-
def writable(self):
359+
def writable(self) -> bool:
360360
return True
361361

362362
# ==================================================

0 commit comments

Comments
 (0)