Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: niyueming/Python
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: TheAlgorithms/Python
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 16 commits
  • 23 files changed
  • 14 contributors

Commits on Oct 12, 2026

  1. Fix datetime import alias in Zeller’s congruence (TheAlgorithms#15547)

    * fix(maths): use conventional datetime alias in Zeller's congruence
    
    * from datetime import date
    
    Replaced datetime module alias with direct import for clarity.
    
    ---------
    
    Co-authored-by: Christian Clauss <[email protected]>
    Miladkhoshdel and cclauss authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    c9953bb View commit details
    Browse the repository at this point in the history
  2. refactor(heap): remove redundant TypeVar in Heap (TheAlgorithms#15504)

    * refactor(heap): remove redundant TypeVar in Heap
    
    * refactor(heap): revert Comparable.__gt__ signature to self: T, other: T
    
    * Clean up imports in heap.py
    
    Removed unused TypeVar import from heap.py
    
    * Update __gt__ method signature in Comparable class
    
    ---------
    
    Co-authored-by: Christian Clauss <[email protected]>
    iosayin and cclauss authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    14082f5 View commit details
    Browse the repository at this point in the history
  3. feat(scheduling): add weighted interval scheduling (TheAlgorithms#15539)

    * feat(dynamic_programming): add weighted interval scheduling algorithm
    
    * test(dynamic_programming): add doctest to __post_init__ and add test function
    
    * Move weighted interval scheduling to scheduling directory
    
    ---------
    
    Co-authored-by: Christian Clauss <[email protected]>
    ShriyansBharuka and cclauss authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    f6b39e1 View commit details
    Browse the repository at this point in the history
  4. fix: instagram_crawler.py declares 3.13 but uses 3.14 except syntax (T…

    …heAlgorithms#15551)
    
    * fix: parenthesize multi-catch that only parses on 3.14
    
    PEP 758 syntax requires Python 3.14, but the script metadata declares
    requires-python >= 3.13. Reported by ty check run per TheAlgorithms#15187.
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    * Update required Python version in instagram_crawler.py
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    Co-authored-by: Christian Clauss <[email protected]>
    3 people authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    a89103d View commit details
    Browse the repository at this point in the history
  5. fix: crypto_price_tracker.py declares 3.11 but uses 3.14 except syntax (

    TheAlgorithms#15550)
    
    * fix: parenthesize multi-catch that only parses on 3.14
    
    PEP 758 syntax requires Python 3.14, but the script metadata declares
    requires-python >= 3.11. Reported by ty check run per TheAlgorithms#15187.
    
    * [pre-commit.ci] auto fixes from pre-commit.com hooks
    
    for more information, see https://pre-commit.ci
    
    * fix: declare 3.14 in crypto_price_tracker PEP 723 metadata
    
    The unparenthesized multi-catch (PEP 758) only parses on 3.14+.
    Parenthesizing is not an option: ruff-format 0.16.10 with the repo's
    py315 target re-emits the parenthesized form, so pre-commit.ci reverts
    it on every push. Align the declared minimum instead.
    
    * fix: alias datetime import to dt in maths/zellers_congruence
    
    Clears ICN001, which fails on master and blocks every PR ruff check.
    
    * Refactor datetime import in zellers_congruence.py
    
    Replaced 'datetime as dt' with 'datetime' for clarity.
    
    * Update required Python version to 3.15
    
    ---------
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    Co-authored-by: Christian Clauss <[email protected]>
    3 people authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    21f7907 View commit details
    Browse the repository at this point in the history
  6. maths: add Keith number algorithm (TheAlgorithms#15536)

    - Implement is_keith_number(number: int) -> bool with rolling sum optimization
    - Implement find_keith_numbers(limit: int) -> list[int]
    - Add Wikipedia and OEIS reference links
    - Comprehensive doctests covering normal, edge, and error cases
    shad0w0P authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    6b70b83 View commit details
    Browse the repository at this point in the history
  7. fix: honor empty-list contract for generator input (TheAlgorithms#15552)

    make_linked_list declared the input as Iterable[int] but tested emptiness
    with truthiness, so an empty generator silently produced an empty
    LinkedList instead of raising. Materialize the iterable first and cover
    generator input with doctests.
    
    Co-authored-by: Christian Clauss <[email protected]>
    peda-cos and cclauss authored Oct 12, 2026
    Configuration menu
    Copy the full SHA
    deb9cfc View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    0904b02 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    3935d28 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2026

  1. Configuration menu
    Copy the full SHA
    1f061ff View commit details
    Browse the repository at this point in the history

Commits on Oct 14, 2026

  1. Python PEP 798 fix unpacking in comprehensions opportunities (TheAlgo…

    …rithms#15572)
    
    * Add scripts/find_and_fix_pep798.py to find and fix PEP 798 opportunities
    
    Co-authored-by: Copilot <[email protected]>
    
    * Python PEP 798 compression fixes
    
    * updating DIRECTORY.md
    
    ---------
    
    Co-authored-by: Copilot <[email protected]>
    Co-authored-by: cclauss <[email protected]>
    3 people authored Oct 14, 2026
    Configuration menu
    Copy the full SHA
    e1a2a8b View commit details
    Browse the repository at this point in the history

Commits on Oct 16, 2026

  1. fix: resolve deprecated contextmanager return annotation and un-ignor…

    …e rule (TheAlgorithms#15568)
    
    Annotating @contextmanager functions as -> Iterator is deprecated in Python 3.15 typeshed stubs; updated to -> Generator[None]. Un-ignores rules.deprecated in pyproject.toml.
    
    Contributes to TheAlgorithms#15187.
    rajpreetcodes authored Oct 16, 2026
    Configuration menu
    Copy the full SHA
    adccf0c View commit details
    Browse the repository at this point in the history
  2. Filter PEP 798 scanner inputs (TheAlgorithms#15583)

    * Initial plan
    
    * Filter PEP 798 scan paths
    
    Co-authored-by: cclauss <[email protected]>
    
    ---------
    
    Co-authored-by: copilot-swe-agent[bot] <[email protected]>
    Co-authored-by: cclauss <[email protected]>
    Copilot and cclauss authored Oct 16, 2026
    Configuration menu
    Copy the full SHA
    25c712f View commit details
    Browse the repository at this point in the history

Commits on Oct 20, 2026

  1. fix(machine_learning): call features.any() in linear_discriminant_ana…

    …lysis (TheAlgorithms#15606)
    
    In linear_discriminant_analysis, line 146 wrote if features.any: instead of calling if features.any():. Because the method object is always truthy, the else branch handling empty datasets was unreachable dead code, triggering ty warning[redundant-condition].
    
    Call eatures.any() (matching line 107 in principal_component_analysis) and add a test case in test_linear_discriminant_analysis verifying that an empty dataset properly enters the else branch.
    
    Validation:
    - uvx ty check machine_learning/dimensionality_reduction.py -> All checks passed (0 diagnostics)
    - uvx --with scipy --with scikit-learn --with numpy pytest machine_learning/dimensionality_reduction.py --doctest-modules -> 9 passed
    - uvx ruff check / format -> clean
    hardikkaurani authored Oct 20, 2026
    Configuration menu
    Copy the full SHA
    f7109c5 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6e03a48 View commit details
    Browse the repository at this point in the history

Commits on Nov 2, 2026

  1. [pre-commit.ci] pre-commit autoupdate (TheAlgorithms#15686)

    updates:
    - [github.com/tox-dev/pyproject-fmt: v2.30.1 → v2.30.3](tox-dev/pyproject-fmt@v2.30.1...v2.30.3)
    - [github.com/astral-sh/ruff-pre-commit: v0.16.10 → v0.17.3](astral-sh/ruff-pre-commit@v0.16.10...v0.17.3)
    - [github.com/rvben/rumdl-pre-commit: v0.2.78 → v0.3.2](rvben/rumdl-pre-commit@v0.2.78...v0.3.2)
    - [github.com/astral-sh/uv-pre-commit: 0.12.23 → 0.13.6](astral-sh/uv-pre-commit@0.12.23...0.13.6)
    - [github.com/abravalheri/validate-pyproject: 0.26 → v0.27](abravalheri/validate-pyproject@0.26...v0.27)
    
    Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
    pre-commit-ci[bot] authored Nov 2, 2026
    Configuration menu
    Copy the full SHA
    574d100 View commit details
    Browse the repository at this point in the history
Loading