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 568568 " UP036" , # https://docs.astral.sh/ruff/rules/outdated-version-block
569569 " UP038" , # https://docs.astral.sh/ruff/rules/non-pep604-isinstance
570570]
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- ]
575571"./scripts/make_bugs_pickle.py" = [
576572 " UP006" , # https://docs.astral.sh/ruff/rules/non-pep585-annotation
577573 " 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):
5757 else :
5858 hexdata = ''
5959
60- with open (args .logfile , "r" , encoding = "iso-8859-1" ) as hexfile :
60+ with open (args .logfile , encoding = "iso-8859-1" ) as hexfile :
6161 for line in hexfile .readlines ():
6262 hexdata += line .strip ()
6363
@@ -90,14 +90,11 @@ def read_log_file(args):
9090
9191 logdata = binascii .unhexlify (hexdata [:idx ])
9292 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 ()
10198
10299 return logdata
103100
You can’t perform that action at this time.
0 commit comments