Skip to content

Commit a4191f3

Browse files
committed
tools/capture-test.py: pylint cleanups
These warnings snuck through earlier; silence or evade. Signed-off-by: Andy Ross <andyross@google.com>
1 parent ae2f9ed commit a4191f3

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tools/capture-test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
"""
4747

4848
def parse_opts():
49-
global opts
49+
global opts # pylint: disable=global-statement
5050
ap = argparse.ArgumentParser(description=HELP_TEXT,
5151
formatter_class=argparse.RawDescriptionHelpFormatter)
5252
ap.add_argument("--disable-rtnr", action="store_true", help="Disable RTNR noise reduction")
@@ -103,6 +103,7 @@ def err_wrap(ret):
103103
return ret
104104
def alloc(self, typ):
105105
return (C.c_byte * getattr(self.lib, f"snd_{typ}_sizeof")())()
106+
# pylint: disable=too-few-public-methods
106107
class pcm_channel_area_t(C.Structure):
107108
_fields_ = [("addr", C.c_ulong), ("first", C.c_int), ("step", C.c_int)]
108109

@@ -352,7 +353,8 @@ def echo_test():
352353
# Just slurps in the wav file and chops off the header, assuming
353354
# the user got the format and sampling rate correct.
354355
WAV_HDR_LEN = 44
355-
buf = open(opts.noise, "rb").read()[WAV_HDR_LEN:]
356+
with open(opts.noise, "rb") as f:
357+
buf = f.read()[WAV_HDR_LEN:]
356358

357359
(rfd, wfd) = os.pipe()
358360
pid = os.fork()

0 commit comments

Comments
 (0)