Index: src/common/bin/gnuboat-log-converter
===================================================================
--- src/common/bin/gnuboat-log-converter	(revision 9af063801900ffaaadeaa8dcb5a6d31a87e2caf5)
+++ src/common/bin/gnuboat-log-converter	(revision 7be94aa85100f4c993d468f2fd33072f98b0231c)
@@ -29,4 +29,5 @@
 from gnuboat_common.datahandler import loghandler, logdataset
 
+
 class Format(Enum):
     CSV = 1
@@ -34,4 +35,5 @@
     GPX = 3
 
+
 class CsvCallback:
     def __init__(self, output_file):
@@ -41,5 +43,8 @@
         self._output_file.writerow(dataset.to_dict())
 
-def convertToCsv(input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time):
+
+def convertToCsv(
+    input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time
+):
     try:
         output_file = open(output_file_path, 'w')
@@ -49,19 +54,31 @@
 
     output_file_csv = None
-    fields = ['datetime', 'gps_status', 'latitude', 'latitude_direction', 'longitude',
-              'longitude_direction', 'speed_over_ground', 'course_over_ground' ,
-              'water_depth', 'water_temperature']
-    output_file_csv = csv.DictWriter(output_file, delimiter=' ', quotechar='"',
-                                     quoting=csv.QUOTE_NONNUMERIC, fieldnames=fields)
+    fields = [
+        'datetime', 'gps_status', 'latitude', 'latitude_direction',
+        'longitude', 'longitude_direction', 'speed_over_ground',
+        'course_over_ground', 'water_depth', 'water_temperature'
+    ]
+    output_file_csv = csv.DictWriter(
+        output_file,
+        delimiter=' ',
+        quotechar='"',
+        quoting=csv.QUOTE_NONNUMERIC,
+        fieldnames=fields
+    )
     output_file_csv.writeheader()
 
     csv_callback = CsvCallback(output_file_csv)
     log_handler = loghandler.LogHandler()
-    result = log_handler.gnuboat_read_file(input_file_path, csv_callback.callback, checksums_fix, errors_ignore)
+    result = log_handler.gnuboat_read_file(
+        input_file_path, csv_callback.callback, checksums_fix, errors_ignore
+    )
     if result.messages():
         print('\n'.join(result.errors()))
     output_file.close()
 
-def convertToNmea0183(input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time):
+
+def convertToNmea0183(
+    input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time
+):
     try:
         output_file = open(output_file_path, 'w')
@@ -76,5 +93,5 @@
         print('ERROR: Could not open the input file: {}'.format(error))
         sys.exit(3)
-        
+
     log_handler = loghandler.LogHandler()
     current_row = 1
@@ -83,5 +100,9 @@
         nmea_sentence = log_handler.parse_nmea_sentence(line, checksums_fix)
         if nmea_sentence is None:
-            print('INFO: Failed to parse nmea sentence ({}) at line {}'.format(line.strip(), current_row))
+            print(
+                'INFO: Failed to parse nmea sentence ({}) at line {}'.format(
+                    line.strip(), current_row
+                )
+            )
             if not errors_ignore:
                 input_file.close()
@@ -91,18 +112,31 @@
             output_string = str(nmea_sentence['nmea_sentence'])
             if not strip_time and nmea_sentence['log_timestamp']:
-                output_string = '{}{}'.format(nmea_sentence['log_timestamp'], output_string)
+                output_string = '{}{}'.format(
+                    nmea_sentence['log_timestamp'], output_string
+                )
             output_file.write('{}\r\n'.format(str(output_string)))
         current_row += 1
     output_file.close()
     input_file.close()
-    
-def convertToGpx(input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time):
+
+
+def convertToGpx(
+    input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time
+):
     # make sure, nmea input file, does not have timestamps in front of the nmea
     # sentences
-    [nmea_without_timestamps_handle, nmea_without_timestamp_file_path] = tempfile.mkstemp(text=True)
-    convertToNmea0183(input_file_path, nmea_without_timestamp_file_path, errors_ignore, checksums_fix, True)
-    
-    subprocess.call(['gpsbabel', '-i', 'nmea', '-f', nmea_without_timestamp_file_path, '-o', 'gpx', '-F', output_file_path])
+    [nmea_without_timestamps_handle,
+     nmea_without_timestamp_file_path] = tempfile.mkstemp(text=True)
+    convertToNmea0183(
+        input_file_path, nmea_without_timestamp_file_path, errors_ignore,
+        checksums_fix, True
+    )
+
+    subprocess.call([
+        'gpsbabel', '-i', 'nmea', '-f', nmea_without_timestamp_file_path, '-o',
+        'gpx', '-F', output_file_path
+    ])
     os.remove(nmea_without_timestamp_file_path)
+
 
 def main(argv):
@@ -116,64 +150,116 @@
     formats = []
     for file_format in Format:
-      formats.append(file_format.name)
-
-    parser = argparse.ArgumentParser(description='Convert gnuboat logfiles into other formats')
-    parser.add_argument('-f', '--format', dest='output_format', type=str,
-                        help='Format of the output file.', choices=formats, default='CSV')
-    parser.add_argument('-i', '--ignore-errors', dest='errors_ignore', action='store_false',
-                        help='Ignore any errors reading the log file')
-    parser.add_argument('-c', '--checksums-fix', dest='checksums_fix', action='store_true',
-                        help='Ignore all checksums (and replace them with a new correct one, if needed)')
-    parser.add_argument('input_file', metavar='input_file_path', type=str,
-                        help='File to be converted (input)')
-    parser.add_argument('output_file', metavar='output_file_path', type=str,
-                        help='Write the converted content to file (output)')
-    parser.add_argument('--strip-time', dest='strip_time', action='store_true',
-                        help='Removes timestamp in front of the nmea sentence, if it is there')
+        formats.append(file_format.name)
+
+    parser = argparse.ArgumentParser(
+        description='Convert gnuboat logfiles into other formats'
+    )
+    parser.add_argument(
+        '-f',
+        '--format',
+        dest='output_format',
+        type=str,
+        help='Format of the output file.',
+        choices=formats,
+        default='CSV'
+    )
+    parser.add_argument(
+        '-i',
+        '--ignore-errors',
+        dest='errors_ignore',
+        action='store_false',
+        help='Ignore any errors reading the log file'
+    )
+    parser.add_argument(
+        '-c',
+        '--checksums-fix',
+        dest='checksums_fix',
+        action='store_true',
+        help=
+        'Ignore all checksums (and replace them with a new correct one, if needed)'
+    )
+    parser.add_argument(
+        'input_file',
+        metavar='input_file_path',
+        type=str,
+        help='File to be converted (input)'
+    )
+    parser.add_argument(
+        'output_file',
+        metavar='output_file_path',
+        type=str,
+        help='Write the converted content to file (output)'
+    )
+    parser.add_argument(
+        '--strip-time',
+        dest='strip_time',
+        action='store_true',
+        help='Removes timestamp in front of the nmea sentence, if it is there'
+    )
     arguments = parser.parse_args(argv)
-   
+
     if arguments.output_format is not None:
         format_found = False
         for file_format in Format:
             if file_format.name == arguments.output_format:
-               output_format = file_format.value
-               format_found = True
+                output_format = file_format.value
+                format_found = True
         if not format_found:
-            print('ERROR: Invalid input format specified: {}'.format(arguments.output_format))
+            print(
+                'ERROR: Invalid input format specified: {}'.format(
+                    arguments.output_format
+                )
+            )
             sys.exit(1)
 
     if arguments.errors_ignore is not None:
         errors_ignore = arguments.errors_ignore
-        
+
     if arguments.checksums_fix is not None:
         checksums_fix = arguments.checksums_fix
-        
+
     if arguments.strip_time is not None:
         strip_time = arguments.strip_time
-            
+
     if arguments.input_file is None:
         print('ERROR: No input file specified')
         sys.exit(2)
-    #elif not os.path.exists(arguments.input_file):
-        print('ERROR: Specified input file does not exists: {}'.format(arguments.input_file))
+        #elif not os.path.exists(arguments.input_file):
+        print(
+            'ERROR: Specified input file does not exists: {}'.format(
+                arguments.input_file
+            )
+        )
         sys.exit(3)
     else:
         input_file_path = arguments.input_file
-        
+
     if arguments.output_file is None:
         print('ERROR: No output file specified')
         sys.exit(2)
     elif not os.path.exists(os.path.dirname(arguments.output_file)):
-        print('ERROR: Specified directory of output file does not exists: {}'.format(arguments.output_file))
+        print(
+            'ERROR: Specified directory of output file does not exists: {}'.
+            format(arguments.output_file)
+        )
         sys.exit(3)
     else:
         output_file_path = arguments.output_file
 
-    if output_format == Format.CSV.value: 
-        convertToCsv(input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time)
+    if output_format == Format.CSV.value:
+        convertToCsv(
+            input_file_path, output_file_path, errors_ignore, checksums_fix,
+            strip_time
+        )
     elif output_format == Format.NMEA0183.value:
-        convertToNmea0183(input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time)
+        convertToNmea0183(
+            input_file_path, output_file_path, errors_ignore, checksums_fix,
+            strip_time
+        )
     elif output_format == Format.GPX.value:
-        convertToGpx(input_file_path, output_file_path, errors_ignore, checksums_fix, strip_time)
+        convertToGpx(
+            input_file_path, output_file_path, errors_ignore, checksums_fix,
+            strip_time
+        )
     else:
         print('ERROR: Undefined output format!\n')
@@ -182,4 +268,5 @@
     sys.exit(0)
 
+
 if __name__ == "__main__":
     main(sys.argv[1:])
