Keep imports alphabetically sorted and their order homogeneous across
Python source files.
The isort project has more feature and is more active than the
flake8-import-order plugin.
Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
A function signature is not shown when the function has a parameter
having ``inspect._empty`` as its default value because Signature class
validates function signatures on instantiation.
Without this change, stringify(Optional[Union[int, str]]) returns
'Union[int, str, None]' rather than the expected 'Optional[...]'.
This change fixes that.
fixes: #7654
Currently `format_annotation` fails on instances, because instances don't have
`__module__` and `__qualname__` attributes. Defer building the
`qualified_name` of an annotation until we have established that the annotation
is a type.