mirror of
https://github.com/anthropics/claude-code-sdk-python.git
synced 2025-07-07 14:45:00 +00:00
Fix linting issues - use lowercase variable names
This commit is contained in:
parent
4460dfbe3b
commit
be040c6161
1 changed files with 6 additions and 6 deletions
|
@ -174,8 +174,8 @@ class SubprocessCLITransport(Transport):
|
||||||
raise CLIConnectionError("Not connected")
|
raise CLIConnectionError("Not connected")
|
||||||
|
|
||||||
# Safety constants
|
# Safety constants
|
||||||
MAX_STDERR_SIZE = 10 * 1024 * 1024 # 10MB
|
max_stderr_size = 10 * 1024 * 1024 # 10MB
|
||||||
STDERR_TIMEOUT = 30.0 # 30 seconds
|
stderr_timeout = 30.0 # 30 seconds
|
||||||
|
|
||||||
json_buffer = ""
|
json_buffer = ""
|
||||||
|
|
||||||
|
@ -228,13 +228,13 @@ class SubprocessCLITransport(Transport):
|
||||||
if self._stderr_stream:
|
if self._stderr_stream:
|
||||||
try:
|
try:
|
||||||
# Use timeout to prevent hanging
|
# Use timeout to prevent hanging
|
||||||
with anyio.fail_after(STDERR_TIMEOUT):
|
with anyio.fail_after(stderr_timeout):
|
||||||
async for line in self._stderr_stream:
|
async for line in self._stderr_stream:
|
||||||
line_text = line.strip()
|
line_text = line.strip()
|
||||||
line_size = len(line_text)
|
line_size = len(line_text)
|
||||||
|
|
||||||
# Enforce memory limit
|
# Enforce memory limit
|
||||||
if stderr_size + line_size > MAX_STDERR_SIZE:
|
if stderr_size + line_size > max_stderr_size:
|
||||||
stderr_lines.append(
|
stderr_lines.append(
|
||||||
f"[stderr truncated after {stderr_size} bytes]"
|
f"[stderr truncated after {stderr_size} bytes]"
|
||||||
)
|
)
|
||||||
|
@ -248,7 +248,7 @@ class SubprocessCLITransport(Transport):
|
||||||
|
|
||||||
except TimeoutError:
|
except TimeoutError:
|
||||||
stderr_lines.append(
|
stderr_lines.append(
|
||||||
f"[stderr collection timed out after {STDERR_TIMEOUT}s]"
|
f"[stderr collection timed out after {stderr_timeout}s]"
|
||||||
)
|
)
|
||||||
except anyio.ClosedResourceError:
|
except anyio.ClosedResourceError:
|
||||||
pass
|
pass
|
||||||
|
@ -262,7 +262,7 @@ class SubprocessCLITransport(Transport):
|
||||||
stderr_output = "\n".join(stderr_lines) if stderr_lines else ""
|
stderr_output = "\n".join(stderr_lines) if stderr_lines else ""
|
||||||
|
|
||||||
# Use exit code for error detection, not string matching
|
# Use exit code for error detection, not string matching
|
||||||
if returncode != 0:
|
if returncode is not None and returncode != 0:
|
||||||
raise ProcessError(
|
raise ProcessError(
|
||||||
f"Command failed with exit code {returncode}",
|
f"Command failed with exit code {returncode}",
|
||||||
exit_code=returncode,
|
exit_code=returncode,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue