Skip to content

noqa to silence flake8 on Python 3 only syntax #241

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 3 commits into from
Jan 21, 2018
Merged
Show file tree
Hide file tree
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
8 changes: 4 additions & 4 deletions data_structures/Trie/Trie.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self):
self.nodes = dict() # Mapping from char to TrieNode
self.is_leaf = False

def insert_many(self, words: [str]):
def insert_many(self, words: [str]): # noqa: F821 This syntax is Python 3 only
"""
Inserts a list of words into the Trie
:param words: list of string words
Expand All @@ -21,7 +21,7 @@ def insert_many(self, words: [str]):
for word in words:
self.insert(word)

def insert(self, word: str):
def insert(self, word: str): # noqa: F821 This syntax is Python 3 only
"""
Inserts a word into the Trie
:param word: word to be inserted
Expand All @@ -34,7 +34,7 @@ def insert(self, word: str):
curr = curr.nodes[char]
curr.is_leaf = True

def find(self, word: str) -> bool:
def find(self, word: str) -> bool: # noqa: F821 This syntax is Python 3 only
"""
Tries to find word in a Trie
:param word: word to look for
Expand All @@ -48,7 +48,7 @@ def find(self, word: str) -> bool:
return curr.is_leaf


def print_words(node: TrieNode, word: str):
def print_words(node: TrieNode, word: str): # noqa: F821 This syntax is Python 3 only
"""
Prints all the words in a Trie
:param node: root node of Trie
Expand Down
4 changes: 2 additions & 2 deletions dynamic_programming/fastfibonacci.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@


# returns F(n)
def fibonacci(n: int):
def fibonacci(n: int): # noqa: F821 This syntax is Python 3 only
if n < 0:
raise ValueError("Negative arguments are not supported")
return _fib(n)[0]


# returns (F(n), F(n-1))
def _fib(n: int):
def _fib(n: int): # noqa: F821 This syntax is Python 3 only
if n == 0:
# (F(0), F(1))
return (0, 1)
Expand Down