Per the urllib.parse documentation, username, password, hostname,
and port will be set to None if not set in the parsed URL. The
same is true for urlparse in Python 2 according to its documentation.
* urlparse: allow unicode arguments in more places
Part of #1411
urlunsplit() and similar functions accept either unicode or str in all
places. Their actual return type is unicode if any of the arguments is
unicode and nonempty, which the type system can't exactly express. I
left the return type as str because str is implicitly promoted to
unicode, so using the return type in a place that accepts unicode should
work.
unquote, parse_qs, and parse_qsl return unicode if you pass them unicode,
so AnyStr is appropriate in their stubs.
* fix type for urldefrag
The return type was wrong; this function returns a 2-tuple. The second member of the tuple is always a `str` if the argument type does not contain '#', and otherwise matches the type of the argument.