mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
PR #3887 changed some `str` types to `Union[str, unicode]`. The `str` types were too narrow, but the new types are too general, resulting in around 80 false positives in a Dropbox internal repository. I think that it's better to narrow down the types back some to avoid the false positives, as these are commonly used functions. Test cases: ``` from urlparse import urlunparse, urlunsplit, urljoin, urlparse, urlsplit reveal_type(urlunparse(('1', '2', '3', '4', '5', '6'))) # str reveal_type(urlunparse(['1', '2', '3', '4', '5', '6'])) # str reveal_type(urlunparse((u'1', '2', '3', '4', '5', '6'))) # unicode reveal_type(urlunparse([u'1', '2', '3', '4', '5', '6'])) # unicode reveal_type(urlunsplit(('1', '2', '3', '4', '5'))) # str reveal_type(urlunsplit(['1', '2', '3', '4', '5'])) # str reveal_type(urlunsplit((u'1', '2', '3', '4', '5'))) # unicode reveal_type(urlunsplit([u'1', '2', '3', '4', '5'])) # unicode reveal_type(urljoin('x', 'y')) # str reveal_type(urljoin(u'x', 'y')) # unicode reveal_type(urljoin('x', u'y')) # unicode reveal_type(urlparse('x').path) # str reveal_type(urlparse(u'x').path) # str reveal_type(urlparse(u'x').username) # Optional[str] reveal_type(urlsplit('x').path) # str reveal_type(urlsplit(u'x').path) # str ```