Skip to content

ty: unignore unsupported-operator rule - #15775

Open
lll-hhh wants to merge 1 commit into
TheAlgorithms:masterfrom
lll-hhh:ty/unignore-unsupported-operator
Open

lll-hhh wants to merge 1 commit into
TheAlgorithms:masterfrom
lll-hhh:ty/unignore-unsupported-operator

Conversation

@lll-hhh

@lll-hhh lll-hhh commented Nov 20, 2026

Copy link
Copy Markdown

Part of #15187.

Removes rules.unsupported-operator = "ignore" from [tool.ty] after fixing
the seven diagnostics that were hidden by it on master at 30507bb:

  • Add the missing comparison dunders to the local Comparable protocols used
    by the iterative merge sort and the two recursive/three-way quick sorts.
  • Handle Image.load() returning None and narrow grayscale pixel values in
    mean_threshold.py without changing the thresholding calculation.
  • Build the Amazon product URL with an f-string, matching the existing URL
    construction in the same file and avoiding a false assumption that a
    BeautifulSoup attribute is statically a string.

These changes are required together to enable the rule: the isolated
unsupported-operator check reports no diagnostics after the patch.

Validation:

  • uv sync --python 3.15 --group test
  • ty check isolated to this rule: All checks passed!
  • Full ty check --exclude-scripts: no unsupported-operator diagnostics
    remain; the remaining diagnostics are pre-existing rules tracked by Tracking: complete the ty gradual-typing baseline (un-ignore rules; PEP 723 blocker astral-sh/ty#691) #15187.
  • pytest ... --doctest-modules -q: 9 passed.
  • A separate deterministic probe matched a reference implementation for 20
    grayscale images, checked the None pixel-access error, and verified the
    extracted Amazon product link without network access.
  • ruff check and ruff format --check: passed.
  • All applicable pre-commit hooks passed. The local filename-validation hook
    needs a python3 shim, so I ran its underlying scripts/validate_filenames.py
    directly against the Python 3.15 environment; it passed.
  • git diff --check: passed.

Implementation and verification were performed with Codex assistance. No
independent human review is asserted.

Describe your change

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Add or change doctests? -- Note: Please avoid changing both code and tests in a single pull request.
  • Documentation change?

Checklist

@lll-hhh
lll-hhh requested a review from cclauss as a code owner November 20, 2026 12:26
@algorithms-keeper algorithms-keeper Bot added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Nov 20, 2026

This branch has not been deployed

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

Labels

awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant