Skip to content

Fix A002: rename id parameter to request_id in Spec class#199

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/fix-linter-error-a002
Draft

Fix A002: rename id parameter to request_id in Spec class#199
Copilot wants to merge 3 commits intomainfrom
copilot/fix-linter-error-a002

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 2, 2026

Ruff rule A002 flags function arguments that shadow Python builtins. The Spec class in jsonrpyc/__init__.py used id as a parameter name in four methods, shadowing the built-in id().

Changes

  • jsonrpyc/__init__.py: Renamed idrequest_id in Spec.check_id, Spec.request, Spec.response, and Spec.error, including all internal usages, the one keyword-argument call site (Spec.request(method, id=id, ...)Spec.request(method, request_id=id, ...)), and docstrings.
  • pyproject.toml: Removed A002 from the ruff ignore list.
# Before
def check_id(cls, id: str | int | None, *, allow_empty: bool = False) -> None: ...
def request(cls, method: str, /, id: str | int | None = None, ...) -> str: ...
def response(cls, id: str | int | None, result: Any, /) -> str: ...
def error(cls, id: str | int | None, code: int, ...) -> str: ...

# After
def check_id(cls, request_id: str | int | None, *, allow_empty: bool = False) -> None: ...
def request(cls, method: str, /, request_id: str | int | None = None, ...) -> str: ...
def response(cls, request_id: str | int | None, result: Any, /) -> str: ...
def error(cls, request_id: str | int | None, code: int, ...) -> str: ...

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • unsupported.example.com
    • Triggering command: /usr/bin/python python -m pytest tests/ -x -q (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue Apr 2, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Fix linter error A002 and update suppression list Fix A002: rename id parameter to request_id in Spec class Apr 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A002

2 participants