From 191de64ec0d815e5bf1d0c10895ed06eeae7e095 Mon Sep 17 00:00:00 2001 From: hichris1234 Date: Thu, 2 Jul 2015 12:09:55 -0400 Subject: [PATCH] Only check a post if the owner_rep is <= 50 No need to run the regexes if we're just going to discard the result. --- bodyfetcher.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/bodyfetcher.py b/bodyfetcher.py index 20924604ae..69d235c798 100644 --- a/bodyfetcher.py +++ b/bodyfetcher.py @@ -85,12 +85,13 @@ def make_api_call_for_site(self, site): owner_rep = 0 q_id = str(post["question_id"]) - is_spam, reason = check_if_spam(title, body, owner_name, owner_link, site, q_id, False, False) - if owner_rep <= 50 and is_spam: - try: - handle_spam(title, owner_name, site, link, owner_link, q_id, reason, False) - except: - print "NOP" + if owner_rep <= 50: + is_spam, reason = check_if_spam(title, body, owner_name, owner_link, site, q_id, False, False) + if is_spam: + try: + handle_spam(title, owner_name, site, link, owner_link, q_id, reason, False) + except: + print "NOP" classified, gibberish_score = classify_gibberish(body, site) if classified and gibberish_score >= 65: @@ -115,12 +116,13 @@ def make_api_call_for_site(self, site): owner_link = "" owner_rep = 0 - is_spam, reason = check_if_spam(answer_title, body, owner_name, owner_link, site, a_id, True, False) - if owner_rep <= 50 and is_spam: - try: - handle_spam(title, owner_name, site, link, owner_link, a_id, reason, True) - except: - print "NOP" + if owner_rep <= 50: + is_spam, reason = check_if_spam(answer_title, body, owner_name, owner_link, site, a_id, True, False) + if is_spam: + try: + handle_spam(title, owner_name, site, link, owner_link, a_id, reason, True) + except: + print "NOP" classified, gibberish_score = classify_gibberish(body, site) if classified and gibberish_score >= 65: