Some things are disabled by default because most people are not
interested in them. But (non-obviously) adding a list of ignores to the
flake8 configuration file will actually turn back on anything you didn't
explicitly specify.
This reduces the number of flake8 warnings by about 100, a vast chunk of
which are
E704 multiple statements on one line (def)
which turn out to actually be T.overload or typing definitions with
def func(): ...
which is understandably quite reasonable to permit.
Imported both inside and outside of T.TYPE_CHECKING, the runtime import
can be removed by quote-deferring one of the use sites.
Update:
In between then and now, this got removed from T.TYPE_CHECKING, move it
back there rather than preserving the runtime import.
(var,) is the correct way to pass values to a percent formatted string,
but not to .format so we would end up printing something like:
unexpected input at line (4,)
Upgrade to an f-string and insert the correct value correctly.
'{}'.format('foo') for any given value of 'foo' (in this case, a
function returning a string), can always just be 'foo' directly, which
is a lot more readable.
All changes were created by running
"pyupgrade --py3-only"
and committing the results. Although this has been performed in the
past, newer versions of pyupgrade can automatically catch more
opportunities, notably list comprehensions can use generators instead,
in the following cases:
- unpacking into function arguments as function(*generator)
- unpacking into assignments of the form x, y = generator
- as the argument to some builtin functions such as min/max/sorted
Also catch a few creeping cases of new code added using older styles.
We wrote:
ERROR: install_emptydir keyword argument "install_mode" permissions string must
be exactly 9 characters, got "4" in the form rwxr-xr-x
Let's change this around to be easier to read.
Also, 1-based numbering was used (for components) and 0-based for "bits".
And actually the "bits" are not bits, but octal digits. So say "permissions
character 1", "permissions character 2".
And finally change "must be … if provided" to "can only be". (If it isn't
provided, it "is not", so the sentence is still valid. The user will only
get this error if they provide something, so we don't need to be super precise
and say "if provided". And then we avoid confusing the reader whether
it's "if provided" attaches to the the "False" or to the whole sentence.)
The previous commit bd2fcb268b
accidentally used the wrong var so the param name was missing,
leading to an error of "unrecognized arguments" for the
datadirs parameter value.
We ended up passing a NoneType as the program binary, which is a very
awkward way to communicate an error when failing to write a basic
package version file.
There were two allowed kwargs that were unused, I've dropped them for
now, though I need to check if they were documented. If they are then we
need to deprecate them to remove them, otherwise we'll just leave them
removed.