From 40d4db4eeb3dd170603801a8f27777ac7cb58fd0 Mon Sep 17 00:00:00 2001 From: Marco Castelluccio Date: Fri, 23 Oct 2020 01:58:21 +0200 Subject: [PATCH] Don't alter bug objects when extracting features from them --- bugbug/bug_features.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/bugbug/bug_features.py b/bugbug/bug_features.py index 83937866..2d7262be 100644 --- a/bugbug/bug_features.py +++ b/bugbug/bug_features.py @@ -662,18 +662,17 @@ class BugExtractor(BaseEstimator, TransformerMixin): # TODO: Try simply using all possible fields instead of extracting features manually. + summary = bug["summary"] + comments = [c["text"] for c in bug["comments"]] for cleanup_function in self.cleanup_functions: - bug["summary"] = cleanup_function(bug["summary"]) - for c in bug["comments"]: - c["text"] = cleanup_function(c["text"]) + summary = cleanup_function(summary) + comments = [cleanup_function(comment) for comment in comments] return { "data": data, - "title": bug["summary"], - "first_comment": "" - if len(bug["comments"]) == 0 - else bug["comments"][0]["text"], - "comments": " ".join([c["text"] for c in bug["comments"]]), + "title": summary, + "first_comment": "" if len(comments) == 0 else comments[0], + "comments": " ".join(comments), } for bug in bugs():