Skip to content

Fix ty type errors with ignore comments and isinstance assertions#758

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/fix-ty-errors-in-code
Closed

Fix ty type errors with ignore comments and isinstance assertions#758
Copilot wants to merge 2 commits intomainfrom
copilot/fix-ty-errors-in-code

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Resolved 21 ty type errors across 8 locations by adding type ignore comments where ty's type narrowing is insufficient and isinstance assertions where they improve type safety.

Changes

Source code:

  • _files/_parsing/__init__.py:244 - Added ty: ignore[invalid-assignment] for dict assignment after isinstance check
  • _files/_serialization.py:380 - Extended ignore to include not-iterable for *data unpacking
  • _files/files.py:1196 - Added ty: ignore[invalid-argument-type] for ret[None] access

Tests:

  • test_files.py:101 - Added ty: ignore[invalid-assignment] for copy-on-write list mutation test
  • test_parsing/test_intermediate.py:164-169 - Added isinstance checks for tuple/list and dict, with ignore comments for subsequent subscript operations where type narrowing remains insufficient

All fixes target specific ty error codes on lines where type inference limitations prevent proper type narrowing despite runtime assertions.

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:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

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

Original prompt

Fix ty errors on the latest version by adding the relevant isinstance assertions, otherwise fixing the error, or (if no other option) ignoring the specific ty code(s) on the offending line. Keep doing it until no ty errors remain


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

…assertions

Co-authored-by: gerlero <15150530+gerlero@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix type errors by adding isinstance assertions or resolving issues Fix ty type errors with ignore comments and isinstance assertions Feb 5, 2026
Copilot AI requested a review from gerlero February 5, 2026 01:35
@gerlero gerlero marked this pull request as ready for review February 5, 2026 02:06
@gerlero gerlero closed this Feb 5, 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.

2 participants

Comments