Commit Graph
100 Commits
Author SHA1 Message Date
Sebastian Rittau a615a17976 Update black and work around an isort bug (#4242) 2020-06-19 08:32:05 -07:00
Sebastian Rittau 32c638cc88 Run the unused stubtest check only on python/typeshed (#4240)
Without this check, it is run on daily on every personal fork.
2020-06-18 10:47:05 -07:00
Sebastian Rittau 68a7b9b178 Collate all stubtest runs into a single output (#4231) 2020-06-17 11:48:44 -07:00
Sebastian Rittau 51cf2f51b8 Add IO protocols to _typeshed (#4230) 2020-06-14 20:44:48 +02:00
Sebastian Rittau ef74bee249 Protocol naming guidelines (#4229)
Closes: #4174
2020-06-14 17:00:19 +02:00
Sebastian Rittau 89d3a55f1a Preparations for the Big Reformat (#4228)
A few comments between imports were removed or moved to the top of the
import block, due to behavioral differences between black and isort. See
psf/black#251 for details.

In two instances @overloads at the top of the file needed to be moved
due to psf/black#1490.
2020-06-14 07:58:26 -07:00
Sebastian Rittau 53431cab1d Remove unused stubtest entries (#4225)
Rename job
2020-06-12 06:57:23 -07:00
Sebastian Rittau cf3b74a0bf Move stubtest CI to GitHub Actions (#4223)
This ensures that the Python version used matches the one used in the
scheduled extraneous stubtest whitelist check.

See also PR #4206.
2020-06-11 12:39:06 -07:00
Sebastian Rittau afe1e543b3 Make multiprocessing.Namespace accept any attribute (#4204)
Update multiprocessing.dummy.Namespace as well

Closes: #4186
2020-06-09 12:34:36 -07:00
Sebastian Rittau 206bff44ed Remove BinaryIO.write() (#4203)
write() is inherited from IO[bytes], where it's defined as
`def write(self, s: AnyStr) -> int: ...`. If AnyStr is bytes,
this should accept bytes, bytearray, and memoryview, so the
overload is unnecessary.

Closes: #4201
2020-06-08 13:40:41 -07:00
Sebastian Rittau 3d84c52a4c Do not stop other checks if one check fails (#4205) 2020-06-08 07:25:52 -07:00
Sebastian Rittau 1f82564ee2 Move wsgiref.types to _typeshed.wsgi (#4175)
Re-export the types from wsgiref.types for now to avoid breaking
existing code. wsgiref.types should be removed eventually.

Also, reduce the boilerplate description in _typeshed/wsgi.pyi as it
mirrors the description in _typeshed/__init__.pyi.
2020-06-04 15:38:45 -07:00
Sebastian Rittau eea9be6e73 Add a _typeshed.pyi file and a PathLike alias (#4161) 2020-06-04 14:06:43 +02:00
Sebastian Rittau d76ad4710e Find unused stubtest whitelist entries (#4157)
* Find unused stubtest whitelist entries

This is currently a GitHub workflow that runs daily and lists all unused
whitelist entries found by running stubtest against current Python
versions on Linux and Windows. The workflow run will succeed if there
are no such entries, and fail otherwise.

In a second step, this should collate the output of the various runs and
create a PR to remove the entries. In that case, the workflow should
probably only run weekly or even monthly to keep the noise down.

Cf. #3728
2020-06-03 14:37:38 +02:00
Sebastian Rittau a913af9523 flake8: Enable F811 (#4158) 2020-06-02 14:08:54 -07:00
Sebastian Rittau b2b397c5ce Add @CraftSpider and @hauntsaninja as maintainers (#4138) 2020-05-28 16:34:45 -07:00
Sebastian Rittau adafaf1964 Add review guidlines (#4132)
Closes: #3448
2020-05-28 15:18:05 +02:00
Sebastian Rittau 694fa80596 Add dateparser module (#4106)
Based on PR 3704 by @xcthulhu (Matthew Doty)
2020-05-27 18:53:16 -07:00
Sebastian Rittau be016c6793 Add retry_after to TooManyRequests and ServiceUnavailable (#4059)
Added in werkzeug 1.0.0

While the implementation accepts any value for retry_after, the docstring
allows only datetime and int. Using any other value could lead to an
invalid HTTP response.
2020-05-23 13:39:48 -07:00
Sebastian Rittau 92f52a2615 flake8 updates and cleanups (#3940)
* flake8 updates and cleanups

* Update to flake8 3.7.9.
* Update to flake8-bugbear 20.1.4.
* Only ignore errors in stub files.
* Remove obsolete error counts.
* Sort error codes alphabetically.
* Don't ignore the following errors (unneeded):
    * E704 Multiple statements on one line (def)
    * W504 Line break occurred after a binary operator
    * B303 __metaclass__ used

* Remove obsolete comment

* Ignore F822 undefined name in __all__
2020-04-23 19:38:47 -07:00
Sebastian Rittau 733c558d60 Add msilib and _msi to stubtest whitelist (#3939)
* Add msilib and _msi to stubtest whitelist

* Group Windows-only modules

* Move win modules to bottom

Make win modules optional
2020-04-23 19:09:52 -07:00
Sebastian Rittau 68190cefde Fix stubs for pymysql (#3781) 2020-03-05 09:21:52 +01:00
Sebastian Rittau ca9505c8f4 Improve imaplib return types (#3670)
* Improve imaplib return types

Mark CommandResults as obsolete.

Also fix types of tagged_commands and untagged_responses.

Based on a discussion in #3655.

* Fix type of tagged_commands

* Fix IMAP4.tagged_commands type

* Mark CommandResults as private

* Fix
2020-02-22 09:58:14 -08:00
Sebastian Rittau c710696aed Remove obsolete stubtest whitelist entries (#3773) 2020-02-22 18:05:12 +01:00
Sebastian Rittau 0e3286bc43 Remove consent requirement for third-party stubs (#3643)
This was discussed a while ago on typing-sig. Consequently the
requirement of asking third-party maintainers for permission was
removed from PEP 484.
2020-01-23 15:01:30 +01:00
Sebastian Rittau fdeae5d00e Enable --disallow-subclassing-any (#3591)
Closes: #1446
2020-01-08 11:51:44 -08:00
Sebastian Rittau 885c2fd65e Fix example code (#3592) 2020-01-08 09:52:23 -08:00
Sebastian Rittau 595d02363a Change return type of Message.get_payload() to Any (#3504)
If, for example, is_multipart() is called before calling get_payload(),
it is guaranteed that a List[Message] is returned.
2019-11-26 08:03:15 -08:00
Sebastian Rittau c0d46a2035 Mostly undo #3372 (#3481)
readline callback must return str, not bytes.
2019-11-23 20:17:14 +01:00
Sebastian Rittau 107eaeb3d2 Add sys.addaudithook() and audit() (#3455) 2019-11-11 13:22:28 -08:00
Sebastian Rittau 66778639a5 Run CI tests against win32 and darwin platform (#3457)
Also use Python 3.8 as default Python version for tests
2019-11-11 07:52:11 -08:00
Sebastian Rittau d60b7ae26d New libs: Change permission requirement to notification (#3443)
This was discussed on the typing-sig mailing list and in
python/peps#1218, has met the approval of the steering council, and
was incorporated into PEP 484.
2019-11-07 07:35:35 -08:00
Sebastian Rittau 79d4e0dd08 Add assorted werkzeug type hints (#3444)
* Annotate is_immutable()
* Annotate ImmutableListMixin and make generic
* Make ImmutableList generic and derive from generic List
* Annotate Accept
* Annotate MIMEAccept
* Fix annotation of parse_accept_header()
2019-11-06 10:37:18 -08:00
Sebastian Rittau e4677d9ed4 Use async syntax instead of @coroutine (#3441) 2019-11-06 07:39:09 -08:00
Sebastian Rittau add0b5e930 Add functools.cached_property (#3439)
Part of #3319
2019-11-06 07:21:32 -08:00
Sebastian Rittau c8405bb5d9 Add importlib.metadata (Python >= 3.8) (#3346)
Part of #3319
2019-10-29 19:53:47 -07:00
Sebastian Rittau 5e9f66cb62 Add missing Python 3.7 and 3.8 annotations (#3399)
* Add explicit ssl_handshake_timeout arguments to open_connection and start_server

* Add context arguments to call methods

* Accept PathLike for create_unix_* paths

* Add TimerHandle.when()

Add missing version check

* AbstractServer is now an async context manager

* Add happy_eyeballs_delay and interleave arguments to create_connection

* Re-export asyncio.windows_events from asyncio

* Add name argument to Task constructor

* Add Task.get_coro()

* import and other fixes

* Fix return type of get_coro()
2019-10-29 19:49:37 -07:00
Sebastian Rittau 4770059894 Add missing ZipFile constructor arguments (#3414)
Closes: #3413
2019-10-29 19:46:31 -07:00
Sebastian Rittau 87d7dd3d95 Fix annotations with literal values (#3411) 2019-10-28 06:59:28 -07:00
Sebastian Rittau ec7960a8cb Convert namedtuples to class syntax (#3321) 2019-10-20 10:37:33 +02:00
Sebastian Rittau 299d89ab76 generate_tokens(readline) must return bytes (#3372) 2019-10-16 08:55:23 -07:00
Sebastian Rittau b969ead0ce Reorder memoryview.__setitem__ overloads (#3365)
Necessary for python/mypy#7717
2019-10-15 14:14:48 +02:00
Sebastian Rittau 6b55f5c498 Clean up multiprocessing + shared_memory (#3351)
* Make multiprocessing stubs match implementation

* Add multiprocessing.process.BaseProcess
* Use BaseProcess in multiprocessing.context where applicable
* Remove non-existing BaseContext.Process()
* Derive DefaultContext from BaseContext
* Fix BaseContext/DefaultContext.set_start_method() signatures
* Re-export multiprocessing.context.Process from multiprocessing,
  instead of using a custom definition
* Re-export multiprocessing.active_from from multiprocessing.process
  instead of using a custom definition

* Add parent_process() (Python 3.8)

* Complete BaseManager; add Server

* Add multiprocessing.shared_memory et al
2019-10-14 09:54:45 +02:00
Sebastian Rittau 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
Sebastian Rittau 6507875f28 Annotate Python 3.8 removals (#3359)
* macpath
* time.clock()
* Some cgi functions
* XMLParser(html) and doctype()
* unicode_internal
* Two sqlite3 classes hidden
* fileinput bufsize arg
* Treeview.selection no longer takes arguments
2019-10-14 09:51:39 +02:00
Sebastian Rittau 950f391704 Remove unnecessary __all__ annotations (#3357) 2019-10-13 16:22:03 -07:00
Sebastian Rittau de26a3d109 Remove raise statements from function bodies (#3355)
While it may eventually be useful to mark the exceptions that can be
raised from a function or method, the semantics are currently undefined
and unclear.
2019-10-13 21:51:43 +02:00
Sebastian Rittau 62bbdf856c Add several Python 3.8 annotations (#3347) 2019-10-12 19:36:56 +02:00
Sebastian Rittau 583784d94c Add missing exception to smtplib (#3348)
Improve a few other types
2019-10-12 19:15:44 +02:00
Sebastian Rittau 61d5f76a1d find_loader() can return None (#3341) 2019-10-11 10:48:48 -07:00
Sebastian Rittau d41bcd39e1 Add assorted annotations (#3335)
* Add assorted annotations

* Fix type of Purpose items
2019-10-10 20:51:49 -07:00
Sebastian Rittau 8a7d61741d Python3.8 additions and changes (#3337)
* Add as_integer_ratio() to a few types

* Add dirs_exist_ok to copytree()

* int, float, complex accept __index__ args

Also fix complex.__init__ argument names

* Add __reversed__ to dict et al.

* Python 3.8 date(time) arithmetic fixes

* Add CodeType.replace()
2019-10-10 20:51:27 -07:00
Sebastian Rittau 07c8675ba5 Remove unused # type: ignore comments (#3325) 2019-10-09 10:27:18 -07:00
Sebastian Rittau d82d3396e7 Minor flake8 improvements (#3324)
* Update flake8-bugbear
* Remove unnecessary comment
* Add a comment about an upcoming fix
2019-10-08 17:42:36 +02:00
Sebastian Rittau 256b3ce8ab Remove a bunch of unused imports (#3323) 2019-10-08 07:59:32 -07:00
Sebastian Rittau 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
Sebastian Rittau c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Sebastian Rittau 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
Sebastian Rittau 23232c056c Simplify Travis-CI configuration (#3220)
This removes the indirection of setting environment variables to
install and run tests. Also, use an explicit version for running
mypy with typed-ast.
2019-09-30 11:46:12 +02:00
Sebastian Rittau c9f19b1d72 Use protocol for FTP.stor* (#3227)
* Use protocol for FTP.stor*

* Reformat ftplib.pyi with black
2019-09-10 14:40:10 -07:00
Sebastian Rittau efb4af0108 Mark some types as non-hashable (#3219)
Based on @JelleZijlstra's PR #2221.

Fixes #2148
2019-09-04 17:38:09 +02:00
Sebastian Rittau ae881faaf1 Remove custom _Text type (#3211)
* Remove custom _Text type

Since the custom type was only used in argument types, it was
effectively only an alias for typing.Text.

* Run requests/api.pyi through black
2019-08-29 08:51:59 -07:00
Sebastian Rittau 628eee29f7 Use Literal in a few more places (#3176) 2019-08-10 13:08:18 -07:00
Sebastian Rittau c579f91077 Improve werkzeug exceptions slightly (#3178)
* Use Text for HTTPException.description
* Add Unauthorized.www_authenticate
* Remove wrong get_headers() overrides
2019-08-09 20:05:56 +02:00
Sebastian Rittau 3f6cec9872 Fix Match.group problems (#3172)
* group() may return None values
* group() allows to mix int and str arguments
* Use concrete return type
* Merge overloads
2019-08-08 16:59:20 +02:00
Sebastian Rittau 9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Sebastian Rittau b20e5b6c14 Travis: run mypy with Python 3.8 as well (#3146)
This runs mypy both with Python 3.7 and 3.8. In Python 3.8,
mypy switched from using typed-ast to using Python's built-in ast.
This patch ensures that both are tested.
2019-07-25 07:43:52 -07:00
Sebastian Rittau 0177dedc42 Add werkzeug.middleware (#3103)
HTTPConnection.timeout can be a float
2019-07-24 08:51:55 -07:00
Sebastian Rittau dad16f2d43 Update socket exceptions (#3127)
* error is an alias for OSError in Python 3
* herror and gaierror can be constructed without arguments (tested
  in Python 2.7 and 3.7)
* timeout uses the same arguments as herror and gaierror
2019-07-18 16:50:28 -07:00
Sebastian Rittau 09d1055cd3 Remove mypy new analyzer tests (#3128)
Now that the new analyzer is the default, this does exactly the same
as the normal mypy self test.
2019-07-18 17:02:12 +02:00
Sebastian Rittau 1436cfdef9 Add types to FileStorage (#3067) 2019-07-04 12:58:51 -07:00
Sebastian Rittau b9101e9c5e Add a few Redis types (#3016)
* StrictRedis is an alias for Redis in current redis

* Add a few types

* Add missing import

* Add missing argument and types
2019-06-12 09:18:48 -07:00
Sebastian Rittau 0e5b3770f8 Add a "pull requests welcome" batch (#3033)
We get quite a few bug reports where after a maintainer writes
"Pull Requests Welcome" we get a PR by the submitter. Maybe this
badge will help a bit to encourage people directly submit PRs,
reducing maintainer workload.
2019-06-05 07:51:01 -07:00
Sebastian Rittau 260369e6e7 Use typing.Text for argument types (#3000)
Also, use just str for argument types in Python 3+ branches.
2019-05-21 19:53:47 -07:00
Sebastian Rittau bd10d8aad4 Add @typing.type_check_only (#2679)
Cf. python/typing#597
2019-04-12 15:32:22 -07:00
Sebastian Rittau 26fefcc704 Use protocol for print() file argument (#2848)
Also, use object instead of Any for values list
2019-03-12 19:26:32 -07:00
Sebastian Rittau 6f00053511 Add stubs for bleach (#2709)
* Add stubs for bleach

* Support Python 2 for bleach

* Add missing imports
2019-03-10 21:08:46 -07:00
Sebastian Rittau 0989d9507e Fix groupby with key=None (#2794)
Cf #2790
2019-02-13 08:45:24 -08:00
Sebastian Rittau eb1788ac39 Merge Python 2 and 3 builtins.pyi (#2533) 2018-12-21 07:12:41 -08:00
Sebastian Rittau 53d8756214 Guidelines for incomplete stubs (#2661)
* Remove the guideline to use any for preliminary stubs

Closes #2648
2018-12-04 19:20:13 +01:00
Sebastian Rittau 4fb22f61e4 Reference black, split long functions (#2651)
Closes #2598
2018-12-01 22:45:10 +01:00
Sebastian Rittau ece96777a7 Re-export pyexpat instead of using check_consistency (#2649) 2018-11-29 07:29:59 -08:00
Sebastian Rittau 517d2b6012 Remove unneeded ignores (#2624) 2018-11-23 09:51:44 -08:00
Sebastian Rittau 8c8dc5658f sudo is not required anymore (#2618) 2018-11-22 22:17:20 -08:00
Sebastian Rittau 36671663cc Accept upstream stubs when receiving no response (#2608)
Also, don't explicitly ask for people to ask for missing packages.

Closes #2573
2018-11-20 17:59:46 +01:00
Sebastian Rittau 82c59a7fc2 Merge Python 2 and 3 versions of itsdangerous (#2564) 2018-11-20 17:55:16 +01:00
Sebastian Rittau cd75801aa5 Replace non-ellipsis default arguments (#2550) 2018-11-20 07:35:06 -08:00
Sebastian Rittau b77da551d9 Remove label descriptions from CONTRIBUTING (#2572)
Closes #2562
2018-10-31 09:22:52 -07:00
Sebastian Rittau 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 Rittau 0730fe5fcb Fix return of patch() and patch.multiple() (#2520)
* Fix return of patch() and patch.multiple()

* Update third party mock as well
2018-10-25 20:55:11 -07: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 680d69bd81 Update to flake8 3.6.0 (#2547)
* Update to flake8 3.6.0

* Configure line length and move to 'nice to have'

* Also update flake8-bugbear and pin flake8-pyi
2018-10-24 05:53:33 -07:00
Sebastian Rittau c4f4c40601 Annotate jwt.algorithms (#2532)
Cf. #1446
2018-10-23 09:32:14 -07:00
Sebastian Rittau 6d6894e1ef Annotate werkzeug wrap_file() and FileWrapper (#2519)
* Add FileWrapper protocol to wsgiref.types

* Annotate werkzeug's wrap_file and FileWrapper

* Remove empty line at end of file

* Fix _Readable protocols
2018-10-23 13:43:53 +02:00
Sebastian Rittau 48fc8d6d82 Rework .travis.yml and run with Python 3.7 where possible (#2536) 2018-10-23 13:19:25 +02:00
Sebastian Rittau f07bdf418b Fix pytype test output (#2534) 2018-10-22 09:14:22 +02:00
Sebastian Rittau 2d3edbd348 Slightly improve annotation of tkinter.Tk (#2498)
Closes: #1767
2018-10-01 20:15:22 -07:00
Sebastian Rittau 7be20fcf91 Return Any, not Union from IP parsing functions (#2499)
Closes: #2080
2018-10-01 08:48:39 -07:00
Sebastian Rittau 9f98737119 weakproxy fixes (#2450)
* The callback argument to ref() and proxy() is optional, per documentation
* proxy() returns a ProxyType or CallableProxyType

Closes #1627
2018-09-25 20:23:02 -07:00
Sebastian Rittau ea2122741f os.path.exists (Py 3) accepts a file descriptor (#2451)
Closes #1653
2018-09-24 07:53:44 -07:00