Skip to content

Commit d6dc841

Browse files
Bucknallaclaude
andcommitted
Fix pydocstyle violations in receive_binary.py
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 80ca1c2 commit d6dc841

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

examples/binary-mode/upload/receive_binary.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
#!/usr/bin/env python3
2-
"""
3-
receive_binary.py
2+
"""Minimal HTTP server that receives binary files routed from Notehub.
43
5-
A minimal HTTP server that receives binary files routed from Notehub
6-
via a General HTTP/HTTPS route and saves them to the current directory.
4+
Receives binary files via a General HTTP/HTTPS route and saves them to
5+
the current directory.
76
87
Usage:
98
python3 receive_binary.py [port]
@@ -76,10 +75,7 @@ def infer_extension(data: bytes) -> str:
7675

7776

7877
def make_filename(label: str, data: bytes) -> str:
79-
"""
80-
Use the Notecard's label if provided, otherwise generate a timestamped
81-
filename with an inferred extension.
82-
"""
78+
"""Return the label if provided, or a timestamped filename."""
8379
if label:
8480
return label
8581
ext = infer_extension(data)
@@ -88,7 +84,10 @@ def make_filename(label: str, data: bytes) -> str:
8884

8985

9086
class BinaryReceiveHandler(BaseHTTPRequestHandler):
87+
"""Handle incoming binary POST requests from Notehub."""
88+
9189
def do_POST(self):
90+
"""Receive a binary file and save it to disk."""
9291
# Read body, handling both Content-Length and chunked encoding
9392
content_length = self.headers.get("Content-Length")
9493
transfer_encoding = self.headers.get("Transfer-Encoding", "")
@@ -125,11 +124,12 @@ def _respond(self, code: int, message: str):
125124
self.wfile.write(message.encode())
126125

127126
def log_message(self, format, *args):
128-
# Suppress default request logging — we handle it ourselves
127+
"""Suppress default request logging."""
129128
pass
130129

131130

132131
def main():
132+
"""Start the binary receive server."""
133133
port = int(sys.argv[1]) if len(sys.argv) > 1 else DEFAULT_PORT
134134
server = HTTPServer(("", port), BinaryReceiveHandler)
135135
print(f"Listening on port {port}. Saving files to: {os.getcwd()}")

0 commit comments

Comments
 (0)