From 3ea0992dc70e45d17d7f354b101ef3f4ea216bff Mon Sep 17 00:00:00 2001 From: Samarth Sehgal Date: Fri, 25 Oct 2019 22:35:23 +0530 Subject: [PATCH] Update aho-corasick.py (#1457) --- strings/aho-corasick.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/strings/aho-corasick.py b/strings/aho-corasick.py index 6790892a3..b2f89450e 100644 --- a/strings/aho-corasick.py +++ b/strings/aho-corasick.py @@ -54,7 +54,7 @@ class Automaton: self.adlist[child]["fail_state"] = self.find_next_state( state, self.adlist[child]["value"] ) - if self.adlist[child]["fail_state"] == None: + if self.adlist[child]["fail_state"] is None: self.adlist[child]["fail_state"] = 0 self.adlist[child]["output"] = ( self.adlist[child]["output"] @@ -71,7 +71,7 @@ class Automaton: current_state = 0 for i in range(len(string)): while ( - self.find_next_state(current_state, string[i]) == None + self.find_next_state(current_state, string[i]) is None and current_state != 0 ): current_state = self.adlist[current_state]["fail_state"]