Commit Graph

11 Commits

Author SHA1 Message Date
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Akuli
e3f662b648 switch to lower-case "# undocumented" comments (#5871) 2021-08-07 08:00:41 -07:00
Maarten ter Huurne
9bba8a4b83 Correct annotation of headers parameter of HTTP event handlers (#5854)
* Use HTTPMessage for the headers parameter of HTTP event handlers

While the documentation of `BaseHandler.http_error_default()` describes
the `hdrs` (`headers` in most other handlers) as "a mapping object with
the headers of the error", the implementation that is located in
`URLopener._open_generic_http()` will pass `response.msg` instead,
which is of type `http.client.HTTPMessage`.

* Use Message for the headers parameter of HTTPError

When the standard library constructs `HTTPError`, it will
pass an `http.client.HTTPMessage`, which is a subclass of
`email.message.Message`. Picking the superclass for the
annotations gives users the flexibility to for example
the result of the `email.message_from_X()` functions.

The only thing unique to `HTTPMessage` is the undocumented
`getallmatchingheaders()` method, which is only called by
`http.server.CGIHTTPRequestHandler.run_cgi()`. That class
gets its headers from `http.client.parse_headers()` and not
from `HTTPError`, so I think it's safe to use `Message`
as the annotation.
2021-08-06 10:55:49 +02:00
Unrud
2ee7b1346b Replace IO[str] with IO[bytes] in urllib.request (#5728) 2021-07-05 09:41:59 +02:00
Sebastian Rittau
f0bf6eebbd AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
2021-05-17 20:45:48 +02:00
Sebastian Rittau
e5abd08f93 Replace PathLike unions with aliases from _typeshed (#5467)
Standardize on 'from os import PathLike'
2021-05-16 21:38:00 +02:00
hatal175
b8e5f637b9 Stubtest fixes (#5391) 2021-05-13 18:20:55 -07:00
Mahmoud Harmouch
01ccf25d62 Add missing members for AbstractBasicAuthHandler class (#5379)
* Add missing members for AbstractBasicAuthHandler class

Signed-off-by: Harmouch101 <mahmoudddharmouchhh@gmail.com>

* Added missing functions to ftpwrapper

Signed-off-by: Harmouch101 <mahmoudddharmouchhh@gmail.com>
2021-05-09 11:18:24 +03:00
hatal175
2dc02ae8a9 Fix stubtest issues (#5360)
* Fix some stubtest issues

* Remove MADV_SOFT_OFFLINE
2021-05-07 19:10:03 +03:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00