10 Commits
Author SHA1 Message Date
RokeshwaranandChristian Clauss 9ec2f097fe sorts: make recursive_insertion_sort generic over Comparable items (#15340)
* sorts: make recursive_insertion_sort generic over Comparable items

Part of #15234

- switch rec_insertion_sort/insert_next to the Comparable/TypeVar-bound
  MutableSequence[T] pattern (in-place sorts bucket) per the convention
  discussed on #15234
- make rec_insertion_sort return the sorted collection and give n a
  default of len(collection), so it can be called with a single
  argument like the other sorts in the shared test battery
- add a string doctest
- register rec_insertion_sort in tests/test_sorts.py's shared SORTS
  battery and the non-comparable-items rejection test

* fix: keep rec_insertion_sort in-place with None return, per maintainer review

- Revert n to a required parameter and drop the MutableSequence[T] return
  value; rec_insertion_sort stays a pure in-place sort returning None, as
  requested in review.
- Keep the Comparable/TypeVar generalization (no PEP 695 syntax, to match
  the existing TypeVar style in the file).
- Keep the non-int (string) doctest.
- tests/test_sorts.py: rec_insertion_sort no longer fits the shared SORTS
  battery (which asserts on a returned value), so it's removed from that
  tuple and given its own parametrized in-place test, plus its own
  non-comparable-items rejection test.

* test: adjust test_sorts.py for rec_insertion_sort's None-returning in-place contract

rec_insertion_sort no longer fits the shared SORTS battery (which asserts
on a returned value), so it's removed from that tuple and given its own
parametrized in-place test (checked against sorted()) plus its own
non-comparable-items rejection test.

* Apply batched suggestions from code review

Co-authored-by: Christian Clauss <cclauss@me.com>

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2026-09-21 14:03:36 +02:00
Christian Clauss 0525ef5da8 ruff rule ANN202 missing-return-type-private-function (#15298)
* ruff rule ANN202 missing-return-type-private-function

* ruff rule ANN202 missing-return-type-private-function
2026-09-12 21:47:08 +02:00
pre-commit-ci[bot]andpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> bc8df6de31 [pre-commit.ci] pre-commit autoupdate (#11322)
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.2.2 → v0.3.2](https://github.com/astral-sh/ruff-pre-commit/compare/v0.2.2...v0.3.2)
- [github.com/pre-commit/mirrors-mypy: v1.8.0 → v1.9.0](https://github.com/pre-commit/mirrors-mypy/compare/v1.8.0...v1.9.0)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-03-13 07:52:41 +01:00
Caeden Perelli-Harrisandpre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> 61eedc16c3 Remove useless code in doctests (#7733)
* refactor: Fix matrix display deprecation

* refactor: Remove useless `print` and `pass` statements

* revert: Replace broken doctests

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* revert: Fix failing doctests

* chore: Satisfy pre-commit

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-27 22:52:00 +02:00
Christian Claussandgithub-actions cecf43d648 Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9

* updating DIRECTORY.md

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2021-09-07 13:37:03 +02:00
Matthewandgoodm2 <4qjpngu8mem8cz> a4726ca248 [mypy]Correction of all errors in the sorts directory (#4224)
* [mypy] Add/fix type annotations for recursive_insertion_sort(#4085)

* [mypy] Add/fix type annotations for bucket_sort(#4085)

* [mypy] Reworked code for cocktail_shaker_sort so that missing return statement error is resolved(#4085)

* [mypy] Add/fix type annotations for patience_sort(#4085)

* [mypy] Add/fix type annotations for radix_sort(#4085)

Co-authored-by: goodm2 <4qjpngu8mem8cz>
2021-02-23 10:02:30 +01:00
Christian Claussandgithub-actions 9200a2e543 from __future__ import annotations (#2464)
* from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! from __future__ import annotations

* fixup! Format Python code with psf/black push

Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
2020-09-23 13:30:13 +02:00
Christian Clauss bfcb95b297 Create codespell.yml (#1698)
* fixup! Format Python code with psf/black push

* Create codespell.yml

* fixup! Format Python code with psf/black push
2020-01-18 13:24:33 +01:00
Christian ClaussandJohn Law b492e64417 Create pull_request_template.md (#1684)
* Create pull_request_template.md

* fixup! Format Python code with psf/black push

* Update pull_request_template.md

* updating DIRECTORY.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Update pull_request_template.md

* Typos and formatting

Co-authored-by: John Law <johnlaw.po@gmail.com>
2020-01-14 02:56:06 +08:00
shrabian 75523f9c1a A recursive insertion sort (#1683)
* A recursive insertion sort

* added doctests and typehints
2020-01-13 21:52:18 +05:30