From 031cdd39595c597f6d6dab0e4ed3e6b1ce87af9e Mon Sep 17 00:00:00 2001 From: Alexander Schlemmer <alexander@mail-schlemmer.de> Date: Thu, 3 Mar 2022 09:27:53 +0100 Subject: [PATCH] ENH: fixed typing issues in apiutils --- src/caosdb/apiutils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/caosdb/apiutils.py b/src/caosdb/apiutils.py index fcc200b7..5558f649 100644 --- a/src/caosdb/apiutils.py +++ b/src/caosdb/apiutils.py @@ -33,6 +33,8 @@ import warnings from collections.abc import Iterable from subprocess import call +from typing import Optional, Any + from caosdb.common.datatype import (BOOLEAN, DATETIME, DOUBLE, FILE, INTEGER, REFERENCE, TEXT, is_reference) from caosdb.common.models import (Container, Entity, File, Property, Query, @@ -205,8 +207,8 @@ def compare_entities(old_entity: Entity, new_entity: Entity): In case of changed information the value listed under the respective key shows the value that is stored in the respective entity. """ - olddiff = {"properties": {}, "parents": []} - newdiff = {"properties": {}, "parents": []} + olddiff: dict[str, Any] = {"properties": {}, "parents": []} + newdiff: dict[str, Any] = {"properties": {}, "parents": []} if old_entity is new_entity: return (olddiff, newdiff) @@ -307,6 +309,7 @@ def copy_entity(entity: Entity): If deep == True return a deep copy, recursively copying all sub entities. """ print(entity) + new: Optional[Entity] = None if entity.role == "File": new = File() elif entity.role == "Property": -- GitLab