Skip to content

Commit

Permalink
build(deps): bump mypy from 1.3.0 to 1.13.0 (#9670)
Browse files Browse the repository at this point in the history
## Problem
We use a pretty old version of `mypy` 1.3 (released 1.5 years ago), it
produces false positives for `typing.Self`.

## Summary of changes
- Bump `mypy` from 1.3 to 1.13
- Fix new warnings and errors
- Use `typing.Self` whenever we `return self`
  • Loading branch information
bayandin authored Nov 22, 2024
1 parent c10b7f7 commit 51d26a2
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 102 deletions.
69 changes: 38 additions & 31 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ testcontainers = "^4.8.1"
jsonnet = "^0.20.0"

[tool.poetry.group.dev.dependencies]
mypy = "==1.3.0"
mypy = "==1.13.0"
ruff = "^0.7.0"

[build-system]
Expand Down
6 changes: 4 additions & 2 deletions scripts/force_layer_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ async def main_impl(args, report_out, client: Client):
tenant_ids = await client.get_tenant_ids()
get_timeline_id_coros = [client.get_timeline_ids(tenant_id) for tenant_id in tenant_ids]
gathered = await asyncio.gather(*get_timeline_id_coros, return_exceptions=True)
assert len(tenant_ids) == len(gathered)
tenant_and_timline_ids = []
for tid, tlids in zip(tenant_ids, gathered, strict=False):
for tid, tlids in zip(tenant_ids, gathered, strict=True):
# TODO: add error handling if tlids isinstance(Exception)
assert isinstance(tlids, list)

for tlid in tlids:
tenant_and_timline_ids.append((tid, tlid))
elif len(comps) == 1:
Expand Down
6 changes: 1 addition & 5 deletions test_runner/fixtures/common_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,6 @@ def from_json(cls, d: dict[str, Any]) -> TenantTimelineId:
)


# Workaround for compat with python 3.9, which does not have `typing.Self`
TTenantShardId = TypeVar("TTenantShardId", bound="TenantShardId")


class TenantShardId:
def __init__(self, tenant_id: TenantId, shard_number: int, shard_count: int):
self.tenant_id = tenant_id
Expand All @@ -202,7 +198,7 @@ def __init__(self, tenant_id: TenantId, shard_number: int, shard_count: int):
assert self.shard_number < self.shard_count or self.shard_count == 0

@classmethod
def parse(cls: type[TTenantShardId], input: str) -> TTenantShardId:
def parse(cls: type[TenantShardId], input: str) -> TenantShardId:
if len(input) == 32:
return cls(
tenant_id=TenantId(input),
Expand Down
2 changes: 1 addition & 1 deletion test_runner/fixtures/compute_reconfigure.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def handler(request: Request) -> Response:
# This causes the endpoint to query storage controller for its location, which
# is redundant since we already have it here, but this avoids extending the
# neon_local CLI to take full lists of locations
reconfigure_threads.submit(lambda workload=workload: workload.reconfigure()) # type: ignore[no-any-return]
reconfigure_threads.submit(lambda workload=workload: workload.reconfigure()) # type: ignore[misc]

return Response(status=200)

Expand Down
3 changes: 0 additions & 3 deletions test_runner/fixtures/neon_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,9 @@
if TYPE_CHECKING:
from typing import (
Any,
TypeVar,
cast,
)

T = TypeVar("T")


# Used to be an ABC. abc.ABC removed due to linter without name change.
class AbstractNeonCli:
Expand Down
Loading

1 comment on commit 51d26a2

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5535 tests run: 5317 passed, 1 failed, 217 skipped (full report)


Failures on Postgres 17

# Run all failed tests locally:
scripts/pytest -vv -n $(nproc) -k "test_config[debug-pg17]"
Flaky tests (1)

Postgres 17

Test coverage report is not available

The comment gets automatically updated with the latest test results
51d26a2 at 2024-11-22T15:38:54.279Z :recycle:

Please sign in to comment.