Derived from the Pylint linter.
This rule is unstable and in preview. The
--preview flag is required for use.
What it does#
Check for an invalid
mode argument in
Why is this bad?#
open function accepts a
mode argument that specifies how the file
should be opened (e.g., read-only, write-only, append-only, etc.).
Python supports a variety of open modes:
x, to control
reading, writing, appending, and creating, respectively, along with
b (binary mode),
+ (read and write), and
U (universal newlines),
the latter of which is only valid alongside
r. This rule detects both
invalid combinations of modes and invalid characters in the mode string