Skip to content

Commit 5ddeb44

Browse files
mishushakovclaude
andcommitted
fix: resolve 57 ty type checker diagnostics
- Suppress no-matching-overload globally (ty bug with @staticmethod overloads) - Add per-path overrides for generated API client models and protobuf stubs - Add type annotations to test data dicts to fix union type inference - Add inline ty:ignore for pytest.skip false positives - Remove now-redundant inline suppression comments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4be79c5 commit 5ddeb44

File tree

7 files changed

+24
-7
lines changed

7 files changed

+24
-7
lines changed

packages/python-sdk/e2b/sandbox_async/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ async def __aenter__(self):
307307
return self
308308

309309
async def __aexit__(self, exc_type, exc_value, traceback):
310-
await self.kill() # ty: ignore[no-matching-overload]
310+
await self.kill()
311311

312312
@overload
313313
async def kill(

packages/python-sdk/e2b/sandbox_sync/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def __enter__(self):
306306
return self
307307

308308
def __exit__(self, exc_type, exc_value, traceback):
309-
self.kill() # ty: ignore[no-matching-overload]
309+
self.kill()
310310

311311
@overload
312312
def kill(

packages/python-sdk/pyproject.toml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ reportInconsistentOverload = false
4646

4747
[tool.ty.rules]
4848
invalid-overload = "ignore"
49+
no-matching-overload = "ignore"
50+
51+
[[tool.ty.overrides]]
52+
include = ["e2b/api/client/models/**"]
53+
rules = { invalid-argument-type = "ignore" }
54+
55+
[[tool.ty.overrides]]
56+
include = ["e2b/envd/**/*.pyi"]
57+
rules = { conflicting-metaclass = "ignore", unresolved-attribute = "ignore" }
4958

5059
[tool.ruff]
5160
exclude = [

packages/python-sdk/tests/async/sandbox_async/files/test_files_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import uuid
2+
from typing import Any
23

34
from e2b import AsyncSandbox, FileType
45

@@ -16,7 +17,7 @@ async def test_list_directory(async_sandbox: AsyncSandbox):
1617
await async_sandbox.files.make_dir(f"{parent_dir_name}/subdir2/subdir2_2")
1718
await async_sandbox.files.write(f"{parent_dir_name}/file1.txt", "Hello, world!")
1819

19-
test_cases = [
20+
test_cases: list[dict[str, Any]] = [
2021
{
2122
"name": "default depth (1)",
2223
"depth": None,

packages/python-sdk/tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@ def debug():
190190
def skip_by_debug(request, debug):
191191
if request.node.get_closest_marker("skip_debug"):
192192
if debug:
193-
pytest.skip("skipped because E2B_DEBUG is set")
193+
pytest.skip(
194+
"skipped because E2B_DEBUG is set" # ty: ignore[too-many-positional-arguments]
195+
) # ty: ignore[invalid-argument-type]
194196

195197

196198
class Helpers:

packages/python-sdk/tests/shared/template/utils/test_tar_file_stream.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ def test_should_handle_nested_files(self, test_dir):
9292
def test_should_resolve_symlinks_when_enabled(self, test_dir):
9393
"""Test that function resolves symlinks when resolve_symlinks=True."""
9494
if not hasattr(os, "symlink"):
95-
pytest.skip("Symlinks not supported on this platform")
95+
pytest.skip(
96+
"Symlinks not supported on this platform" # ty: ignore[too-many-positional-arguments]
97+
) # ty: ignore[invalid-argument-type]
9698

9799
# Create original file
98100
original_path = os.path.join(test_dir, "original.txt")
@@ -117,7 +119,9 @@ def test_should_resolve_symlinks_when_enabled(self, test_dir):
117119
def test_should_preserve_symlinks_when_disabled(self, test_dir):
118120
"""Test that function preserves symlinks when resolve_symlinks=False."""
119121
if not hasattr(os, "symlink"):
120-
pytest.skip("Symlinks not supported on this platform")
122+
pytest.skip(
123+
"Symlinks not supported on this platform" # ty: ignore[too-many-positional-arguments]
124+
) # ty: ignore[invalid-argument-type]
121125

122126
# Create original file
123127
original_path = os.path.join(test_dir, "original.txt")

packages/python-sdk/tests/sync/sandbox_sync/files/test_files_list.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import uuid
2+
from typing import Any
23

34
from e2b import Sandbox, FileType
45

@@ -16,7 +17,7 @@ def test_list_directory(sandbox: Sandbox):
1617
sandbox.files.make_dir(f"{parent_dir_name}/subdir2/subdir2_2")
1718
sandbox.files.write(f"{parent_dir_name}/file1.txt", "Hello, world!")
1819

19-
test_cases = [
20+
test_cases: list[dict[str, Any]] = [
2021
{
2122
"name": "default depth (1)",
2223
"depth": None,

0 commit comments

Comments
 (0)