Commit Graph
432 Commits
Author SHA1 Message Date
Sebastian RittauandJelle Zijlstra 517d2b6012 Remove unneeded ignores (#2624) 2018-11-23 09:51:44 -08:00
Maxim KurnikovandSebastian Rittau 5ae8fbaa61 add __setattr__ to optparse.Values (#2622) 2018-11-22 20:37:51 +01:00
Maxim KurnikovandSebastian Rittau 59040f08a6 Add some distutils.dist.Distribution attrs (#2620) 2018-11-22 11:24:47 +01:00
Keith GrayandSebastian Rittau f9f4e50004 Added logging port constants to logging.handlers stub (#2617)
Closes #2616
2018-11-21 18:08:34 +01:00
dgelessusandJelle Zijlstra 45d4e88175 Let ctypes._CData.from_buffer[_copy] accept any buffer object (#2610)
Fixes the issue discussed here:
https://github.com/python/typeshed/pull/1906#discussion_r234798828
2018-11-20 07:43:21 -08:00
Sebastian RittauandJelle Zijlstra cd75801aa5 Replace non-ellipsis default arguments (#2550) 2018-11-20 07:35:06 -08:00
Diego Elio PettenòandSebastian Rittau e5b15b8eda Allow array[int] as a valid input to struct.unpack(). (#2586)
There does not seem to be an easy way to express that the array needs to be of a 1-byte type ('b', 'B', or 'c' in Python 2 only), so it is a bit more permissive than it should be.
2018-11-19 09:44:13 +01:00
dgelessusandSebastian Rittau 232b7c5147 Fix two small issues in ctypes.Array stubs (#2599)
* Allow only _CData subclasses as ctypes.Array elements

* Change type of ctypes.Array.raw and .value to Any (Closes #2111)

.raw and .value don't exist on all arrays. On c_char arrays, both exist
and have type bytes; on c_wchar arrays, only .value exists and has
type Text; on all other arrays neither one exists.

This is impossible to describe properly in a stub, so marking .value as
Any is the best that can be done.
2018-11-16 17:21:32 +01:00
Diego Elio PettenòandSebastian Rittau 0ebba82bfc Simplify base64 input and output parameters. (#2587)
This allows passing bytearray() objects to the base64 encode and decode functions, on both Python 2.7 and 3.4.

This also simplifies the code by ignoring 3.2 and 3.3, which are out of scope.
2018-11-06 19:24:16 +01:00
Opal SymesandSebastian Rittau 113eda289f Add context manager to tarfile.TarFile (#2579) 2018-11-02 14:29:37 +01:00
Joey WilhelmandSebastian Rittau 292cbf1a35 Correct the param type for mapPriority (#2578)
Closes #2577
2018-11-01 23:55:01 +01:00
PRAJWAL MandSebastian Rittau 60000d0898 correct parse_args namespace attribute (#2566)
Closes #2366
2018-10-28 18:48:34 +01:00
PRAJWAL MandSebastian Rittau 9ee458226c Remove version guard (#2565)
isAlive() is still present in threading.py in python 2.7, 3.4, 3.5, 3.6, 3.7.

Closes #2552
2018-10-28 00:21:47 +02:00
PRAJWAL MandSebastian Rittau c0d181605e Make backlog parameter optional in listen method (#2553) 2018-10-25 18:14:39 +02:00
PRAJWAL MandSebastian Rittau b33738e042 Add is_dir method to ZipInfo class (#2554) 2018-10-25 17:55:39 +02: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
Sebastian RittauandJelle Zijlstra 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
David ZbarskyandGuido van Rossum 167f72dbac Fix typo in mmap const (#2537) 2018-10-22 20:02:05 -07:00
Rebecca ChenandSebastian Rittau ea0a0fd17e Fix _StrType in difflib in Python 2. (#2514)
difflib functions accept unicode as well.
2018-10-12 14:39:24 +02:00
Siva ChandraandRebecca Chen 1b37ca4297 Make csv.reader take Iterator[Text] argument instead of Iterator[str]. (#2508) 2018-10-05 13:10:41 -07:00
Manuel Vázquez AcostaandJelle Zijlstra 1297caa27b Make 'datetime' a subclass of 'date'. (#2488)
Fixes #2487.
2018-10-01 20:19:02 -07:00
Jan TeskeandJelle Zijlstra 94a1b09d1d Support PathLike arguments in the logging module. (#2500)
Since Python 3.6 logging.FileHandler's filename argument can be a
PathLike object. Same for FileHandler's subclasses.
logging.basicConfig passes its filename argument to a FileHandler, so
this can be a PathLike object too.
Finally, logging.config.fileConfig passes its fname argument to
ConfigParser.read, which also takes a PathLike since version 3.6.1.
2018-10-01 20:13:37 -07:00
Adam DangoorandSebastian Rittau 45a11b974e Update parse_multipart return type to support Python 3.7 (#2474)
* Add encoding and errors parameters to cgi.parse_multipart stub.
2018-09-27 22:19:02 +02:00
Michael R. CrusoeandSebastian Rittau 3af4ff9f94 PY2: UUID accepts both unicode and str (#2478) 2018-09-26 13:31:04 +02:00
Rebecca ChenandJelle Zijlstra 9fda6b20ec Make the signature of optparse.OptionParser.parse_args more precise. (#2464) 2018-09-25 21:15:10 -07:00
Siva ChandraandJelle Zijlstra f73d060042 Use Text under Python 2 in shutil.pyi. (#2471) 2018-09-25 20:25:04 -07:00
Sebastian RittauandJelle Zijlstra 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
Michael R. CrusoeandJelle Zijlstra 2e0af18dda slices of MutableSequences are also MutableSequences (#2428) 2018-09-25 13:06:59 -07:00
Nathaniel ManistaandJelle Zijlstra cca6ee43e6 Fix traceback.FrameSummary's "line" parameter (#2470)
traceback.FrameSummary's "line" parameter is a string that is the text
of a line of code, not an int that is the line number of a line of
code.
2018-09-21 16:58:25 -07:00
Emil HessmanandSebastian Rittau d70a6cbcc0 Add missing instance attributes to logging.LoggerAdapter (#2462) 2018-09-18 20:23:04 +02:00
Rebecca ChenandSebastian Rittau 7dbc8748dc Add __iter__ method to codecs.StreamReader. (#2463) 2018-09-18 13:46:16 +02:00
Matthew ChristopherandSebastian Rittau 110ebf4bfe Add exc_text to LogRecord (#2461) 2018-09-18 13:39:05 +02:00
Matt RobinsonandSebastian Rittau c1eb946324 Add name attribute to logging.Handler (#2459)
* Add name attribute to logging.Handler
* Replace some older type comments with variable annotations around the addition line.
2018-09-17 19:36:49 +02:00
Christian HaudumandSebastian Rittau daae0c7980 Allow any keyword argument in argparse add_argument() method (#2460)
Closes #2457
2018-09-15 22:05:15 +02:00
Rebecca ChenandSebastian Rittau 9e72a7fd0c Fix the return type of decimal.Decimal.__new__. (#2458) 2018-09-15 18:12:52 +02:00
kitsuyuiandJelle Zijlstra 5cda4224fe Add type hint for fold arguments to datetime.datetime and datetime.time when Python >= 3.6 (#2449)
`datetime.datetime()` and `datetime.time()` have started to support fold arguments from 3.6.

- https://www.python.org/dev/peps/pep-0495/
- https://docs.python.org/3.5/library/datetime.html#datetime.datetime
- https://docs.python.org/3.6/library/datetime.html#datetime.datetime
- https://docs.python.org/3.5/library/datetime.html#datetime.time
- https://docs.python.org/3.6/library/datetime.html#datetime.time
2018-09-11 18:30:29 -07:00
Martin DeMelloandJelle Zijlstra 19708fac61 add __enter__, __exit__ and __getattr__ to streamreader/writer (#2411) 2018-09-04 13:38:18 -07:00
Emil HessmanandSebastian Rittau 50b5650a11 Add stub for datetime.time.fromisoformat introduced in 3.7 (#2426) 2018-09-04 16:35:56 +02:00
Siva ChandraandJelle Zijlstra 01abd34327 Use class with __call__ method instead of callable. (#2418)
This will enable checking positional and keyword parameters.
2018-09-03 09:50:01 -07:00
Anthony SottileandJelle Zijlstra c3cf369c6f Document required= argument for add_subparsers in py37+ (#2416) 2018-08-23 19:39:34 -07:00
Ran BenitaandJelle Zijlstra 8ab951c371 profile.run(sort=...) can be a string (#2413)
The int form is only accepted for backward compatibility.
https://docs.python.org/3/library/profile.html#pstats.Stats.sort_stats
2018-08-22 07:48:18 -07:00
Philipp HahnandJelle Zijlstra df516fab59 Some optparse improvements (#2290)
* optparse.Option.dest is a string

* optparse.OptionParser.epilog is a string

* optparse.OptionParser.prog is string

* optparse.OptionParser.values is Values

Shuffle code to resolve forward reference

* optparse.OptionParser.*option_list is a list of Options

* optparse.OptionParser.parse_args returns 2-tuple

<https://docs.python.org/2/library/optparse.html#parsing-arguments>

* minor improvements to Values
2018-08-21 21:51:30 -07:00
Sebastian RittauandJelle Zijlstra b209a649a0 Add date.fromisoformat() (#2393) 2018-08-17 08:50:10 -07:00
Sebastian RittauandJelle Zijlstra 25ac4d6af4 Implement StartResponse using a protocol (#2392)
* Add ExcInfo and OptExcInfo type aliases

* Implement StartResponse using a protocol

* Mark stub-only types with an underscore

* Remove wrong TODO note

python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
2018-08-17 08:36:00 -07:00
Sebastian RittauandJelle Zijlstra f25c9548ed Replace StartResponse arguments with ... (#2379)
StartResponse callbacks are required to accept and optional third argument.
Currently, there is no good way to describe this using type hints.
Previously, a Union was used, but that causes mypy to complain about any call
of start_response().
2018-08-15 10:41:39 -07:00
David ZbarskyandJelle Zijlstra 099081016e Add more mmap constants (#2386) 2018-08-15 10:39:47 -07:00
Yusuke MiyazakiandJelle Zijlstra 29522f87c3 Allow sqlite3.connect to take PathLike object on Python 3.7+ (#2380) 2018-08-11 22:49:49 -07:00
Ivan LevkivskyiandJelle Zijlstra 126b3e17fd Revert #2347 (#2377) 2018-08-09 13:22:12 -07:00
Ville SkyttäandJelle Zijlstra 066d8becf9 socket.create_connection source_address can be bytes or bytearray too (#2370)
* socket.create_connection source_address can be bytes or bytearray too

* Sync applicable socket.create_connection changes to socket.getaddrinfo
2018-08-09 10:02:34 -07:00
Ville SkyttäandJelle Zijlstra 850d16a668 socket.recv* return type improvements (#2363) 2018-08-09 08:07:17 -07:00