* Allow unicode objects throughout urlparse.py
Functions such as `urlparse()`, if given a unicode object,
will happily return a ParseResult of unicode components.
Relatedly, functions like `unquote()` will accept any of
bytes/str/unicode and return an object of the same type
or a composite containing that type.
* Allow unicode in several places in Thread
`name` and `kwargs` to Thread.__init__ function perfectly
well with unicode, not just str.
Note: the .name attribute will always be str even
if the constructor is passed something else, since
__init__ calls:
self.__name = str(name or _newname())
* Use typing.AnyStr properly
...rather than defining a new TypeVar unncessarily.
* Use typing.Text properly
Text is behaviorally equivalent to Union[str, unicode]
for Python 2 argument types.
* Remove outdated import & definition
* [check file consistent] copy changes to _dummy_threading.pyi
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.