scripts: west_commands: runners: Ignore open file without ctx (SIM115)

Add noqa to a complex statement with multiple open/close statements.

See https://docs.astral.sh/ruff/rules/open-file-with-context-handler/

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
This commit is contained in:
Pieter De Gendt 2024-11-20 09:24:05 +01:00 committed by Benjamin Cabé
commit dbaf01ef28

View file

@ -278,7 +278,7 @@ class CANopenProgramDownloader(object):
self.logger.info('Downloading program: %s', bin_file)
try:
size = os.path.getsize(bin_file)
infile = open(bin_file, 'rb')
infile = open(bin_file, 'rb') # noqa: SIM115
outfile = self.data_sdo.open('wb', buffering=self.download_buffer_size,
size=size, block_transfer=self.block_transfer)