Skip to content

Paulami Bhosle — R23-T057: Review digital_image_processing/morphological_operations/dilation_operation.py against every Ruff rule #57

Open

Description

@ankushbisht01

Student: Paulami Bhosle

Task: R23-T057 · 7 of 10
Repository: https://github.com/S-AI-Projects/TheAlgorithms-Python
Assigned working branch: student/e26b07f0792

Goal

The repo's Ruff config already passes for this file. Go further: run all of Ruff's rules, decide which findings are worth fixing, and justify the rest. This file (PIL/numpy) is skipped by CI's tests but not by Ruff – check what the strict rules flag.

Steps

  1. Run uvx ruff check digital_image_processing/morphological_operations/dilation_operation.py (repo config – should be clean) and uvx ruff check --select ALL digital_image_processing/morphological_operations/dilation_operation.py.
  2. Group the extra findings by rule code and look each up at docs.astral.sh/ruff/rules.
  3. Fix the findings that improve clarity or safety and match CONTRIBUTING.md; list the others with a reason in REVIEW.md.
  4. Run the doctests and the repo-config Ruff check again.
  5. Make the code change in the repository: digital_image_processing/morphological_operations/dilation_operation.py: fixes for the strict Ruff findings you chose to apply. Re-run the automated check and the repo's own tests afterwards.
  6. Prepare the PR: on branch R23-T057, commit the code change plus your work/R23-T057/ 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

☐ REVIEW.md lists the --select ALL codes for digital_image_processing/morphological_operations/dilation_operation.py with decisions.
☐ At least 3 codes fixed; repo-config Ruff passes; the 10 doctests pass under Python 3.12 with numpy and Pillow.

Additional task guidance

Additional curated task guidance

Item:
digital_image_processing/morphological_operations/dilation_operation.py (75 lines; 10 doctests)

Task type:
Strict lint review

Code change (goes into the PR):
digital_image_processing/morphological_operations/dilation_operation.py: fixes for the strict Ruff findings you chose to apply.

Automated check:
uvx ruff check digital_image_processing/morphological_operations/dilation_operation.py && uv run pytest digital_image_processing/morphological_operations/dilation_operation.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/digital_image_processing/morphological_operations/dilation_operation.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

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