Skip to content

Md Sohail — R23-T021: Make data_structures/linked_list/skip_list.py fully typed #3

Open

Description

@ankushbisht01

Student: Md Sohail

Task: R23-T021 · 1 of 10
Repository: https://github.com/S-AI-Projects/TheAlgorithms-Python
Assigned working branch: student/e26b07f0850

Goal

Add accurate type hints so the type checker CI runs (ty) has nothing to report for this file. Functions missing hints: __iter__, _locate_node, traverse_keys, is_sorted. Four functions lack hints in a generic SkipList[KT, VT] – keep the generics consistent.

Steps

  1. Run uv run --python 3.15 --with ty ty check data_structures/linked_list/skip_list.py (as in .github/workflows/ty.yml) and save the output.
  2. Add parameter and return types for every function; prefer precise types (e.g. list[list[int]]) over Any.
  3. Fix any real bug the checker exposes, and add a doctest for it.
  4. Run the doctests to confirm behaviour is unchanged.
  5. Make the code change in the repository: data_structures/linked_list/skip_list.py: type hints for the 4 unhinted functions, consistent with SkipList[KT, VT]. Re-run the automated check and the repo's own tests afterwards.
  6. Prepare the PR: on branch R23-T021, commit the code change plus your work/R23-T021/ evidence, put your findings in the PR description and open the PR against the org fork. For a later upstream PR, create a second branch containing only the code change (no work/ folder).

Done when

☐ data_structures/linked_list/skip_list.py: iter, locate_node, traverse_keys and is_sorted gain hints consistent with SkipList[KT, VT].
☐ ty output before/after in the PR, ending clean for this file.
☐ The file's test
* functions and 32 doctests still pass.

Additional task guidance

Additional curated task guidance

Item:
data_structures/linked_list/skip_list.py (448 lines; 32 doctests)

Task type:
Type hints & ty

Code change (goes into the PR):
data_structures/linked_list/skip_list.py: type hints for the 4 unhinted functions, consistent with SkipList[KT, VT].

Automated check:
uv run --python 3.15 --with ty ty check data_structures/linked_list/skip_list.py && uv run pytest data_structures/linked_list/skip_list.py

Prerequisites:
Linux/WSL2/Codespaces with uv (https://docs.astral.sh/uv/getting-started/installation/); run uv sync --group=test once – it installs the Python version CI uses (.python-version = 3.15t) and the test dependencies, about 1–2 GB

Upstream PR rules:
Follow CONTRIBUTING.md: type hints on every parameter/return, doctests for valid and erroneous input, snake_case file names, no duplicate of an existing implementation, no hand edits to DIRECTORY.md. CI (pytest with doctests, ruff) must pass – bots close PRs without tests or type hints. Keep work/ (benchmarks, notes, property tests) out of the upstream branch; put results in the PR description.

Source (pinned):
https://github.com/TheAlgorithms/Python/blob/574d100b7181956e9c8384552fd078165e4cc326/data_structures/linked_list/skip_list.py

Change:
No change recorded

PR destination:
Preserved pilot guidance

Submission checklist

  • Complete this task and its checks.
  • Add the required evidence and link your pull request here.
  • Select this S-AI-Projects fork as the PR base repository.
  • Request instructor review.

Keep this PR focused on this task. Do not submit assignment PRs to the upstream repository.

Activity

  1. changed the title [-]Md Sohail — Project tasks (R23)[/-] [+]Md Sohail — R23-T021: Make data_structures/linked_list/skip_list.py fully typed[/+] on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions