Sitelet https://web.archive.org/web/20260425025639/https://github.com/TheAlgorithms/Python/pull/3770
Skip to content

Added sublist search#3770

Closed
Pratham-123 wants to merge 3 commits intoTheAlgorithms:masterfrom
Pratham-123:master
Closed

Added sublist search#3770
Pratham-123 wants to merge 3 commits intoTheAlgorithms:masterfrom
Pratham-123:master

Conversation

@Pratham-123
Copy link
Copy Markdown

@Pratham-123 Pratham-123 commented Oct 27, 2020 •

Describe your change:

Added sublist search

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • 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 have a URL in its comments that points to Wikipedia or other similar explanation.
  • If this pull request resolves one or more open issues then the commit message contains Fixes: #{$ISSUE_NO}.

Comment thread searches/recursive_substring_search.py Outdated
# Recursive Python3 program to find if a given pattern is
# present in a text

def exactMatch(text, pat, text_index, pat_index):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The function name should be snake_case as described in CONTRIBUTING.md.

Suggested change
def exactMatch(text, pat, text_index, pat_index):
def exact_match(text, pat, text_index, pat_index):

Type hints and doctests are also required :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

Comment thread searches/sublist_search.py Outdated
@@ -0,0 +1,26 @@
def is_Sublist(l, s):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
def is_Sublist(l, s):
def is_sublist(l, s):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

done

@NumberPiOso
Copy link
Copy Markdown
Contributor

You clearly checked multiple boxes without fulfilling the requirements.

You should have done two pull requests, one for each file.

These should contain doctests and typehints for every function.

@ghost
Copy link
Copy Markdown

ghost commented Dec 1, 2020

Follow these steps in order to go good:

  • Remove either of your files (you can contribute your second file in a separate PR)
  • run these commands and go through the CONTRIBUTING.md again (its updated with help instructions)
    • pip install pre-commit
    • pre-commit run -a in the root of your local copy

@dhruvmanila
Copy link
Copy Markdown
Member

@algorithms-keeper review

@ghost ghost added require descriptive names This PR needs descriptive function and/or variable names require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html labels Dec 22, 2020
Copy link
Copy Markdown

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Click here to look at the relevant links ⬇️

🔗 Relevant Links

Repository:

Python:

Automated review generated by algorithms-keeper. If there's any problem regarding this review, please open an issue about it.

algorithms-keeper commands and options

algorithms-keeper actions can be triggered by commenting on this PR:

  • @algorithms-keeper review to trigger the checks for only added pull request files
  • @algorithms-keeper review-all to trigger the checks for all the pull request files, including the modified files. As we cannot post review comments on lines not part of the diff, this command will only modify the labels accordingly.

NOTE: Commands are in beta and so this feature is restricted only to a member or owner of the organization.

# Recursive Python3 program to find if a given pattern is
# present in a text

def exact_match(text, pat, text_index, pat_index):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file searches/recursive_substring_search.py, please provide doctest for the function exact_match

Please provide return type hint for the function: exact_match. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: text

Please provide type hint for the parameter: pat

Please provide type hint for the parameter: text_index

Please provide type hint for the parameter: pat_index



# This function returns true if 'text' contain 'pat'
def contains(text, pat, text_index, pat_index):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file searches/recursive_substring_search.py, please provide doctest for the function contains

Please provide return type hint for the function: contains. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide type hint for the parameter: text

Please provide type hint for the parameter: pat

Please provide type hint for the parameter: text_index

Please provide type hint for the parameter: pat_index

@@ -0,0 +1,26 @@
def is_sublist(l, s):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

As there is no test file in this pull request nor any test function or class in the file searches/sublist_search.py, please provide doctest for the function is_sublist

Please provide return type hint for the function: is_sublist. If the function does not return a value, please provide the type hint as: def function() -> None:

Please provide descriptive name for the parameter: l

Please provide type hint for the parameter: l

Please provide descriptive name for the parameter: s

Please provide type hint for the parameter: s

@dhruvmanila dhruvmanila added algorithmic functions should not print multiple algorithms not allowed Multiple algorithms in a single PR are not allowed labels Dec 22, 2020
@stale
Copy link
Copy Markdown

stale Bot commented Jan 23, 2021

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the stale Used to mark an issue or pull request stale. label Jan 23, 2021
@stale
Copy link
Copy Markdown

stale Bot commented Feb 2, 2021

Please reopen this pull request once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

@stale stale Bot closed this Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

algorithmic functions should not print multiple algorithms not allowed Multiple algorithms in a single PR are not allowed require descriptive names This PR needs descriptive function and/or variable names require tests Tests [doctest/unittest/pytest] are required require type hints https://docs.python.org/3/library/typing.html stale Used to mark an issue or pull request stale.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants