diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1b9fadc..43d1385 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,7 +24,7 @@ repos: name: pylint (library code) types: [python] args: - - --disable=consider-using-f-string + - --disable=consider-using-f-string,duplicate-code exclude: "^(docs/|examples/|tests/|setup.py$)" - id: pylint name: pylint (example code) diff --git a/adafruit_circuitplayground/bluefruit.py b/adafruit_circuitplayground/bluefruit.py index 93b13e2..d19fe60 100755 --- a/adafruit_circuitplayground/bluefruit.py +++ b/adafruit_circuitplayground/bluefruit.py @@ -158,10 +158,9 @@ def play_mp3(self, file_name): # Play a specified file. self.stop_tone() self._speaker_enable.value = True - with self._audio_out( - board.SPEAKER - ) as audio: # pylint: disable=not-callable - mp3file = audiomp3.MP3Decoder(open(file_name, "rb")) + with self._audio_out(board.SPEAKER) as audio, audiomp3.MP3Decoder( + open(file_name, "rb") + ) as mp3file: # pylint: disable=not-callable audio.play(mp3file) while audio.playing: pass diff --git a/adafruit_circuitplayground/circuit_playground_base.py b/adafruit_circuitplayground/circuit_playground_base.py index f22bb41..69b5188 100755 --- a/adafruit_circuitplayground/circuit_playground_base.py +++ b/adafruit_circuitplayground/circuit_playground_base.py @@ -801,8 +801,9 @@ def play_file(self, file_name): # Play a specified file. self.stop_tone() self._speaker_enable.value = True - with self._audio_out(board.SPEAKER) as audio: # pylint: disable=not-callable - wavefile = audiocore.WaveFile(open(file_name, "rb")) + with self._audio_out( # pylint: disable=not-callable + board.SPEAKER + ) as audio, audiocore.WaveFile(open(file_name, "rb")) as wavefile: audio.play(wavefile) while audio.playing: pass