File tree Expand file tree Collapse file tree 3 files changed +22
-10
lines changed
src/instrumentman/datatransfer Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -19,8 +19,9 @@ The project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1919
2020### Changed
2121
22- - ` geocompy ` dependency minimum version was bumped to ` v0.13.0 `
23- - All console output was updated to use the ` rich ` package instead of ` click `
22+ - Bumped ` geocompy ` dependency minimum version to ` v0.13.0 `
23+ - Updated all console feedback to use the ` rich ` package instead of ` click `
24+ - Changed ` eof ` option of ` download data ` to have no default value
2425
2526### Fixed
2627
Original file line number Diff line number Diff line change 3232@option (
3333 "--eof" ,
3434 help = "End-of-file marker (i.e. the last line to receive)" ,
35- type = str ,
36- default = ""
35+ type = str
3736)
3837@option (
3938 "--autoclose/--no-autoclose" ,
Original file line number Diff line number Diff line change @@ -21,11 +21,14 @@ def main_download(
2121 baud : int = 9600 ,
2222 timeout : int = 2 ,
2323 output : BufferedWriter | None = None ,
24- eof : str = "" ,
24+ eof : str | None = None ,
2525 autoclose : bool = True ,
2626 include_eof : bool = False
2727) -> None :
28- eof_bytes = eof .encode ("ascii" )
28+ eof_bytes : bytes | None = None
29+ if eof is not None :
30+ eof_bytes = eof .encode ("ascii" )
31+
2932 logger = getLogger ("iman.data.download" )
3033 with open_serial (
3134 port ,
@@ -55,13 +58,18 @@ def main_download(
5558 logger .debug ("Received first line" )
5659 progress .update (task , description = "Receiving data" )
5760
58- if data == eof_bytes and autoclose and not include_eof :
61+ if (
62+ eof_bytes is not None
63+ and data == eof_bytes
64+ and autoclose
65+ and not include_eof
66+ ):
5967 logger .info ("Download finished (end-of-file)" )
68+ print_success ("Download reached end-of-file" )
6069
6170 progress .update (
6271 task ,
63- total = lines ,
64- description = "End-Of-File"
72+ total = lines
6573 )
6674 break
6775
@@ -71,7 +79,11 @@ def main_download(
7179 if output is not None :
7280 output .write (data + eol_bytes )
7381
74- if data == eof_bytes and autoclose :
82+ if (
83+ eof_bytes is not None
84+ and data == eof_bytes
85+ and autoclose
86+ ):
7587 logger .info ("Download finished (end-of-file)" )
7688 print_success ("Download reached end-of-file" )
7789
You can’t perform that action at this time.
0 commit comments