Skip to content

Refactored all_subsequences.py: Better Comments and Type Hints #11096

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 0 commits into from

Conversation

AbhignyaTayi
Copy link

Describe your change:

Python-type hints were added to function signatures to specify expected data types for function parameters and return values.
Inline comments were added to clarify certain parts of the code, like why we're stashing the current state, why we're popping, etc. These are meant to clarify sections of the code that might not be immediately obvious.
A module-level docstring was added at the top of the Python file to explain the purpose of the code, what problem it solves, and its time complexity. This helps anyone looking at the code understand its broader context.

  • 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:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed tests are failing Do not merge until tests pass labels Oct 30, 2023
@@ -1,35 +1,53 @@
"""
In this problem, we want to determine all possible subsequences
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import block is un-sorted or un-formatted
|
8 | """
9 |
10 | / from future import annotations
11 | | from typing import Any
12 | |
13 | |
14 | | def generate_all_subsequences(sequence: list[Any]) -> None:
| |_^ I001
15 | """Kickstarts the backtracking algorithm.
|
= help: Organize imports


from __future__ import annotations
from typing import Any


Copy link
Contributor

@imSanko imSanko Oct 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check with pre-commit run --all-files --show-diff-on-failure to know more about your pre commits !

@imSanko
Copy link
Contributor

imSanko commented Oct 30, 2023

You can't change two 📂 Files at a TIME read the Contribution.md

@cclauss cclauss added the ON HOLD: Final hours of Hacktoberfest We will review this PR after Hacktoberfest has ended label Oct 30, 2023
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 ON HOLD: Final hours of Hacktoberfest We will review this PR after Hacktoberfest has ended tests are failing Do not merge until tests pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants