Skip to content

Commit

Permalink
build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jlevypaloalto committed Jul 9, 2024
1 parent c7498f7 commit df9038b
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ tags:
- ml
timeout: 12µs
type: python
dockerimage: demisto/python3:3.10.14.101217
dockerimage: demisto/python3:3.11.9.101916
tests:
- Create Phishing Classifier V2 ML Test
- DBotCreatePhishingClassifierV2FromFile-Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"\nThe class this function is called from is 'DistilBertTokenizer'.\n"
)


class StderrRedirect:
'''Context manager to redirect stderr.'''
temp_stderr: Any
Expand Down Expand Up @@ -41,7 +42,7 @@ def OrderedSet(iterable):
return list(dict.fromkeys(iterable))


def get_model_data(model_name: str, store_type: str, is_return_error: bool) -> None | tuple[dict, str]:
def get_model_data(model_name: str, store_type: str, is_return_error: bool) -> tuple[dict, str]:

def load_from_models(model_name: str) -> None | tuple[dict, str]:
res_model = demisto.executeCommand("getMLModel", {"modelName": model_name})
Expand All @@ -61,10 +62,10 @@ def load_from_list(model_name):

if store_type == "mlModel":
res = load_from_models(model_name) or load_from_list(model_name)
if store_type == "list":
elif store_type == "list":
res = load_from_list(model_name) or load_from_models(model_name)

return res or handle_error(f"error reading model {model_name} from Demisto", is_return_error)
return res or handle_error(f"error reading model {model_name} from Demisto", is_return_error) # type: ignore


def handle_error(message, is_return_error):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@ def main(incident_types, incident_query, y_true_field, y_pred_field, y_pred_prob
if is_error(incidents_query_res):
return_error(get_error(incidents_query_res))
incidents = json.loads(incidents_query_res[0]['Contents'])
demisto.results(f'Found {len(incidents)} incidents')
if incidents:
demisto.results(f'Found {len(incidents)} incident(s)')
y_true = []
y_pred = []
y_pred_prob = []
Expand Down Expand Up @@ -143,6 +143,8 @@ def main(incident_types, incident_query, y_true_field, y_pred_field, y_pred_prob
context_field='EvaluateMLModllAtProductionNoThresh',
human_readable_title=human_readable)
return_file_result_with_predictions_on_test_set(incidents, y_true, y_pred, y_pred_prob, additional_fields)
else:
return_results('No incidents found.')


model_target_accuracy = demisto.args().get('modelTargetAccuracy', 0)
Expand Down
1 change: 0 additions & 1 deletion Tests/conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -5933,7 +5933,6 @@
"ThreatGrid_v2_Test": "No instance, developed by Qmasters",
"Test-Detonate URL - ThreatGrid": "No instance, developed by Qmasters",
"awake_security_test_pb": "No instance, CRTX-77572",
"Create Phishing Classifier V2 ML Test": "Updated docker image lacks data for the ml model. Once data issue is solved for ml module can un skip. ",
"SumoLogic-Test": "401 unauthorized, CIAC-6334",
"EWS_O365_test": "Issue CIAC-6753",
"Microsoft Defender Advanced Threat Protection - Test dev": "Issue CIAC-7514",
Expand Down

0 comments on commit df9038b

Please sign in to comment.