I'm using telnetlib.expect() to interface with a device that responds in bytestrings, apparently. Unless I use bytestrings in the regex passed to expect() (either precompiled, or literals), an exception is generated: TypeError: cannot use a string pattern on a bytes-like object. However, pycodestyle complains this is W605 invalid escape sequence '\d', and further reading makes me think this will become a Python syntax error in the future.
In summary:
telnetlib.expect([b'\d']) # OK, but W065
telnetlib.expect(['\d'] # TypeError
telnetlib.expect([r'\d'] # TypeError
Is there a way through this, or is pycodestyle simply wrong?
(BTW, can't seem to suppress the W065 in pycodestyle, other than suppressing all warnings.)