Commit Graph
165 Commits
Author SHA1 Message Date
lazytypeandGitHub cfe69831e9 Include typing for Enum __order__ attribute (#3541)
Based on the behavior here: https://github.com/python/cpython/blob/0b41a922f95f62b620d5a197b9f2ed8e4bb70730/Lib/enum.py#L91
the `__order__` attribute should be treated the same as `_order_`
2020-02-21 21:40:33 -08:00
Michael J. SullivanandGitHub 7b630ca24a Add unquote_to_bytes to py2 six (#3744) 2020-02-19 23:42:57 +01:00
Benjamin PetersonandSebastian Rittau 2da1b2c426 gflags: Add is_parsed/IsParsed. (#3650) 2020-01-23 08:33:25 +01:00
Anthony SottileandJelle Zijlstra d0f57d7d38 Fill out more attributes in six (#3589) 2020-01-18 07:41:51 -08:00
Sebastian RittauandJelle Zijlstra fdeae5d00e Enable --disallow-subclassing-any (#3591)
Closes: #1446
2020-01-08 11:51:44 -08:00
Mickaël SchoentgenandSebastian Rittau b4d1da03aa Add missing Path.is_mount() introduced in Python 3.7 (#3566) 2020-01-05 16:04:52 +01:00
Jeppe Fihl-PearsonandJelle Zijlstra fed3472e7c Reflect Python 3.8 updates to the pathlib stdlib module (#3568) 2020-01-03 08:47:50 -08:00
Sebastian RittauandGitHub ec7960a8cb Convert namedtuples to class syntax (#3321) 2019-10-20 10:37:33 +02:00
Sebastian RittauandGitHub 0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00
Vasily ZakharovandJelle Zijlstra 57384ce033 Revised stubs for geoip2 third party library (#3317) 2019-10-09 19:28:42 -07:00
Sebastian RittauandJelle Zijlstra 07c8675ba5 Remove unused # type: ignore comments (#3325) 2019-10-09 10:27:18 -07:00
Sebastian RittauandJelle Zijlstra 0a426d8a8e Move cryptography from 2 to 2and3 (#3304)
The cryptography stubs are very rudimentary at the moment, but there
is nothing that limits them to just Python 2.

Closes: #3303
2019-10-04 14:11:42 -07:00
Benjamin PetersonandSebastian Rittau 9a1d205f34 cryptography: Return RSAPrivateKeyWithSerialization from generate_private_key. (#3296)
The only extant implementation of generate_private_key returns this more specialized interface.
2019-10-03 01:09:25 +02:00
Sebastian RittauandJelle Zijlstra c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Sebastian RittauandJelle Zijlstra ed4b1de0ad Fix third_party errors with --disallow-any-generics (#3278)
Part of #3267. Together with #3276 this should fix all such problems.
2019-09-30 13:14:01 +02:00
Philippe FandSebastian Rittau ce0dc8a23d Add proper support for __rtruediv__ on libpath.Path (#3236) 2019-09-17 23:24:42 +02:00
BouteillebleuandSebastian Rittau d5a918de7b Add stubs for CGIHTTPServer (#3196)
This commit adds:
* Stubs for CGIHTTPServer in the Python 2 standard library, as requested in #1147.
* Stubs for six.moves.CGIHTTPServer in Python 2, as requested in #22.
2019-08-19 15:34:29 +02:00
Rebecca ChenandJelle Zijlstra fab2ee0d7c Remove unnecessary quotes around forward references. (#3191) 2019-08-16 20:29:32 -07:00
Michael LeeandJelle Zijlstra b294782183 Make most contextmanager __exit__ signatures return Optional[bool] (#3179)
This pull request is a follow-up to https://github.com/python/mypy/issues/7214.

In short, within that mypy issue, we found it would be helpful to
determine between contextmanagers that can "swallow" exceptions vs ones
that can't. This helps prevent some false positive when using flags that
analyze control flow such as `--warn-unreachable`. To do this,
Jelle proposed assuming that only contextmanagers where the `__exit__`
returns `bool` are assumed to swallow exceptions.

This unfortunately required the following typeshed changes:

1. The typing.IO, threading.Lock, and concurrent.futures.Executor
   were all modified so `__exit__` returns `Optional[None]` instead
   of None -- along with all of their subclasses.

   I believe these three types are meant to be subclassed, so I felt
   picking the more general type was correct.

2. There were also a few concrete types (e.g. see socketserver,
   subprocess, ftplib...) that I modified to return `None` -- I checked
   the source code, and these all seem to return None (and don't appear
   to be meant to be subclassable).

3. contextlib.suppress was changed to return bool. I also double-checked
   the unittest modules and modified a subset of those contextmanagers,
   leaving ones like `_AssertRaisesContext` alone.
2019-08-16 16:13:33 -07:00
Benjamin PetersonandJelle Zijlstra 0dc3bf941a Improve type of tornado.testing.gen_test. (#3174)
gen_test can accept a timeout parameter. See https://www.tornadoweb.org/en/branch5.1/testing.html#tornado.testing.gen_test.
2019-08-10 13:08:59 -07:00
g.denisandSebastian Rittau 50f1988650 concurrent: add private classes and exceptions (#3169) 2019-08-07 10:39:15 +02:00
Francis ColasandSebastian Rittau 75d9228b02 PurePath methods accept os.PathLike[str] from 3.6 (#3099)
Closes #3095
2019-07-02 13:08:32 +02:00
crusaderkyandSebastian Rittau 9941616b9e Add mp_context parameter to concurrent.futures.ProcessPoolExecutor (#3078)
Closes #3076
2019-06-20 19:42:26 +02:00
Mathieu BridonandSebastian Rittau 6061ca404e Move Redis stubs to 2and3 (#3015)
They actually work for both Python 2 and 3, mostly because they aren't
really typed yet.
2019-05-29 15:45:46 +02:00
Jean HominalandSebastian Rittau 897148073a Add functions to six.moves.urllib.request (#2982)
parse_http_list and parse_keqv_list were added to six.moves.urllib.request
in version 1.11.
2019-05-13 10:29:34 +02:00
Rebecca ChenandGitHub a6d92eca10 Adjust indentation of TODOs in third_party/2/gflags.pyi. (#2964)
Having TODOs at a different level of indentation than
the surrounding lines trips up pytype.
2019-05-06 22:05:17 -04:00
Ethan MaddenandJelle Zijlstra 12fa5c4fdb Added defs for undocumented attrs on enums (#2941)
This should resolve #2934
2019-05-05 15:07:22 -04:00
Michael LeeandSebastian Rittau efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Josh MortonandSebastian Rittau d46d36b7d7 Add six.moves types for email_mime sources. (#2902)
As a followup to the work done in #2767 and #2830, and to address a
piece of #66, most of the email_mime submodules aren't typed in six
under python2, only python3. Now they are.
2019-04-08 19:56:29 +02:00
JinyuanShanghaiandSebastian Rittau 15e1f76f61 move pycurl.pyi from 2 to 2and3 (#2867) 2019-03-14 23:14:52 +01:00
秋葉andSebastian Rittau b588d43a32 Add sunder names to enum (#2822)
Closes #2766
2019-03-06 15:31:53 +01:00
Benjamin PetersonandJelle Zijlstra 6850b9d699 gflags: Add DEFINE_multi_enum. (#2783)
https://github.com/google/python-gflags/blob/4f06c3d0d6cbe9b1fb90ee9fb1c082b3bf9285f6/gflags/__init__.py#L800
2019-02-08 15:14:52 -08:00
Frazer McLeanandSebastian Rittau 9e5816a539 Fix six.raise_from value type (#2746)
Fixes #2742
2019-01-17 20:16:38 +01:00
Guido van RossumandJelle Zijlstra a2c0f4b827 Add stubs for six.ensure_{binary,str,text} functions (#2704) 2018-12-19 16:07:16 -08:00
jhanceandIvan Levkivskyi 5663dba895 [gflags] add known_only arg to __call__ (#2646) 2018-11-28 18:45:51 +00:00
Sebastian RittauandGitHub 82c59a7fc2 Merge Python 2 and 3 versions of itsdangerous (#2564) 2018-11-20 17:55:16 +01:00
Sebastian RittauandJelle Zijlstra cd75801aa5 Replace non-ellipsis default arguments (#2550) 2018-11-20 07:35:06 -08:00
Sebastian RittauandJelle Zijlstra e3a79d0ce6 Remove third_party/3/enum.py (#2563)
All Python 3 versions supported by typeshed (3.4+) have enum as part
of the standard library.

Make the third-party Python 2 version consistent with the Python 3 version.
2018-10-27 08:54:56 -07:00
Sebastian RittauandJelle Zijlstra 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
Michael LeeandSebastian Rittau 53d12c0a6c Makes enums accept objects in the argument type (#2539)
Fixes problems with using enums with the --disallow-any-expr flag.
2018-10-23 09:52:15 +02:00
Daniel LiandSebastian Rittau 254af0ff2a Add stub for pathlib2.Path.__div__ (#2507) 2018-10-16 07:31:58 +02:00
Benjamin PetersonandJelle Zijlstra b2a9f2e383 Add new gflags names. (#2489)
As a described in https://github.com/google/python-gflags/blob/master/absl_migration/migration_guidelines.md, gflags did a mass rename to PEP 8-style names.
2018-10-01 20:18:51 -07:00
Benjamin PetersonandJelle Zijlstra a8cfde79c4 Use structural inference for enum34 EnumMeta. (#2490)
Fixes python/mypy#5577.
2018-09-27 09:27:41 -07:00
Rebecca ChenandSebastian Rittau 77e4d5d5a8 Add six.moves.urllib_request and six.moves.urllib_response. (#2455) 2018-09-13 22:01:56 +02:00
Jelle ZijlstraandGitHub 2e1c81684e fix duplicate definitions in tornado (#2424)
Fixes #2423.

I followed https://github.com/tornadoweb/tornado/blob/master/tornado/httpclient.py and kept the `@property` where it exists in the implementation and the attribute where it doesn't.
2018-09-03 16:39:51 -07:00
Brandon LinandJelle Zijlstra 700efc43dd add missing stubs in cryptography rsa/serialization (#2376) 2018-08-15 20:50:56 -07:00
Ville SkyttäandJelle Zijlstra 5b2c8dc883 concurrent.futures: Sync with Python 3.7 (#2343) 2018-08-08 08:26:01 -07:00
Brandon LinandJelle Zijlstra 7c263e3935 add set_time to OpenSSL.crypto.X509Store (#2367) 2018-08-07 22:22:26 -07:00
Daniel LiandJelle Zijlstra 631d2768d6 Add stub for pathlib2 on Python 2.7 (#2351)
pathlib2 is the Python 2.7 backport of the pathlib module from Python 3.
Hence we use the same stub file for both.

The maintainer of pathlib2 granted permission for stubs to be added in
mcmtroffaes/pathlib2#44.
2018-08-07 10:27:18 -07:00
Yusuke MiyazakiandJelle Zijlstra 6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00