From 3752d51725b25518929305dba247393558139fd0 Mon Sep 17 00:00:00 2001 From: kosncn <43571215+kosncn@users.noreply.github.com> Date: Thu, 4 Jul 2024 19:59:29 +0800 Subject: [PATCH] fix: the corrections are as follows (#523) 1. simplify the import path for DB classes and DB_Row classes. 2. trim all leading whitespaces when splitting each line of the DB specification. --- snap7/util/__init__.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/snap7/util/__init__.py b/snap7/util/__init__.py index f602d2d6..f9dccc37 100644 --- a/snap7/util/__init__.py +++ b/snap7/util/__init__.py @@ -87,6 +87,11 @@ from typing import Any from collections import OrderedDict +from .db import ( + DB, + DB_Row, +) + from .setters import ( set_bool, set_fstring, @@ -187,7 +192,7 @@ def parse_specification(db_specification: str) -> OrderedDict[str, Any]: for line in db_specification.split("\n"): if line and not line.lstrip().startswith("#"): - index, var_name, _type = line.split("#")[0].split() + index, var_name, _type = line.lstrip().split("#")[0].split() parsed_db_specification[var_name] = (index, _type) return parsed_db_specification