From b3873be7b55f5672fc0f9f6496358b4f802358a6 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 20 Jan 2018 12:31:12 +0100 Subject: [PATCH 1/3] noqa to silence flake8 on Python 3 only syntax --- data_structures/Trie/Trie.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data_structures/Trie/Trie.py b/data_structures/Trie/Trie.py index 7c886144d..b60afd29d 100644 --- a/data_structures/Trie/Trie.py +++ b/data_structures/Trie/Trie.py @@ -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 From cc5102ab019fca9b19c69db16fa1b43412acb5d7 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 20 Jan 2018 12:33:27 +0100 Subject: [PATCH 2/3] noqa to silence flake8 on Python 3 only syntax --- dynamic_programming/fastfibonacci.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dynamic_programming/fastfibonacci.py b/dynamic_programming/fastfibonacci.py index cdfa2dd08..2c3960d11 100644 --- a/dynamic_programming/fastfibonacci.py +++ b/dynamic_programming/fastfibonacci.py @@ -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) From 3f6760ee159d2c2e6577aab0d052b7781aa10bb2 Mon Sep 17 00:00:00 2001 From: cclauss Date: Sat, 20 Jan 2018 12:35:12 +0100 Subject: [PATCH 3/3] noqa: F821 This syntax is Python 3 only --- data_structures/Trie/Trie.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/data_structures/Trie/Trie.py b/data_structures/Trie/Trie.py index b60afd29d..63e291b97 100644 --- a/data_structures/Trie/Trie.py +++ b/data_structures/Trie/Trie.py @@ -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 @@ -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