From 18a7a4ec1a0cf21494285581c0df60ced8474277 Mon Sep 17 00:00:00 2001 From: vakarisz Date: Tue, 12 Jul 2022 16:12:13 +0300 Subject: [PATCH] Island: Add typehints to APIEncoder --- monkey/monkey_island/cc/services/representations.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/monkey_island/cc/services/representations.py b/monkey/monkey_island/cc/services/representations.py index 16315ea6f..a441a45b8 100644 --- a/monkey/monkey_island/cc/services/representations.py +++ b/monkey/monkey_island/cc/services/representations.py @@ -1,6 +1,7 @@ from datetime import datetime from enum import Enum from json import loads +from typing import Any import bson from flask import make_response @@ -10,7 +11,7 @@ from common.utils import IJSONSerializable class APIEncoder(JSONEncoder): - def default(self, value): + def default(self, value: Any): # ObjectId is serializible by default, but returns a dict # So serialize it first into a plain string if isinstance(value, bson.objectid.ObjectId):