Skip to content

Fix ty invalid assignment - #15221

Merged
cclauss merged 8 commits into
TheAlgorithms:masterfrom
kadubhumika:fix-ty-invalid-assignment
Sep 9, 2026
Merged

Fix ty invalid assignment#15221
cclauss merged 8 commits into
TheAlgorithms:masterfrom
kadubhumika:fix-ty-invalid-assignment

Conversation

@kadubhumika

@kadubhumika kadubhumika commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes the remaining ty invalid-assignment and related type-checking diagnostics across multiple files.
Fixes: #15204

Changes made

  • Fixed type annotations and optional Node handling in linked list implementations.
  • Fixed type issues in the segment tree and binomial heap.
  • Fixed typing for automatic differentiation and minimum cut implementations.
  • Added explicit urllib.request import.
  • Fixed the CPU scheduling selection type-checking issue.
  • Added necessary assertions for image pixel access.

Validation

ty check --exclude-scripts

Result:

All checks passed!

@algorithms-keeper algorithms-keeper Bot added the awaiting reviews This PR is ready to be reviewed label Sep 7, 2026
@algorithms-keeper

Copy link
Copy Markdown

Closing this pull request as invalid

@kadubhumika, this pull request is being closed as none of the checkboxes have been marked. It is important that you go through the checklist and mark the ones relevant to this pull request. Please read the Contributing guidelines.

If you're facing any problem on how to mark a checkbox, please read the following instructions:

  • Read a point one at a time and think if it is relevant to the pull request or not.
  • If it is, then mark it by putting a x between the square bracket like so: [x]

NOTE: Only [x] is supported so if you have put any other letter or symbol between the brackets, that will be marked as invalid. If that is the case then please open a new pull request with the appropriate changes.

@algorithms-keeper algorithms-keeper Bot closed this Sep 7, 2026
@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 7, 2026
@cclauss cclauss reopened this Sep 9, 2026
@algorithms-keeper algorithms-keeper Bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Sep 9, 2026
@cclauss

cclauss commented Sep 9, 2026

Copy link
Copy Markdown
Member

@priya-sundaram-dev Your review, please.

@algorithms-keeper algorithms-keeper Bot removed the awaiting reviews This PR is ready to be reviewed label Sep 9, 2026
@cclauss
cclauss merged commit 3f4ce7a into TheAlgorithms:master Sep 9, 2026
16 checks passed
@priya-sundaram-dev

Copy link
Copy Markdown
Contributor

Reviewed post-merge — this is exactly the minimal-surface-area approach #15204 was asking for. 👍

  • The assert x is not None narrowing on img.load() / bottom_root / min_node is the right idiom: it tells the type checker what the code already guarantees at that point, without changing runtime behavior for valid inputs.
  • cast(T, None) in non_recursive_segment_tree cleanly drops the Any escape hatch while keeping the placeholder-fill pattern intact.

Thanks @kadubhumika for knocking out all 23 spots in one pass. Nicely scoped.

@kadubhumika

Copy link
Copy Markdown
Contributor Author

Thanks for the merge and the great feedback @cclauss and @priya-sundaram-dev

I really enjoyed working on this and would love to keep contributing. If there are any other type-checking issues, open bugs, or features you need help with, please let me know, I’d be happy to jump on them!

@cclauss

cclauss commented Sep 9, 2026

Copy link
Copy Markdown
Member

@kadubhumika

Copy link
Copy Markdown
Contributor Author

Thanks for the merge and the kind words! I will jump right into #15187 and #15234 next. @cclauss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This PR modified some existing files invalid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ty: un-ignore invalid-assignment (9 files, 23 spots) — good first issue

3 participants