From 0a1dcea430c057ad2cb4ec1739b79daf8f4c3927 Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Wed, 25 Nov 2020 11:05:34 +0000 Subject: [PATCH 1/8] Line endings stuff --- .../other_data/ASW Data Format2.doc | Bin 31744 -> 31743 bytes .../track_files/other_data/e_trac.txt | 88 ++++++++--------- .../track_files/other_data/e_trac_bad.txt | 92 +++++++++--------- 3 files changed, 90 insertions(+), 90 deletions(-) diff --git a/tests/sample_data/track_files/other_data/ASW Data Format2.doc b/tests/sample_data/track_files/other_data/ASW Data Format2.doc index 5c35d83f752b6c2b6d2049241bc92436cba10cf9..4c1b1bfc7bdc1242431e74091b2a20a8624afb64 100644 GIT binary patch delta 14 WcmZqp!TA3>BL^h_ delta 16 YcmezWow4BuS07l#gG5`Po diff --git a/tests/sample_data/track_files/other_data/e_trac.txt b/tests/sample_data/track_files/other_data/e_trac.txt index 776694418..fc847612d 100644 --- a/tests/sample_data/track_files/other_data/e_trac.txt +++ b/tests/sample_data/track_files/other_data/e_trac.txt @@ -1,45 +1,45 @@ -!Target,MMSI , Date ,Time , Lng , Lat , SOG ,COG , Hdg , Rot , Alt , Pass,Nav,PosAcc,Reg,RM,Com,Index, prev, Name Export:seaPro Date:Tue 06 Aug 19 04:58:18 -4,143732307, 2019/08/06,04:40:00, -28.6213333, 42.166,8,283,511, -128,0,0,15, -1, -1, -1,56,16250, 16238 TRIV -4,143732287, 2019/08/06,04:40:00, -28.008, 42.5333333,9,12,511, -128,147,0,15, -1, -1, -1,56,16257, 16235 DAVE -4,143732297, 2019/08/06,04:40:00, -26.0633333, 40.8586666,3,23,511, -128,0,0,15, -1, -1, -1,56,16259, 16222 DUFF -4,143732329, 2019/08/06,04:42:00, -28.054, 42.596,5,276,0, -128,0,0,15, -1, -1, -1,56,16260, 16217 SPIG -4,143732318, 2019/08/06,04:42:00, -25.9353333, 40.8333333,0,0,0, -128,0,0,15, -1, -1, -1,56,16266, 16244 GRNN -4,143732325, 2019/08/06,04:42:00, -26.084, 40.7513333, 4,33,511, -128,0,0,15, -1, -1, -1,56,16270, 16256 SALT -4,143732286, 2019/08/06,04:42:00, -26.3306666, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16271, 16245 DRAG -4,143732301, 2019/08/06,04:42:00, -25.9993333, 40.8386666,0,0,511, -128,0,0,15, -1, -1, -1,56,16274, 16253 FORE -4,143732316, 2019/08/06,04:42:00, -27.0413333, 43.1253333,3,81,511, -128,0,0,15, -1, -1, -1,56,16275, 16231 CRAY -4,143732287, 2019/08/06,04:42:00, -28.0046666, 42.5406666,10,13,511, -128,0,0,15, -1, -1, -1,56,16280, 16257 DAVE -4,143732297, 2019/08/06,04:42:00, -26.0613333, 40.8613333,3,24,511, -128,0,0,15, -1, -1, -1,56,16281, 16259 DUFF -4,143732338, 2019/08/06,04:40:00, -26.0213333, 41.0366666,0,0,0, -128,0,0,15, -1, -1, -1,56,16283, 16267 NORM -4,143732286, 2019/08/06,04:40:00, -26.26, 43.9846666,0,0,0, -128,0,0,15, -1, -1, -1,56,16285, 16278 LAND -4,143732305, 2019/08/06,04:42:00, -27.8866666, 42.578, 4,272,511, -128,0,0,15, -1, -1, -1,56,16287, 16263 JOAN -4,143732319, 2019/08/06,04:42:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16289, 16255 FLIS -4,143732325, 2019/08/06,04:44:00, -26.0806666, 40.754, 4,33,511, -128,0,0,15, -1, -1, -1,56,16294, 16270 SALT -4,143732316, 2019/08/06,04:44:00, -27.0373333, 43.1273333,3,18,511, -128,0,0,15, -1, -1, -1,56,16295, 16275 CRAY -4,143732307, 2019/08/06,04:42:00, -28.6333333, 42.168,8,282,511, -128,0,0,15, -1, -1, -1,56,16298, 16250 TRIV -4,143732338, 2019/08/06,04:44:00, -26.0206666, 41.0413333,0,0,0, -128,0,0,15, -1, -1, -1,56,16304, 16283 NORM -4,143732286, 2019/08/06,04:46:00, -26.3313333, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16305, 16271 DRAG -4,143732301, 2019/08/06,04:44:00, -25.9999999, 40.84,0,0,511, -128,0,0,15, -1, -1, -1,56,16306, 16274 FORE -4,143732287, 2019/08/06,04:46:00, -28.0013333, 42.5493333,10,11,511, -128,0,0,15, -1, -1, -1,56,16309, 16280 DAVE -4,143732305, 2019/08/06,04:40:00, -27.9733333, 42.2226666,9,5,0, -128,0,0,15, -1, -1, -1,56,16311, 16302 TRUD -4,143732307, 2019/08/06,04:46:00, -28.646, 42.1693333,8,285,511, -128,0,0,15, -1, -1, -1,56,16312, 16298 TRIV -4,143732297, 2019/08/06,04:46:00, -26.0586666, 40.8646666,3,24,511, -128,0,0,15, -1, -1, -1,56,16313, 16281 DUFF -4,143732318, 2019/08/06,04:44:00, -25.94, 40.83,0,0,0, -128,0,0,15, -1, -1, -1,56,16315, 16266 GRNN -4,143732325, 2019/08/06,04:48:00, -26.0773333, 40.7573333, 4,29,511, -128,0,0,15, -1, -1, -1,56,16319, 16294 SALT -4,143732338, 2019/08/06,04:46:00, -26.0133333, 41.044,0,0,0, -128,0,0,15, -1, -1, -1,56,16320, 16304 NORM -4,143732318, 2019/08/06,04:40:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16322, 16300 DINL -4,143732305, 2019/08/06,04:42:00, -27.972, 42.23,8,7,0, -128,0,0,15, -1, -1, -1,56,16324, 16311 TRUD -4,143732329, 2019/08/06,04:48:00, -28.0693333, 42.596,5,272,0, -128,0,0,15, -1, -1, -1,56,16325, 16260 SPIG -4,143732286, 2019/08/06,04:42:00, -26.2513333, 43.996,0,0,0, -128,0,0,15, -1, -1, -1,56,16328, 16285 LAND -4,143732319, 2019/08/06,04:44:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16331, 16289 FLIS -4,143732305, 2019/08/06,04:44:00, -27.894, 42.5786666, 4,278,511, -128,0,0,15, -1, -1, -1,56,16332, 16287 JOAN -4,143732316, 2019/08/06,04:48:00, -27.034, 43.1306666, 4,28,511, -128,0,0,15, -1, -1, -1,56,16335, 16295 CRAY -4,143732287, 2019/08/06,04:48:00, -27.9926666, 42.556,9,59,511, -128,0,0,15, -1, -1, -1,56,16336, 16309 DAVE -4,143732301, 2019/08/06,04:48:00, -26.0006666, 40.842,0,0,511, -128,0,0,15, -1, -1, -1,56,16337, 16306 FORE -4,143732286, 2019/08/06,04:48:00, -26.3313333, 40.8553333,0,0,0, -128,0,0,15, -1, -1, -1,56,16340, 16305 DRAG -4,143732314, 2019/08/06,04:40:00, -27.976, 42.6253333,0,0,511, -128,0,0,15, -1, -1, -1,56,16342, 16310 SPUD -4,143732318, 2019/08/06,04:44:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16343, 16322 DINL -4,143732286, 2019/08/06,04:40:00, -26.8973333, 41.9753333,13,289,511, -128,0,0,15, -1, -1, -1,56,16344, 16323 MEGH -4,143732345, 2019/08/06,04:40:00, -28.0873333, 42.1813333,9,12,0, -128,0,0,15, -1, -1, -1,56,16345, 16316 PELA -4,143732319, 2019/08/06,04:48:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16346, 16331 FLIS +!Target,MMSI , Date ,Time , Lng , Lat , SOG ,COG , Hdg , Rot , Alt , Pass,Nav,PosAcc,Reg,RM,Com,Index, prev, Name Export:seaPro Date:Tue 06 Aug 19 04:58:18 +4,143732307, 2019/08/06,04:40:00, -28.6213333, 42.166,8,283,511, -128,0,0,15, -1, -1, -1,56,16250, 16238 TRIV +4,143732287, 2019/08/06,04:40:00, -28.008, 42.5333333,9,12,511, -128,147,0,15, -1, -1, -1,56,16257, 16235 DAVE +4,143732297, 2019/08/06,04:40:00, -26.0633333, 40.8586666,3,23,511, -128,0,0,15, -1, -1, -1,56,16259, 16222 DUFF +4,143732329, 2019/08/06,04:42:00, -28.054, 42.596,5,276,0, -128,0,0,15, -1, -1, -1,56,16260, 16217 SPIG +4,143732318, 2019/08/06,04:42:00, -25.9353333, 40.8333333,0,0,0, -128,0,0,15, -1, -1, -1,56,16266, 16244 GRNN +4,143732325, 2019/08/06,04:42:00, -26.084, 40.7513333, 4,33,511, -128,0,0,15, -1, -1, -1,56,16270, 16256 SALT +4,143732286, 2019/08/06,04:42:00, -26.3306666, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16271, 16245 DRAG +4,143732301, 2019/08/06,04:42:00, -25.9993333, 40.8386666,0,0,511, -128,0,0,15, -1, -1, -1,56,16274, 16253 FORE +4,143732316, 2019/08/06,04:42:00, -27.0413333, 43.1253333,3,81,511, -128,0,0,15, -1, -1, -1,56,16275, 16231 CRAY +4,143732287, 2019/08/06,04:42:00, -28.0046666, 42.5406666,10,13,511, -128,0,0,15, -1, -1, -1,56,16280, 16257 DAVE +4,143732297, 2019/08/06,04:42:00, -26.0613333, 40.8613333,3,24,511, -128,0,0,15, -1, -1, -1,56,16281, 16259 DUFF +4,143732338, 2019/08/06,04:40:00, -26.0213333, 41.0366666,0,0,0, -128,0,0,15, -1, -1, -1,56,16283, 16267 NORM +4,143732286, 2019/08/06,04:40:00, -26.26, 43.9846666,0,0,0, -128,0,0,15, -1, -1, -1,56,16285, 16278 LAND +4,143732305, 2019/08/06,04:42:00, -27.8866666, 42.578, 4,272,511, -128,0,0,15, -1, -1, -1,56,16287, 16263 JOAN +4,143732319, 2019/08/06,04:42:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16289, 16255 FLIS +4,143732325, 2019/08/06,04:44:00, -26.0806666, 40.754, 4,33,511, -128,0,0,15, -1, -1, -1,56,16294, 16270 SALT +4,143732316, 2019/08/06,04:44:00, -27.0373333, 43.1273333,3,18,511, -128,0,0,15, -1, -1, -1,56,16295, 16275 CRAY +4,143732307, 2019/08/06,04:42:00, -28.6333333, 42.168,8,282,511, -128,0,0,15, -1, -1, -1,56,16298, 16250 TRIV +4,143732338, 2019/08/06,04:44:00, -26.0206666, 41.0413333,0,0,0, -128,0,0,15, -1, -1, -1,56,16304, 16283 NORM +4,143732286, 2019/08/06,04:46:00, -26.3313333, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16305, 16271 DRAG +4,143732301, 2019/08/06,04:44:00, -25.9999999, 40.84,0,0,511, -128,0,0,15, -1, -1, -1,56,16306, 16274 FORE +4,143732287, 2019/08/06,04:46:00, -28.0013333, 42.5493333,10,11,511, -128,0,0,15, -1, -1, -1,56,16309, 16280 DAVE +4,143732305, 2019/08/06,04:40:00, -27.9733333, 42.2226666,9,5,0, -128,0,0,15, -1, -1, -1,56,16311, 16302 TRUD +4,143732307, 2019/08/06,04:46:00, -28.646, 42.1693333,8,285,511, -128,0,0,15, -1, -1, -1,56,16312, 16298 TRIV +4,143732297, 2019/08/06,04:46:00, -26.0586666, 40.8646666,3,24,511, -128,0,0,15, -1, -1, -1,56,16313, 16281 DUFF +4,143732318, 2019/08/06,04:44:00, -25.94, 40.83,0,0,0, -128,0,0,15, -1, -1, -1,56,16315, 16266 GRNN +4,143732325, 2019/08/06,04:48:00, -26.0773333, 40.7573333, 4,29,511, -128,0,0,15, -1, -1, -1,56,16319, 16294 SALT +4,143732338, 2019/08/06,04:46:00, -26.0133333, 41.044,0,0,0, -128,0,0,15, -1, -1, -1,56,16320, 16304 NORM +4,143732318, 2019/08/06,04:40:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16322, 16300 DINL +4,143732305, 2019/08/06,04:42:00, -27.972, 42.23,8,7,0, -128,0,0,15, -1, -1, -1,56,16324, 16311 TRUD +4,143732329, 2019/08/06,04:48:00, -28.0693333, 42.596,5,272,0, -128,0,0,15, -1, -1, -1,56,16325, 16260 SPIG +4,143732286, 2019/08/06,04:42:00, -26.2513333, 43.996,0,0,0, -128,0,0,15, -1, -1, -1,56,16328, 16285 LAND +4,143732319, 2019/08/06,04:44:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16331, 16289 FLIS +4,143732305, 2019/08/06,04:44:00, -27.894, 42.5786666, 4,278,511, -128,0,0,15, -1, -1, -1,56,16332, 16287 JOAN +4,143732316, 2019/08/06,04:48:00, -27.034, 43.1306666, 4,28,511, -128,0,0,15, -1, -1, -1,56,16335, 16295 CRAY +4,143732287, 2019/08/06,04:48:00, -27.9926666, 42.556,9,59,511, -128,0,0,15, -1, -1, -1,56,16336, 16309 DAVE +4,143732301, 2019/08/06,04:48:00, -26.0006666, 40.842,0,0,511, -128,0,0,15, -1, -1, -1,56,16337, 16306 FORE +4,143732286, 2019/08/06,04:48:00, -26.3313333, 40.8553333,0,0,0, -128,0,0,15, -1, -1, -1,56,16340, 16305 DRAG +4,143732314, 2019/08/06,04:40:00, -27.976, 42.6253333,0,0,511, -128,0,0,15, -1, -1, -1,56,16342, 16310 SPUD +4,143732318, 2019/08/06,04:44:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16343, 16322 DINL +4,143732286, 2019/08/06,04:40:00, -26.8973333, 41.9753333,13,289,511, -128,0,0,15, -1, -1, -1,56,16344, 16323 MEGH +4,143732345, 2019/08/06,04:40:00, -28.0873333, 42.1813333,9,12,0, -128,0,0,15, -1, -1, -1,56,16345, 16316 PELA +4,143732319, 2019/08/06,04:48:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16346, 16331 FLIS 4,143732307, 2019/08/06,04:48:00, -28.6573333, 42.1713333,7,283,511, -128,0,0,15, -1, -1, -1,56,16349, 16312 TRIV \ No newline at end of file diff --git a/tests/sample_data/track_files/other_data/e_trac_bad.txt b/tests/sample_data/track_files/other_data/e_trac_bad.txt index 6d2416995..626a314e5 100644 --- a/tests/sample_data/track_files/other_data/e_trac_bad.txt +++ b/tests/sample_data/track_files/other_data/e_trac_bad.txt @@ -1,46 +1,46 @@ -!Target,MMSI , Date ,Time , Lng , Lat , SOG ,COG , Hdg , Rot , Alt , Pass,Nav,PosAcc,Reg,RM,Com,Index, prev, Name Export:seaPro Date:Tue 06 Aug 19 04:58:18 -4,143732307, 2019/08/06,04:40:00, -28.6213333, 42.166,8,283,511, -128,0,0,15, -1, -1, -1,56,16250, 16238 TRIV -4,143732287, 2019/08/06,04:40:00, -28.008, 42.5333333,9,12,511, -128,0,0,15, -1, -1, -1,56,16257, 16235 DAVE -4,143732297, 2019/08/06,04:40:00, -26.0633333, 40.8586666,3,23,511, -128,0,0,15, -1, -1, -1,56,16259, 16222 DUFF -4,143732329, 2019/08/06,46:42:00, -28.054, 42.596,5,276,0, -128,0,0,15, -1, -1, -1,56,16260, 16217 SPIG -4,143732318, 2019/08/06,04:42:00, -25.9353333, 40.8333333,0,0,0, -128,0,0,15, -1, -1, -1,56,16266, 16244 GRNN -4,143732325, 2019/08/06,04:42:00, -26.084, 40.7513333, 4,33,511, -128,0,0,15, -1, -1, -1,56,16270, 16256 SALT -4,143732286, 2019/08/06,04:42:00, -26.3306666, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16271, 16245 DRAG -4,143732301, 2019/08/06,04:42:00, -25.9993333, 40.8386666,0,0,511, -128,0,0,15, -1, -1, -1,56,16274, 16253 FORE -4,143732316, 2019/08/06,04:42:00, -27.0413333, 43.1253333,3,81,511, -128,0,0,15, -1, -1, -1,56,16275, 16231 CRAY -4,143732287, 2019/08/06,04:42:00, -28.0046666, 42.5406666,10,13,511, -128,0,0,15, -1, -1, -1,56,16280, 16257 DAVE -4,143732297, 2019/08/06,04:42:00, -26.0613333, 40.8613333,3,24,511, -128,0,0,15, -1, -1, -1,56,16281, 16259 DUFF -4,143732338, 2019/08/06,04:40:00, -26.0213333, 41.0366666,0,0,0, -128,0,0,15, -1, -1, -1,56,16283, 16267 NORM -4,143732286, 2019/08/06,04:40:00, -26.26, 43.9846666,0,0,0, -128,0,0,15, -1, -1, -1,56,16285, 16278 LAND -4,143732305, 2019/08/06,04:42:00, -27.8866666, 42.578, 4,272,511, -128,0,0,15, -1, -1, -1,56,16287, 16263 JOAN -4,143732319, 2019/08/06,04:42:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16289, 16255 FLIS -4,143732325, 2019/08/06,04:44:00, -26.0806666, 40.754, 4,33,511, -128,0,0,15, -1, -1, -1,56,16294, 16270 SALT -4,143732316, 2019/08/06,04:44:00, -27.0373333, 43.1273333,3,18,511, -128,0,0,15, -1, -1, -1,56,16295, 16275 CRAY -4,143732307, 2019/08/06,04:42:00, -28.6333333, 42.168,8,282,511, -128,0,0,15, -1, -1, -1,56,16298, 16250 TRIV -4,143732338, 2019/08/06,04:44:00, -26.0206666, 41.0413333,0,0,0, -128,0,0,15, -1, -1, -1,56,16304, 16283 NORM -4,143732286, 2019/08/06,04:46:00, -26.3313333, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16305, 16271 DRAG -4,143732301, 2019/08/06,04:44:00, -25.9999999, 40.84,0,0,511, -128,0,0,15, -1, -1, -1,56,16306, 16274 FORE -4,143732287, 2019/08/06,04:46:00, -28.0013333, 42.5493333,10,11,511, -128,0,0,15, -1, -1, -1,56,16309, 16280 DAVE -4,143732305, 2019/08/06,04:40:00, -27.9733333, 42.2226666,9,5,0, -128,0,0,15, -1, -1, -1,56,16311, 16302 TRUD -4,143732307, 2019/08/06,04:46:00, -28.646, 42.1693333,8,285,511, -128,0,0,15, -1, -1, -1,56,16312, 16298 TRIV -4,143732297, 2019/08/06,04:46:00, -26.0586666, 40.8646666,3,24,511, -128,0,0,15, -1, -1, -1,56,16313, 16281 DUFF -4,143732318, 2019/08/06,04:44:00, -25.94, 40.83,0,0,0, -128,0,0,15, -1, -1, -1,56,16315, 16266 GRNN -4,143732325, 2019/08/06,04:48:00, -26.0773333, 40.7573333, 4,29,511, -128,0,0,15, -1, -1, -1,56,16319, 16294 SALT -4,143732338, 2019/08/06,04:46:00, -26.0133333, 41.044,0,0,0, -128,0,0,15, -1, -1, -1,56,16320, 16304 NORM -4,143732318, 2019/08/06,04:40:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16322, 16300 DINL -4,143732305, 2019/08/06,04:42:00, -27.972, 42.23,8,7,0, -128,0,0,15, -1, -1, -1,56,16324, 16311 TRUD -4,143732329, 2019/08/06,04:48:00, -28.0693333, 42.596,5,272,0, -128,0,0,15, -1, -1, -1,56,16325, 16260 SPIG -4,143732286, 2019/08/06,04:42:00, -26.2513333, 43.996,0,0,0, -128,0,0,15, -1, -1, -1,56,16328, 16285 LAND -4,143732319, 2019/08/06,04:44:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16331, 16289 FLIS -4,143732305, 2019/08/06,04:44:00, -27.894, 42.5786666, 4,278,511, -128,0,0,15, -1, -1, -1,56,16332, 16287 JOAN -4,143732316, 2019/08/06,04:48:00, -27.034, 43.1306666, 4,28,511, -128,0,0,15, -1, -1, -1,56,16335, 16295 CRAY -4,143732287, 2019/08/06,04:48:00, -27.9926666, 42.556,9,59,511, -128,0,0,15, -1, -1, -1,56,16336, 16309 DAVE -4,143732301, 2019/08/06,04:48:00, -26.0006666, 40.842,0,0,511, -128,0,0,15, -1, -1, -1,56,16337, 16306 FORE -4,143732286, 2019/08/06,04:48:00, -26.3313333, 40.8553333,0,0,0, -128,0,0,15, -1, -1, -1,56,16340, 16305 DRAG -4,143732314, 2019/08/06,04:40:00, -27.976, 42.6253333,0,0,511, -128,0,0,15, -1, -1, -1,56,16342, 16310 SPUD -4,143732318, 2019/08/06,04:44:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16343, 16322 DINL -4,143732286, 2019/08,04:40:00, -26.8973333, 41.9753333,13,289,511, -128,0,0,15, -1, -1, -1,56,16344, 16323 MEGH -4,143732345, 2019/08/06,04:40, -28.0873333, 42.1813333,9,12,0, -128,0,0,15, -1, -1, -1,56,16345, 16316 PELA -4,143732319, 2019/08/06,04:48:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16346, 16331 FLIS -4,143732307, 2019/08/06,04:48:00, -28.6573333, 42.1713333,7,283,511 - +!Target,MMSI , Date ,Time , Lng , Lat , SOG ,COG , Hdg , Rot , Alt , Pass,Nav,PosAcc,Reg,RM,Com,Index, prev, Name Export:seaPro Date:Tue 06 Aug 19 04:58:18 +4,143732307, 2019/08/06,04:40:00, -28.6213333, 42.166,8,283,511, -128,0,0,15, -1, -1, -1,56,16250, 16238 TRIV +4,143732287, 2019/08/06,04:40:00, -28.008, 42.5333333,9,12,511, -128,0,0,15, -1, -1, -1,56,16257, 16235 DAVE +4,143732297, 2019/08/06,04:40:00, -26.0633333, 40.8586666,3,23,511, -128,0,0,15, -1, -1, -1,56,16259, 16222 DUFF +4,143732329, 2019/08/06,46:42:00, -28.054, 42.596,5,276,0, -128,0,0,15, -1, -1, -1,56,16260, 16217 SPIG +4,143732318, 2019/08/06,04:42:00, -25.9353333, 40.8333333,0,0,0, -128,0,0,15, -1, -1, -1,56,16266, 16244 GRNN +4,143732325, 2019/08/06,04:42:00, -26.084, 40.7513333, 4,33,511, -128,0,0,15, -1, -1, -1,56,16270, 16256 SALT +4,143732286, 2019/08/06,04:42:00, -26.3306666, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16271, 16245 DRAG +4,143732301, 2019/08/06,04:42:00, -25.9993333, 40.8386666,0,0,511, -128,0,0,15, -1, -1, -1,56,16274, 16253 FORE +4,143732316, 2019/08/06,04:42:00, -27.0413333, 43.1253333,3,81,511, -128,0,0,15, -1, -1, -1,56,16275, 16231 CRAY +4,143732287, 2019/08/06,04:42:00, -28.0046666, 42.5406666,10,13,511, -128,0,0,15, -1, -1, -1,56,16280, 16257 DAVE +4,143732297, 2019/08/06,04:42:00, -26.0613333, 40.8613333,3,24,511, -128,0,0,15, -1, -1, -1,56,16281, 16259 DUFF +4,143732338, 2019/08/06,04:40:00, -26.0213333, 41.0366666,0,0,0, -128,0,0,15, -1, -1, -1,56,16283, 16267 NORM +4,143732286, 2019/08/06,04:40:00, -26.26, 43.9846666,0,0,0, -128,0,0,15, -1, -1, -1,56,16285, 16278 LAND +4,143732305, 2019/08/06,04:42:00, -27.8866666, 42.578, 4,272,511, -128,0,0,15, -1, -1, -1,56,16287, 16263 JOAN +4,143732319, 2019/08/06,04:42:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16289, 16255 FLIS +4,143732325, 2019/08/06,04:44:00, -26.0806666, 40.754, 4,33,511, -128,0,0,15, -1, -1, -1,56,16294, 16270 SALT +4,143732316, 2019/08/06,04:44:00, -27.0373333, 43.1273333,3,18,511, -128,0,0,15, -1, -1, -1,56,16295, 16275 CRAY +4,143732307, 2019/08/06,04:42:00, -28.6333333, 42.168,8,282,511, -128,0,0,15, -1, -1, -1,56,16298, 16250 TRIV +4,143732338, 2019/08/06,04:44:00, -26.0206666, 41.0413333,0,0,0, -128,0,0,15, -1, -1, -1,56,16304, 16283 NORM +4,143732286, 2019/08/06,04:46:00, -26.3313333, 40.856,0,0,0, -128,0,0,15, -1, -1, -1,56,16305, 16271 DRAG +4,143732301, 2019/08/06,04:44:00, -25.9999999, 40.84,0,0,511, -128,0,0,15, -1, -1, -1,56,16306, 16274 FORE +4,143732287, 2019/08/06,04:46:00, -28.0013333, 42.5493333,10,11,511, -128,0,0,15, -1, -1, -1,56,16309, 16280 DAVE +4,143732305, 2019/08/06,04:40:00, -27.9733333, 42.2226666,9,5,0, -128,0,0,15, -1, -1, -1,56,16311, 16302 TRUD +4,143732307, 2019/08/06,04:46:00, -28.646, 42.1693333,8,285,511, -128,0,0,15, -1, -1, -1,56,16312, 16298 TRIV +4,143732297, 2019/08/06,04:46:00, -26.0586666, 40.8646666,3,24,511, -128,0,0,15, -1, -1, -1,56,16313, 16281 DUFF +4,143732318, 2019/08/06,04:44:00, -25.94, 40.83,0,0,0, -128,0,0,15, -1, -1, -1,56,16315, 16266 GRNN +4,143732325, 2019/08/06,04:48:00, -26.0773333, 40.7573333, 4,29,511, -128,0,0,15, -1, -1, -1,56,16319, 16294 SALT +4,143732338, 2019/08/06,04:46:00, -26.0133333, 41.044,0,0,0, -128,0,0,15, -1, -1, -1,56,16320, 16304 NORM +4,143732318, 2019/08/06,04:40:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16322, 16300 DINL +4,143732305, 2019/08/06,04:42:00, -27.972, 42.23,8,7,0, -128,0,0,15, -1, -1, -1,56,16324, 16311 TRUD +4,143732329, 2019/08/06,04:48:00, -28.0693333, 42.596,5,272,0, -128,0,0,15, -1, -1, -1,56,16325, 16260 SPIG +4,143732286, 2019/08/06,04:42:00, -26.2513333, 43.996,0,0,0, -128,0,0,15, -1, -1, -1,56,16328, 16285 LAND +4,143732319, 2019/08/06,04:44:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16331, 16289 FLIS +4,143732305, 2019/08/06,04:44:00, -27.894, 42.5786666, 4,278,511, -128,0,0,15, -1, -1, -1,56,16332, 16287 JOAN +4,143732316, 2019/08/06,04:48:00, -27.034, 43.1306666, 4,28,511, -128,0,0,15, -1, -1, -1,56,16335, 16295 CRAY +4,143732287, 2019/08/06,04:48:00, -27.9926666, 42.556,9,59,511, -128,0,0,15, -1, -1, -1,56,16336, 16309 DAVE +4,143732301, 2019/08/06,04:48:00, -26.0006666, 40.842,0,0,511, -128,0,0,15, -1, -1, -1,56,16337, 16306 FORE +4,143732286, 2019/08/06,04:48:00, -26.3313333, 40.8553333,0,0,0, -128,0,0,15, -1, -1, -1,56,16340, 16305 DRAG +4,143732314, 2019/08/06,04:40:00, -27.976, 42.6253333,0,0,511, -128,0,0,15, -1, -1, -1,56,16342, 16310 SPUD +4,143732318, 2019/08/06,04:44:00, -26.1706666, 43.33,0,0,511, -128,0,0,15, -1, -1, -1,56,16343, 16322 DINL +4,143732286, 2019/08,04:40:00, -26.8973333, 41.9753333,13,289,511, -128,0,0,15, -1, -1, -1,56,16344, 16323 MEGH +4,143732345, 2019/08/06,04:40, -28.0873333, 42.1813333,9,12,0, -128,0,0,15, -1, -1, -1,56,16345, 16316 PELA +4,143732319, 2019/08/06,04:48:00, -26.674, 43.2753333,0,98,511, -128,0,0,15, -1, -1, -1,56,16346, 16331 FLIS +4,143732307, 2019/08/06,04:48:00, -28.6573333, 42.1713333,7,283,511 + From 8a9ea769dc67940538db9a18c7c16bb152674c0e Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Wed, 25 Nov 2020 11:07:23 +0000 Subject: [PATCH 2/8] First go at viewer CLI Added --viewer command line argument Changed ViewDataShell to behave slightly differently depending on whether it is being called as admin or viewer --- pepys_admin/cli.py | 34 +++++++++++++++++++++++++++++++--- pepys_admin/view_data_cli.py | 19 ++++++++++++++----- 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/pepys_admin/cli.py b/pepys_admin/cli.py index 7e99cf517..f6df59643 100644 --- a/pepys_admin/cli.py +++ b/pepys_admin/cli.py @@ -2,7 +2,9 @@ from config import DB_HOST, DB_NAME, DB_PASSWORD, DB_PORT, DB_TYPE, DB_USERNAME from pepys_admin.admin_cli import AdminShell +from pepys_admin.view_data_cli import ViewDataShell from pepys_import.core.store.data_store import DataStore +from pepys_import.utils.data_store_utils import is_schema_created from pepys_import.utils.error_handling import handle_database_errors @@ -15,11 +17,18 @@ def main(): # pragma: no cover "SQLite database file to use (overrides config file database settings). " "Use `:memory:` for temporary in-memory instance" ) + viewer_help = "Start Pepys Admin in Viewer mode, where the only actions available are those under the 'View Data' menu" parser = argparse.ArgumentParser(description="Pepys Admin CLI") parser.add_argument("--path", type=str, help="CSV files path") parser.add_argument("--db", help=db_help, required=False, default=None) + parser.add_argument("--viewer", help=viewer_help, action="store_true", default=False) args = parser.parse_args() + if args.viewer: + welcome_text = "Pepys_viewer" + else: + welcome_text = "Pepys_admin" + if args.db is None: data_store = DataStore( db_username=DB_USERNAME, @@ -28,7 +37,7 @@ def main(): # pragma: no cover db_port=DB_PORT, db_name=DB_NAME, db_type=DB_TYPE, - welcome_text="Pepys_admin", + welcome_text=welcome_text, ) else: data_store = DataStore( @@ -38,10 +47,13 @@ def main(): # pragma: no cover db_port=0, db_name=args.db, db_type="sqlite", - welcome_text="Pepys_admin", + welcome_text=welcome_text, ) - run_admin_shell(data_store, args.path) + if args.viewer: + run_viewer_shell(data_store) + else: + run_admin_shell(data_store, args.path) def run_admin_shell(data_store, path): @@ -57,5 +69,21 @@ def run_admin_shell(data_store, path): AdminShell(data_store, path).cmdloop() +def run_viewer_shell(data_store): + """Runs the :code:`ViewDataShell`. + + :param data_store: A :class:`DataStore` object + :type data_store: DataStore + :param path: CSV files path which will be used by import reference & metadata options + :type path: String + :return: + """ + with handle_database_errors(): + if is_schema_created(data_store.engine, data_store.db_type) is False: + print("Database schema does not exist: tables cannot be viewed") + return + ViewDataShell(data_store, viewer=True).cmdloop() + + if __name__ == "__main__": main() diff --git a/pepys_admin/view_data_cli.py b/pepys_admin/view_data_cli.py index 95a0c111f..18c494235 100644 --- a/pepys_admin/view_data_cli.py +++ b/pepys_admin/view_data_cli.py @@ -33,9 +33,8 @@ class ViewDataShell(BaseShell): (4) Output SQL Results to CSV (.) Back """ - prompt = "(pepys-admin) (view) " - def __init__(self, data_store): + def __init__(self, data_store, viewer=False): super(ViewDataShell, self).__init__() self.data_store = data_store self.aliases = { @@ -46,10 +45,20 @@ def __init__(self, data_store): "4": self.do_output_sql_to_csv, } - @staticmethod - def do_cancel(): + self.viewer = viewer + + if viewer: + self.prompt = "(pepys-viewer) " + self.intro = self.intro.replace("(.) Back", "(.) Exit") + else: + self.prompt = "(pepys-admin) (view) " + + def do_cancel(self): """Returns to the previous menu""" - print("Returning to the previous menu...") + if self.viewer: + print("Thank you for using Pepys Viewer") + else: + print("Returning to the previous menu...") def _get_table_names(self): """Gets the table names using SQL Alchemy's inspect db functionality.""" From 8c5a3a4381f623eaeef7f94aa5fe64c069aedea0 Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Fri, 27 Nov 2020 13:27:52 +0000 Subject: [PATCH 3/8] Add Pepys Viewer Start Menu shortcuts --- bin/install_pepys.ps1 | 6 +++++- bin/pepys_viewer.bat | 14 ++++++++++++++ bin/pepys_viewer_training.bat | 14 ++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 bin/pepys_viewer.bat create mode 100644 bin/pepys_viewer_training.bat diff --git a/bin/install_pepys.ps1 b/bin/install_pepys.ps1 index e271654e3..5dbc190b1 100644 --- a/bin/install_pepys.ps1 +++ b/bin/install_pepys.ps1 @@ -85,9 +85,13 @@ try { # Create Pepys folder in Start Menu New-Item -Path $startmenu_location -Name "Pepys" -ItemType "directory" + # Pepys Admin shortcuts Make-Shortcut -ShortcutLocation ($startmenu_location + "Pepys\Pepys Admin.lnk") -TargetPath ".\pepys_admin.bat" -Icon $icon_string - Make-Shortcut -ShortcutLocation ($startmenu_location + "Pepys\Pepys Admin (training mode).lnk") -TargetPath ".\pepys_admin_training.bat" -Icon $icon_string + + # Pepys Viewer shortcuts + Make-Shortcut -ShortcutLocation ($startmenu_location + "Pepys\Pepys Viewer.lnk") -TargetPath ".\pepys_viewer.bat" -Icon $icon_string + Make-Shortcut -ShortcutLocation ($startmenu_location + "Pepys\Pepys Viewer (training mode).lnk") -TargetPath ".\pepys_viewer_training.bat" -Icon $icon_string } catch { Write-Output $_ diff --git a/bin/pepys_viewer.bat b/bin/pepys_viewer.bat new file mode 100644 index 000000000..345e3cb1a --- /dev/null +++ b/bin/pepys_viewer.bat @@ -0,0 +1,14 @@ +@echo off +CALL set_paths.bat +REM If error returned from set_paths.bat then don't continue with running python +IF ERRORLEVEL 1 GOTO :ERROR + +python -m pepys_admin.cli --viewer %1 %2 %3 %4 %5 %6 %7 %8 %9 +PAUSE + +REM Go to the end of the file, skipping the :ERROR label below +GOTO :eof + +REM PAUSE so that the user can see the error +:ERROR +PAUSE \ No newline at end of file diff --git a/bin/pepys_viewer_training.bat b/bin/pepys_viewer_training.bat new file mode 100644 index 000000000..68de1d34f --- /dev/null +++ b/bin/pepys_viewer_training.bat @@ -0,0 +1,14 @@ +@echo off +CALL set_paths.bat +REM If error returned from set_paths.bat then don't continue with running python +IF ERRORLEVEL 1 GOTO :ERROR + +python -m pepys_admin.cli --viewer --training %1 %2 %3 %4 %5 %6 %7 %8 %9 +PAUSE + +REM Go to the end of the file, skipping the :ERROR label below +GOTO :eof + +REM PAUSE so that the user can see the error +:ERROR +PAUSE \ No newline at end of file From 177409028f10d5088d4c0342c47800fc5a1db3e5 Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Fri, 27 Nov 2020 13:33:34 +0000 Subject: [PATCH 4/8] Update test functions to use run_shell not run_admin_shell --- tests/test_admin_cli.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/test_admin_cli.py b/tests/test_admin_cli.py index 7ef9ccde8..5e2a89db5 100644 --- a/tests/test_admin_cli.py +++ b/tests/test_admin_cli.py @@ -14,7 +14,7 @@ from paths import MIGRATIONS_DIRECTORY from pepys_admin.admin_cli import AdminShell -from pepys_admin.cli import run_admin_shell +from pepys_admin.cli import run_shell from pepys_admin.export_cli import ExportByPlatformNameShell, ExportShell from pepys_admin.initialise_cli import InitialiseShell from pepys_admin.snapshot_cli import SnapshotShell @@ -705,7 +705,7 @@ def test_missing_db_column_sqlite(self, patched_input, patched_iterfzf): temp_output = StringIO() with redirect_stdout(temp_output): data_store = DataStore("", "", "", 0, "cli_import_test.db", db_type="sqlite") - run_admin_shell(data_store=data_store, path=".") + run_shell(data_store=data_store, path=".") output = temp_output.getvalue() assert "ERROR: SQL error when communicating with database" in output @@ -740,7 +740,7 @@ def test_missing_db_column_sqlite_2(self, patched_input): temp_output = StringIO() with redirect_stdout(temp_output): data_store = DataStore("", "", "", 0, "cli_import_test.db", db_type="sqlite") - run_admin_shell(data_store=data_store, path=".") + run_shell(data_store=data_store, path=".") output = temp_output.getvalue() assert "ERROR: Table summaries couldn't be printed." in output @@ -803,7 +803,7 @@ def test_missing_db_column_postgres(self, patched_input, patched_iterfzf): db_port=55527, db_type="postgres", ) - run_admin_shell(data_store=data_store, path=".") + run_shell(data_store=data_store, path=".") output = temp_output.getvalue() assert "ERROR: SQL error when communicating with database" in output @@ -829,7 +829,7 @@ def test_missing_db_column_postgres_2(self, patched_input): db_port=55527, db_type="postgres", ) - run_admin_shell(data_store=data_store, path=".") + run_shell(data_store=data_store, path=".") output = temp_output.getvalue() assert "ERROR: Table summaries couldn't be printed." in output @@ -1595,7 +1595,7 @@ def test_training_mode_message(patched_prompt1, patched_prompt2, patched_input): temp_output = StringIO() with redirect_stdout(temp_output): try: - run_admin_shell(db=None, training=True, path=".") + run_shell(db=None, training=True, path=".") except SystemExit: pass output = temp_output.getvalue() @@ -1628,7 +1628,7 @@ def test_training_mode_setup(patched_prompt1, patched_prompt2, patched_input, pa db_name = os.path.expanduser(os.path.join("~", "pepys_training_database.db")) try: - run_admin_shell(db=None, training=True, path=".") + run_shell(db=None, training=True, path=".") except SystemExit: pass From 698e4f27ba37d5825af38a6a02cbb89607f2d03c Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Fri, 27 Nov 2020 15:40:50 +0000 Subject: [PATCH 5/8] Add more tests for viewer cli --- tests/test_admin_cli.py | 43 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tests/test_admin_cli.py b/tests/test_admin_cli.py index 5e2a89db5..29fa0c7f3 100644 --- a/tests/test_admin_cli.py +++ b/tests/test_admin_cli.py @@ -6,7 +6,7 @@ from datetime import datetime from io import StringIO from sqlite3 import OperationalError -from unittest.mock import patch +from unittest.mock import ANY, patch import pg8000 import pytest @@ -1650,5 +1650,46 @@ def test_training_mode_setup(patched_prompt1, patched_prompt2, patched_input, pa os.environ["PEPYS_CONFIG_FILE"] = orig_pepys_config_file +@patch("pepys_admin.cli.DataStore") +def test_viewer_mode_datastore(patched_ds): + run_shell(path=".", db=None, training=False, viewer=True) + + patched_ds.assert_called_with( + db_username=ANY, + db_password=ANY, + db_host=ANY, + db_port=ANY, + db_name=ANY, + db_type=ANY, + welcome_text="Pepys_viewer", + ) + + +def test_viewer_mode_blank_db(): + temp_output = StringIO() + with redirect_stdout(temp_output): + try: + run_shell(path=".", db=":memory:", training=False, viewer=True) + except SystemExit: + pass + output = temp_output.getvalue() + print(output) + + assert "Database schema does not exist: tables cannot be viewed" in output + + +@patch("pepys_admin.cli.ViewDataShell") +def test_viewer_mode_valid_db(patched_vds): + if os.path.exists("created_db.db"): + os.remove("created_db.db") + + store = DataStore("", "", "", 0, "created_db.db", db_type="sqlite") + store.initialise() + + run_shell(path=".", db="created_db.db", training=False, viewer=True) + + patched_vds.assert_called_with(ANY, viewer=True) + + if __name__ == "__main__": unittest.main() From 148bd2db10b2f4f63bb14e66dca7a3af972f1d17 Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Mon, 30 Nov 2020 17:21:26 +0000 Subject: [PATCH 6/8] Fix version of black, see if solves GH Actions pip install issue --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index 72f26f485..ece440c05 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -9,7 +9,7 @@ pytest>=5.3.5 Sphinx==3.* twine==3.* nose2 -black +black==20.8b0 pre-commit sphinx_rtd_theme git+https://github.com/tk0miya/testing.postgresql.git#egg=testing.postgresql From b2d4040a3bcd4c1eb947a4cda368579e3488c4a1 Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Mon, 30 Nov 2020 17:36:55 +0000 Subject: [PATCH 7/8] Try older version of black --- requirements_dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements_dev.txt b/requirements_dev.txt index ece440c05..c16d3c077 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -9,7 +9,7 @@ pytest>=5.3.5 Sphinx==3.* twine==3.* nose2 -black==20.8b0 +black==19.10b0 pre-commit sphinx_rtd_theme git+https://github.com/tk0miya/testing.postgresql.git#egg=testing.postgresql From f6ec0f58c0b6559b5323ac7b934147064382646e Mon Sep 17 00:00:00 2001 From: Robin Wilson Date: Mon, 30 Nov 2020 18:26:11 +0000 Subject: [PATCH 8/8] Remove pinning of black as it causes major issues, and revert back to legacy pip resolver --- create_deployment.ps1 | 2 +- requirements_dev.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/create_deployment.ps1 b/create_deployment.ps1 index 1d4114ef1..7f39bc43c 100644 --- a/create_deployment.ps1 +++ b/create_deployment.ps1 @@ -154,7 +154,7 @@ catch { try { # Do a standard pip install of the requirements and dev requirements, not warning us that scripts will be unavailable - .\python\python.exe -m pip install -r requirements.txt -r requirements_dev.txt --no-warn-script-location --no-cache-dir + .\python\python.exe -m pip install -r requirements.txt -r requirements_dev.txt --no-warn-script-location --no-cache-dir --use-deprecated=legacy-resolver if ($LastExitCode -ne 0) { diff --git a/requirements_dev.txt b/requirements_dev.txt index c16d3c077..72f26f485 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -9,7 +9,7 @@ pytest>=5.3.5 Sphinx==3.* twine==3.* nose2 -black==19.10b0 +black pre-commit sphinx_rtd_theme git+https://github.com/tk0miya/testing.postgresql.git#egg=testing.postgresql