Skip to content
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

Enable user customization of the initial number when selecting from interactive misspellings. #3099

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions usercustomization.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
def get_misspellings(word):

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (ANN201)

usercustomization.py:1:5: ANN201 Missing return type annotation for public function `get_misspellings`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (ANN001)

usercustomization.py:1:22: ANN001 Missing type annotation for function argument `word`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (ANN201)

usercustomization.py:1:5: ANN201 Missing return type annotation for public function `get_misspellings`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (ANN001)

usercustomization.py:1:22: ANN001 Missing type annotation for function argument `word`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (ANN201)

usercustomization.py:1:5: ANN201 Missing return type annotation for public function `get_misspellings`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (ANN001)

usercustomization.py:1:22: ANN001 Missing type annotation for function argument `word`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (ANN201)

usercustomization.py:1:5: ANN201 Missing return type annotation for public function `get_misspellings`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (ANN001)

usercustomization.py:1:22: ANN001 Missing type annotation for function argument `word`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (ANN201)

usercustomization.py:1:5: ANN201 Missing return type annotation for public function `get_misspellings`

Check failure on line 1 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (ANN001)

usercustomization.py:1:22: ANN001 Missing type annotation for function argument `word`
return {word[i] + word[i + 1] + word[i + 2] for i in range(len(word) - 2)}


def interactive_misspelling_picker(word, start_number=1):

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (ANN201)

usercustomization.py:5:5: ANN201 Missing return type annotation for public function `interactive_misspelling_picker`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (ANN001)

usercustomization.py:5:36: ANN001 Missing type annotation for function argument `word`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (ANN001)

usercustomization.py:5:42: ANN001 Missing type annotation for function argument `start_number`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (ANN201)

usercustomization.py:5:5: ANN201 Missing return type annotation for public function `interactive_misspelling_picker`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (ANN001)

usercustomization.py:5:36: ANN001 Missing type annotation for function argument `word`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (ANN001)

usercustomization.py:5:42: ANN001 Missing type annotation for function argument `start_number`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (ANN201)

usercustomization.py:5:5: ANN201 Missing return type annotation for public function `interactive_misspelling_picker`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (ANN001)

usercustomization.py:5:36: ANN001 Missing type annotation for function argument `word`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (ANN001)

usercustomization.py:5:42: ANN001 Missing type annotation for function argument `start_number`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (ANN201)

usercustomization.py:5:5: ANN201 Missing return type annotation for public function `interactive_misspelling_picker`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (ANN001)

usercustomization.py:5:36: ANN001 Missing type annotation for function argument `word`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (ANN001)

usercustomization.py:5:42: ANN001 Missing type annotation for function argument `start_number`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (ANN201)

usercustomization.py:5:5: ANN201 Missing return type annotation for public function `interactive_misspelling_picker`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (ANN001)

usercustomization.py:5:36: ANN001 Missing type annotation for function argument `word`

Check failure on line 5 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (ANN001)

usercustomization.py:5:42: ANN001 Missing type annotation for function argument `start_number`
misspellings = get_misspellings(word)
print(f"Misspellings for '{word}':")
for i, misspelling in enumerate(misspellings, start=start_number):
print(f"{i}. {misspelling}")

while True:
try:
choice = int(
input(
"Enter the number of the misspelling you want to correct, or 0 to exit: "

Check failure on line 15 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (E501)

usercustomization.py:15:89: E501 Line too long (93 > 88 characters)

Check failure on line 15 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (E501)

usercustomization.py:15:89: E501 Line too long (93 > 88 characters)

Check failure on line 15 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (E501)

usercustomization.py:15:89: E501 Line too long (93 > 88 characters)

Check failure on line 15 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (E501)

usercustomization.py:15:89: E501 Line too long (93 > 88 characters)

Check failure on line 15 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (E501)

usercustomization.py:15:89: E501 Line too long (93 > 88 characters)
)
)
if choice == 0:
break
elif 1 <= choice <= len(misspellings):
print(
f"You chose to correct the misspelling '{list(misspellings)[choice-1]}'."

Check failure on line 22 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (E501)

usercustomization.py:22:89: E501 Line too long (93 > 88 characters)

Check failure on line 22 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (E501)

usercustomization.py:22:89: E501 Line too long (93 > 88 characters)

Check failure on line 22 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (E501)

usercustomization.py:22:89: E501 Line too long (93 > 88 characters)

Check failure on line 22 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (E501)

usercustomization.py:22:89: E501 Line too long (93 > 88 characters)

Check failure on line 22 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (E501)

usercustomization.py:22:89: E501 Line too long (93 > 88 characters)
)
break
else:
print("Invalid choice. Please enter a valid number.")
except ValueError:
print("Invalid input. Please enter a number.")


def main():

Check failure on line 31 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.8

Ruff (ANN201)

usercustomization.py:31:5: ANN201 Missing return type annotation for public function `main`

Check failure on line 31 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.9

Ruff (ANN201)

usercustomization.py:31:5: ANN201 Missing return type annotation for public function `main`

Check failure on line 31 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10

Ruff (ANN201)

usercustomization.py:31:5: ANN201 Missing return type annotation for public function `main`

Check failure on line 31 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.11

Ruff (ANN201)

usercustomization.py:31:5: ANN201 Missing return type annotation for public function `main`

Check failure on line 31 in usercustomization.py

View workflow job for this annotation

GitHub Actions / 3.10 no-toml

Ruff (ANN201)

usercustomization.py:31:5: ANN201 Missing return type annotation for public function `main`
word = input("Enter a word: ")
start_number = int(
input("Enter the start number for misspelling selection (default is 1): ") or 1
)
interactive_misspelling_picker(word, start_number)


if __name__ == "__main__":
main()
Loading