From 33086705bb73b75d17e7eb380b00eb42a4ddd9c1 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 5 Sep 2024 12:29:03 +0100 Subject: [PATCH 1/2] Fake start values to avoid Optional type --- spinn_utilities/make_tools/file_converter.py | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/spinn_utilities/make_tools/file_converter.py b/spinn_utilities/make_tools/file_converter.py index 0448b217..0896e668 100644 --- a/spinn_utilities/make_tools/file_converter.py +++ b/spinn_utilities/make_tools/file_converter.py @@ -96,26 +96,16 @@ def __call__(self, src, dest, log_file_id, log_database): #: Number of extra lines written to modified not yet recovered #: Extra lines are caused by the header and possibly log comment #: Extra lines are recovered by omitting blank lines - #: - #: :type: int - self._too_many_lines = None + self._too_many_lines: int = -9999999 #: Variables created each time a log method found #: original c log method found - #: - #: :type: str - self._log = None + self._log: str = "Not yet defined!" #: Log methods found so far - #: - #: :type: str - self._log_full = None + self._log_full: str = "Not yet defined!" #: Number of c lines the log method takes - #: - #: :type: int - self._log_lines = None + self._log_lines: int = -9999999 #: Any other stuff found before the log method but on same line - #: - #: :type: str - self._log_start = None + self._log_start: int = -9999999 # variable created when a comment found #: The previous state #: From e2606fb924aefcc7740c26881a6530dfbfaceee1 Mon Sep 17 00:00:00 2001 From: "Christian Y. Brenninkmeijer" Date: Thu, 5 Sep 2024 12:32:10 +0100 Subject: [PATCH 2/2] variable rename as named used twice with different type --- spinn_utilities/make_tools/file_converter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spinn_utilities/make_tools/file_converter.py b/spinn_utilities/make_tools/file_converter.py index 0896e668..9a9b33cb 100644 --- a/spinn_utilities/make_tools/file_converter.py +++ b/spinn_utilities/make_tools/file_converter.py @@ -402,8 +402,8 @@ def _short_log(self, line_num): :rtype: str """ try: - match = LOG_END_REGEX.search(self._log_full) - main = self._log_full[:-len(match.group(0))] + full_match = LOG_END_REGEX.search(self._log_full) + main = self._log_full[:-len(full_match.group(0))] except Exception as e: raise UnexpectedCException( f"Unexpected line {self._log_full} at "