Merge pull request #241 from cclauss/patch-1

noqa to silence flake8 on Python 3 only syntax
This commit is contained in:
Harshil 2018-01-21 11:14:50 +05:30 committed by GitHub
commit 54f6d1f6d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View File

@ -12,7 +12,7 @@ class TrieNode:
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
@ -21,7 +21,7 @@ class TrieNode:
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
@ -34,7 +34,7 @@ class TrieNode:
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
@ -48,7 +48,7 @@ class TrieNode:
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

View File

@ -7,14 +7,14 @@ import sys
# 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)