mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-08-04 12:18:20 +00:00
chore: Remove obvious comments from code
Removed redundant comments that simply restate what the code is doing. Kept only comments that provide valuable context or explain complex behavior. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
3ab62b617d
commit
1791031d20
2 changed files with 6 additions and 34 deletions
|
@ -184,7 +184,6 @@ class SubprocessCLITransport(Transport):
|
|||
async with anyio.create_task_group() as tg:
|
||||
tg.start_soon(read_stderr)
|
||||
|
||||
# Buffer for incomplete JSON
|
||||
json_buffer = ""
|
||||
|
||||
try:
|
||||
|
@ -193,7 +192,6 @@ class SubprocessCLITransport(Transport):
|
|||
if not line_str:
|
||||
continue
|
||||
|
||||
# Split on newlines in case multiple JSON objects are buffered together
|
||||
json_lines = line_str.split("\n")
|
||||
|
||||
for json_line in json_lines:
|
||||
|
@ -201,12 +199,10 @@ class SubprocessCLITransport(Transport):
|
|||
if not json_line:
|
||||
continue
|
||||
|
||||
# Add to buffer
|
||||
json_buffer += json_line
|
||||
|
||||
# Check buffer size
|
||||
if len(json_buffer) > _MAX_BUFFER_SIZE:
|
||||
json_buffer = "" # Clear buffer to prevent repeated errors
|
||||
json_buffer = ""
|
||||
raise SDKJSONDecodeError(
|
||||
f"JSON message exceeded maximum buffer size of {_MAX_BUFFER_SIZE} bytes",
|
||||
ValueError(
|
||||
|
@ -216,14 +212,12 @@ class SubprocessCLITransport(Transport):
|
|||
|
||||
try:
|
||||
data = json.loads(json_buffer)
|
||||
json_buffer = "" # Clear buffer on successful parse
|
||||
json_buffer = ""
|
||||
try:
|
||||
yield data
|
||||
except GeneratorExit:
|
||||
# Handle generator cleanup gracefully
|
||||
return
|
||||
except json.JSONDecodeError:
|
||||
# Continue accumulating in buffer
|
||||
continue
|
||||
|
||||
except anyio.ClosedResourceError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue