We get little benefit from our mypy QA checks at the moment, because we skip
imports. This patch is what's needed to make mypy succeed with imports on a
single file: master.py
It also updates mypy to the current version, and enables a QA check.
Mypy bugs I encountered:
dict.update with kwargs not supported:
https://github.com/python/mypy/issues/1031
property setters and getters must be adjacent:
https://github.com/python/mypy/issues/1465
This commit:
- Adds a help field to options
- Adds a function to generate parser definitions from options
- Uses this to migrate all boolean flags over to the new system
- Makes all booleans consistently follow the --foo/--not-foo convention
There are a number of things left to be done here:
- Argparse doesn't give us a nice way to format --foo --not-foo help. Click
does, and moving to click is a goal down the track.
- For now, we remove all short aliases. I want to re-evaluate these
systematically once we have the new structure in place.
- Zap various occurrences of Python2 in docs and scripts
- Remove six from netlib, and some other places where obvious project-wide
search and replace works.
This commit improves Python 3 compatibility and fixes two multidict
issues:
1. Headers.items(multi=True) now decodes fields
2. MultiDict.clear(item) has been removed, as Python's
MutableMapping already defines .clear() with different
semantics. This is confusing for everyone who expects a
dict-like object. `.pop("attr", None)` is not fantastic,
but it's the Python way to do it.