Skip to content

Commit

Permalink
Flake8 fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Oct 31, 2023
1 parent 99eb3ba commit 3445d3e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/service/suggest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@
from app.utils import utils, text_processing

logger = logging.getLogger("analyzerApp.suggestService")
SPECIAL_FIELDS_BOOST_SCORES = [
("detected_message_without_params_extended", 2.0),
("only_numbers", 2.0), ("message_params", 2.0), ("urls", 2.0),
("paths", 2.0), ("found_exceptions_extended", 8.0),
("found_tests_and_methods", 2.0), ("test_item_name", 2.0)
]


class SuggestService(AnalyzerService):
Expand Down Expand Up @@ -116,11 +122,7 @@ def build_suggest_query(self, test_item_info, log, size=10,

utils.append_potential_status_codes(query, log, max_query_terms=self.search_cfg["MaxQueryTerms"])

for field, boost_score in [
("detected_message_without_params_extended", 2.0),
("only_numbers", 2.0), ("message_params", 2.0), ("urls", 2.0),
("paths", 2.0), ("found_exceptions_extended", 8.0),
("found_tests_and_methods", 2.0), ("test_item_name", 2.0)]:
for field, boost_score in SPECIAL_FIELDS_BOOST_SCORES:
if log["_source"][field].strip():
query["query"]["bool"]["should"].append(
self.build_more_like_this_query("1",
Expand Down Expand Up @@ -357,8 +359,8 @@ def suggest_items(self, test_item_info):
test_item_info.project, "defect_type_model/"))
feature_data, test_item_ids = _boosting_data_gatherer.gather_features_info()
scores_by_test_items = _boosting_data_gatherer.scores_by_issue_type
model_info_tags = _boosting_data_gatherer.get_used_model_info() + \
_suggest_decision_maker_to_use.get_model_info()
model_info_tags = (_boosting_data_gatherer.get_used_model_info() +
_suggest_decision_maker_to_use.get_model_info())
feature_names = ";".join(_suggest_decision_maker_to_use.get_feature_names())
if feature_data:
predicted_labels, predicted_labels_probability = _suggest_decision_maker_to_use.predict(
Expand Down

0 comments on commit 3445d3e

Please sign in to comment.