Skip to content

[mypy] Fix type annotations for trie.py #5022

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

Merged
merged 5 commits into from
Oct 22, 2021

Conversation

archaengel
Copy link
Contributor

❯ mypy --ignore-missing-imports data_structures/trie
Success: no issues found in 2 source files

Related issue: #4052

Describe your change:

  • 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}.

@ghost ghost added awaiting reviews This PR is ready to be reviewed enhancement This PR modified some existing files labels Oct 5, 2021
@archaengel archaengel force-pushed the mypy-fix-trie branch 3 times, most recently from 853906b to 61caf1f Compare October 5, 2021 06:31
@archaengel archaengel closed this Oct 11, 2021
@archaengel archaengel reopened this Oct 11, 2021
@archaengel archaengel force-pushed the mypy-fix-trie branch 2 times, most recently from 7f05a98 to e5135ce Compare October 13, 2021 23:25
Copy link
Member

@poyea poyea left a comment

Choose a reason for hiding this comment

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

Thank you for your pull request!🤩Let's make it --strict?

> mypy . --ignore-missing-imports --strict
trie.py:10: error: Function is missing a return type annotation
trie.py:10: note: Use "-> None" if function does not return a value
trie.py:14: error: Function is missing a return type annotation
trie.py:23: error: Function is missing a return type annotation
trie.py:32: error: Call to untyped function "TrieNode" in typed context
trie.py:49: error: Function is missing a return type annotation
trie.py:56: error: Function is missing a return type annotation
trie.py:78: error: Function is missing a return type annotation
trie.py:92: error: Function is missing a return type annotation
trie.py:94: error: Call to untyped function "TrieNode" in typed context
trie.py:115: error: Function is missing a return type annotation
trie.py:115: note: Use "-> None" if function does not return a value
trie.py:116: error: Call to untyped function "test_trie" in typed context
trie.py:119: error: Function is missing a return type annotation
trie.py:119: note: Use "-> None" if function does not return a value
trie.py:123: error: Call to untyped function "test_trie" in typed context
trie.py:127: error: Call to untyped function "main" in typed context
Found 14 errors in 1 file (checked 3 source files)

@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 22, 2021
@poyea poyea added the awaiting merge This PR is approved and ready to be merged label Oct 22, 2021
Annotate return type for all functions and type for "nodes"
@ghost ghost added merge conflicts Open a new PR or rebase on the latest commit awaiting reviews This PR is ready to be reviewed and removed awaiting merge This PR is approved and ready to be merged labels Oct 22, 2021
@archaengel
Copy link
Contributor Author

archaengel commented Oct 22, 2021

Thanks for the review! 🙏🏽 That sgtm, done.

@ghost ghost removed the merge conflicts Open a new PR or rebase on the latest commit label Oct 22, 2021
@ghost ghost added tests are failing Do not merge until tests pass and removed tests are failing Do not merge until tests pass labels Oct 22, 2021
@poyea poyea merged commit 11ec2fd into TheAlgorithms:master Oct 22, 2021
@ghost ghost removed the awaiting reviews This PR is ready to be reviewed label Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants