Commit Graph

40 Commits

Author SHA1 Message Date
Jelle Zijlstra d05a9d3d83 Improve enums (#3168)
I realized while working on srittau/type-stub-pep#64 that a
few things we do in existing enum definitions in typeshed are
problematic:

- Using "= ..." doesn't allow type checkers to correctly type the
  result of Enum.MEMBER.value. In fact, mypy at least infers
  .value to be "Ellipsis" if you do this.
- Properties on the enum values themselves, like HTTPStatus.phrase,
  should not be specified directly as attributes, because it makes
  type checkers think that the properties themselves are enum
  members.

I ended up doing a bit more cleanup to the signal module:
- Remove unnecessary ... initializers.
- Remove unnecessary _SIG = Signals alias.
- I don't have Windows to test, but the C code for _signal suggests
  that CTRL_C_EVENT and CTRL_BREAK events are not Signals, but just ints:
  https://github.com/python/cpython/blob/1dbd084f1f68d7293718b663df675cfbd0c65712/Modules/signalmodule.c#L1575
2019-08-05 08:08:57 -07:00
Sebastian Rittau 9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Sebastian Rittau 0177dedc42 Add werkzeug.middleware (#3103)
HTTPConnection.timeout can be a float
2019-07-24 08:51:55 -07:00
Sam Zhou 4af283e1ac Fix HTTPConnection.putrequest parameter names (#3101) 2019-07-03 08:52:59 +02:00
Florian Ludwig 2e10326b50 change http.cookies.Morsel to Dict[str, Any] (#3060)
Morsel does cast any value to string and therfor any is the correct
typehint. For some keys other types then strings are more
appropiate anyway, max-age can take an integer (unix time) and http-only
a boolean.

Closes #3059
2019-06-19 15:17:16 -07:00
Rebecca Chen e7184d6dfc Add undocumented but used method LWPCookieJar.as_lwp_str. (#3041)
The method is defined here:
https://github.com/python/cpython/blob/e36ed475ea429f7cc80a4d65f80b44686a74b246/Lib/http/cookiejar.py#L1864
2019-06-08 07:06:14 -07:00
Sushain Cherivirala 67b42aff6b Add initializer for http.cookiejar.Cookie (#2932) 2019-04-29 10:34:28 +02:00
Michael Lee efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Gregory P. Smith cd4572e43c Annotate some missing http client and urllib APIs. (#2582) 2018-11-12 21:54:57 +01:00
Sebastian Rittau 006a79220f Flake8 fixes (#2549)
* Fix over-indented continuation lines

* Fix under-indented continuation lines

* Fix whitespace around default operator problems

* Limit line lengths

* Fix inconsistent files
2018-10-24 07:20:53 -07:00
Sebastian Rittau 9827132d5b Fix return types in urllib.request (#2389)
* Tighten return types of URL handlers

* urlopen() etc. return a modified HTTPResponse

* Add missing methods to HTTPResponse
2018-09-18 16:45:09 -07:00
justinpawela 2a888416b2 Remove annotations from http.HTTPStatus enum members (#2314)
These type annotations are unnecessary and seem to confuse the type system.

* Remove annotation from PlistFormat enum members

Same rationale as python/typeshed#2314; same adverse effects observed.
2018-07-09 18:59:34 -07:00
Yusuke Miyazaki 6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00
Sebastian Rittau 95eff73ab2 Drop Python 3.3 support from several stubs (#2265)
* Drop Python 3.3 support from several stubs

* Revert wrong socketserver changes
2018-06-20 16:49:47 -07:00
Jelle Zijlstra 3032fbdff1 make http.client.HTTPResponse concrete in 3.4 (#2244)
Matches the implementation in https://github.com/python/cpython/blob/3.4/Lib/http/client.py#L308

The ignore works around python/mypy#5027 (commented further up in the 3.5 branch).

Part of #1476.
2018-06-17 17:29:02 +01:00
Jelle Zijlstra de86f15fa0 Make http.client.HTTPResponse a BinaryIO (#2218)
Fixes #2189.

The errors from mypy are a false positive (see python/mypy#5027).
2018-06-12 09:20:24 -07:00
Jelle Zijlstra 28f6c095d4 make http.cookies.{Base,Simple}Cookie instantiable (#2116)
Part of #1476.
2018-06-11 14:01:17 -07:00
Anthony Sottile 270fba2e4e Add headers attribute to HTTPResponse (#2190) 2018-06-05 08:11:12 -07:00
Jelle Zijlstra 37aba00fe8 fix using ZipFile as a ContextManager (#2043) 2018-04-12 12:29:22 -07:00
Jelle Zijlstra 43e6c3c435 add more minor 3.7 new features (#2000)
part of #1965
2018-03-28 21:28:27 -07:00
rchen152 f6b60cb3ea A couple fixes to the io stubs. (#1811)
1. The 'name' argument to FileIO.init can be either a string or an integer: https://docs.python.org/2/library/io.html#io.FileIO
2. An mmap.mmap object can be used in most places that a bytearray can: https://docs.python.org/3.5/library/mmap.html
2018-01-04 16:14:38 -08:00
Martin DeMello 817c270c32 Clean out the pytype blacklist (#1667) 2017-10-24 10:38:34 -07:00
Jelle Zijlstra 1515ed9f88 fix some abstract classes in third_party/ (#1486) 2017-07-19 20:27:22 +03:00
Matthias Kramm ac0b809bf5 tweak files to fix pytype parsing errors (#1325)
* Don't use "\" to join lines
2017-05-26 08:45:52 -07:00
Jelle Zijlstra fce4424c6e add http.client.error (#1355)
It's in __all__
2017-05-25 19:35:36 -07:00
Jelle Zijlstra 11350ed8cc Fix missing argument types in py3 stdlib (#995)
Still missing a few in _subprocess (a Windows-only private module) and decimal
(I gave up).
2017-03-14 11:43:42 -07:00
Jelle Zijlstra 47a19c761c fix typo in http.client (#985) 2017-03-12 19:33:47 -07:00
David Euresti da11ecf773 Add missing __init__ and isclosed to http.client.HTTPResponse 2017-02-22 20:18:15 -08:00
Sunghyun Hwang 28f3fde09f improve HTTPStatus type definition (#920) 2017-02-07 10:39:44 -08:00
Lukasz Langa c0c982ada5 Add missing Dict imports. 2016-12-21 01:15:26 -08:00
Lukasz Langa 5f416fae64 Add missing List imports. 2016-12-21 01:06:52 -08:00
Lukasz Langa 6b5c6626d6 Fixing flake8 E121, E122, E123, E124, E125, E126 errors 2016-12-19 23:53:19 -08:00
Evgeniy Vasilev 0e5003b61e Add HTTPStatus definition for python3.5+ (#577)
Fixes #576.
2016-09-29 13:09:30 -07:00
Valérian Rousset 6c6f5f19da apply conditionals (#417) 2016-07-29 05:59:26 -07:00
Guido van Rossum 39325bf159 Mypy now supports sys.platform and sys.version_info checks (#410) 2016-07-27 13:25:29 -07:00
Valérian Rousset e97638d4bd Improve http (#248) 2016-06-05 16:55:51 -07:00
Ben Darnell e2dde66eb1 Stubgen assorted stdlib modules 2016-04-11 00:27:58 -04:00
Matthias Kramm 94c9ce8fd0 Consistently use '= ...' for optional parameters. 2015-11-09 13:55:02 -08:00
Matthias Kramm 4fe8915d44 Add missing '-> None' to all __init__ methods. 2015-11-09 10:25:11 -08:00
Matthias Kramm 337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00