File tree Expand file tree Collapse file tree 2 files changed +6
-13
lines changed
scripts/logging/dictionary Expand file tree Collapse file tree 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change 568
568
" UP036" , # https://docs.astral.sh/ruff/rules/outdated-version-block
569
569
" UP038" , # https://docs.astral.sh/ruff/rules/non-pep604-isinstance
570
570
]
571
- "./scripts/logging/dictionary/log_parser.py" = [
572
- " SIM115" , # https://docs.astral.sh/ruff/rules/open-file-with-context-handler
573
- " UP015" , # https://docs.astral.sh/ruff/rules/redundant-open-modes
574
- ]
575
571
"./scripts/make_bugs_pickle.py" = [
576
572
" UP006" , # https://docs.astral.sh/ruff/rules/non-pep585-annotation
577
573
" UP035" , # https://docs.astral.sh/ruff/rules/deprecated-import
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ def read_log_file(args):
57
57
else :
58
58
hexdata = ''
59
59
60
- with open (args .logfile , "r" , encoding = "iso-8859-1" ) as hexfile :
60
+ with open (args .logfile , encoding = "iso-8859-1" ) as hexfile :
61
61
for line in hexfile .readlines ():
62
62
hexdata += line .strip ()
63
63
@@ -90,14 +90,11 @@ def read_log_file(args):
90
90
91
91
logdata = binascii .unhexlify (hexdata [:idx ])
92
92
else :
93
- logfile = open (args .logfile , "rb" )
94
- if not logfile :
95
- logger .error ("ERROR: Cannot open binary log data file: %s, exiting..." , args .logfile )
96
- sys .exit (1 )
97
-
98
- logdata = logfile .read ()
99
-
100
- logfile .close ()
93
+ with open (args .logfile , "rb" ) as logfile :
94
+ if not logfile :
95
+ logger .error (f"ERROR: Cannot open binary log data file: { args .logfile } , exiting..." )
96
+ sys .exit (1 )
97
+ logdata = logfile .read ()
101
98
102
99
return logdata
103
100
You can’t perform that action at this time.
0 commit comments