From 744d1d1e3177bec8b5a8b5495bda96d00fe9227f Mon Sep 17 00:00:00 2001 From: Roman Dvorak Date: Tue, 8 Dec 2020 01:09:51 +0100 Subject: [PATCH 1/4] fix ci --- pyulog/core.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pyulog/core.py b/pyulog/core.py index 8d39115..fe87b49 100644 --- a/pyulog/core.py +++ b/pyulog/core.py @@ -605,11 +605,10 @@ def _find_sync(self, last_n_bytes=-1): current_file_position = self._file_handle.seek(current_file_position - len(chunk)\ + chunk_index + len(ULog.SYNC_BYTES), 0) sync_seq_found = True - break elif last_n_bytes != -1: # we read the whole last_n_bytes and did not find sync - break + pass # seek back 7 bytes to handle boundary condition and read next chunk current_file_position = self._file_handle.seek(-(len(ULog.SYNC_BYTES)-1), 1) @@ -784,4 +783,3 @@ def get_version_info_str(self, key_name='ver_sw_release'): elif version[3] < 255: type_str = ' (RC)' return 'v{}.{}.{}{}'.format(version[0], version[1], version[2], type_str) return None - From 7ac6e288844e58d645ecb8d48106073213eb06b8 Mon Sep 17 00:00:00 2001 From: Roman Dvorak Date: Tue, 8 Dec 2020 01:29:11 +0100 Subject: [PATCH 2/4] fix CI issues --- pyulog/extract_gps_dump.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyulog/extract_gps_dump.py b/pyulog/extract_gps_dump.py index 2ab2037..0bb29f0 100644 --- a/pyulog/extract_gps_dump.py +++ b/pyulog/extract_gps_dump.py @@ -7,6 +7,7 @@ import argparse import os +import sys from .core import ULog @@ -55,7 +56,7 @@ def is_valid_directory(parser, arg): if len(data) == 0: print("File {0} does not contain gps_dump messages!".format(ulog_file_name)) - exit(0) + sys.exit(0) gps_dump_data = data[0] @@ -63,7 +64,7 @@ def is_valid_directory(parser, arg): field_names = [f.field_name for f in gps_dump_data.field_data] if not 'len' in field_names or not 'data[0]' in field_names: print('Error: gps_dump message has wrong format') - exit(-1) + sys.exit(-1) if len(ulog.dropouts) > 0: print("Warning: file contains {0} dropouts".format(len(ulog.dropouts))) From 3cfd748ac8d9e34866a474fb69332f52cc3c4ae7 Mon Sep 17 00:00:00 2001 From: Roman Dvorak Date: Tue, 8 Dec 2020 10:13:03 +0100 Subject: [PATCH 3/4] revert break --- pyulog/core.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyulog/core.py b/pyulog/core.py index fe87b49..c8e9bce 100644 --- a/pyulog/core.py +++ b/pyulog/core.py @@ -605,10 +605,11 @@ def _find_sync(self, last_n_bytes=-1): current_file_position = self._file_handle.seek(current_file_position - len(chunk)\ + chunk_index + len(ULog.SYNC_BYTES), 0) sync_seq_found = True + break elif last_n_bytes != -1: # we read the whole last_n_bytes and did not find sync - pass + break # seek back 7 bytes to handle boundary condition and read next chunk current_file_position = self._file_handle.seek(-(len(ULog.SYNC_BYTES)-1), 1) From 206e5543dc0b0adcf89164a0578e533ee2258d9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Dvo=C5=99=C3=A1k?= Date: Tue, 8 Dec 2020 10:36:59 +0100 Subject: [PATCH 4/4] replace break-elif -> if --- pyulog/core.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyulog/core.py b/pyulog/core.py index c8e9bce..257160c 100644 --- a/pyulog/core.py +++ b/pyulog/core.py @@ -607,7 +607,7 @@ def _find_sync(self, last_n_bytes=-1): sync_seq_found = True break - elif last_n_bytes != -1: + if last_n_bytes != -1: # we read the whole last_n_bytes and did not find sync break