From 9b43f846b144d39bfb0cf16853bf6901c74b6672 Mon Sep 17 00:00:00 2001 From: Dwight Lidman Date: Tue, 8 Dec 2020 17:56:44 +0100 Subject: MLBEDSW-3653: Fix type errors in annotated files This commit corrects a number of type errors reported by mypy and refactors some parts of the code which are no longer necessary after making adjustments to satisfy mypy. Signed-off-by: Dwight Lidman Change-Id: I16b880b228e57f2a92fb8936f53e94886e0f9f44 --- ethosu/vela/debug_database.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'ethosu/vela/debug_database.py') diff --git a/ethosu/vela/debug_database.py b/ethosu/vela/debug_database.py index b5852cdc..4f0a50ae 100644 --- a/ethosu/vela/debug_database.py +++ b/ethosu/vela/debug_database.py @@ -15,6 +15,9 @@ # limitations under the License. import csv import io +from typing import Any +from typing import Dict +from typing import List import lxml.etree as xml @@ -22,28 +25,32 @@ from . import numeric_util from .operation import Operation +UntypedDict = Dict[Any, Any] +UntypedList = List[Any] + + class DebugDatabase: NULLREF = -1 show_warnings = False SOURCE_TABLE = "source" - _sourceUID = {} + _sourceUID: UntypedDict = {} _sourceHeaders = ["id", "operator", "kernel_w", "kernel_h", "ofm_w", "ofm_h", "ofm_d"] - _sourceTable = [] + _sourceTable: UntypedList = [] OPTIMISED_TABLE = "optimised" - _optimisedUID = {} + _optimisedUID: UntypedDict = {} _optimisedHeaders = ["id", "source_id", "operator", "kernel_w", "kernel_h", "ofm_w", "ofm_h", "ofm_d"] - _optimisedTable = [] + _optimisedTable: UntypedList = [] QUEUE_TABLE = "queue" _queueHeaders = ["offset", "cmdstream_id", "optimised_id"] - _queueTable = [] + _queueTable: UntypedList = [] STREAM_TABLE = "cmdstream" - _streamUID = {} + _streamUID: UntypedDict = {} _streamHeaders = ["id", "file_offset"] - _streamTable = [] + _streamTable: UntypedList = [] @classmethod def add_source(cls, op: Operation): -- cgit v1.2.1