Commit Graph

447 Commits

Author SHA1 Message Date
Sebastian Rittau
eb1788ac39 Merge Python 2 and 3 builtins.pyi (#2533) 2018-12-21 07:12:41 -08:00
Ville Skyttä
9b5976e15b socket: Some more address typing (#2695) 2018-12-20 19:45:29 -08:00
Daniel Mouritzen
fb8b77e715 Set correct type for _subparsersaction.choices (#2702)
choices=_name_parser_map, see a11d44056e/Lib/argparse.py (L1097)
2018-12-20 19:44:30 -08:00
Kai Willadsen
4d85e5365f Add missing ENOTSUP alias to errno (#2692) 2018-12-17 17:46:32 +01:00
Philipp Hahn
bf410fb9ef Logging (#2687)
* logging: Add logging.Logger().fatal()

fatal() is an alias for critical(): It is just another name for the same
implementation.

* logging: Fix logging.Logger().warn()

warn() was an alias for warning(), but got deprecated with Python3.
In Python2 warn() is just another name for the same method.
In Python3 they have their own implementations, which adds a deprecation
warning before calling the new function.

PS: LoggerAdapter in Python2 never has the warn() method, but Python3
still implements the deprecation wrapper function.
2018-12-17 15:39:01 +01:00
Dave Halter
5c69373890 macpath, os/path, posixpath and ntpath should basically be the same files (#2637) 2018-12-17 15:02:18 +01:00
Brandt Bucher
0b49ce75b4 Add contextlib.nullcontext [Python 3.7]. (#2677)
Closes #2676
2018-12-08 02:55:47 +01:00
Utkarsh Gupta
b3ced5b8c0 decimal.pyi: Add overload for Decimal.__round__() (#2674)
Fixes #2528
2018-12-07 10:00:24 +01:00
Sebastian Rittau
ece96777a7 Re-export pyexpat instead of using check_consistency (#2649) 2018-11-29 07:29:59 -08:00
Florian Bruhin
f2e842b2d9 Fix handling of logging args (#2635)
* Use _ArgsType for logging.makeRecord
* The "args" argument is passed to LogMessage, so passing a tuple in is fine as
well.
* Use Mapping rather than Dict, see https://bugs.python.org/issue21172
2018-11-29 12:56:01 +01:00
Utkarsh Gupta
388de0876b threading.pyi: Add currentThread for all versions (#2647)
Fixes https://github.com/python/typeshed/issues/2625
2018-11-28 18:52:27 -08:00
Guido van Rossum
f9ba5402f8 Improve overloads of parse_args() -- it never returns None (#2643)
Fixes #2641
2018-11-27 18:11:30 -08:00
Maarten ter Huurne
eaae246062 Change argument type for xml.etree.ElementTree.iselement() to object (#2642)
It should be possible to ask for every object whether it looks like
an element. If only Elements are accepted, this function would always
return True.

Fixes #2629
2018-11-28 02:34:27 +01:00
Joel Rosdahl
41d6a2791a Fix return type of datetime.datetime.dst (#2634)
Fixes #2633.
2018-11-26 14:35:23 +01:00
Maxim Kurnikov
172b384e23 zipfile.ZipInfo.__init__ is the same on 2/3 (#2628) 2018-11-23 18:46:57 -08:00
Sebastian Rittau
517d2b6012 Remove unneeded ignores (#2624) 2018-11-23 09:51:44 -08:00
Maxim Kurnikov
5ae8fbaa61 add __setattr__ to optparse.Values (#2622) 2018-11-22 20:37:51 +01:00
Maxim Kurnikov
59040f08a6 Add some distutils.dist.Distribution attrs (#2620) 2018-11-22 11:24:47 +01:00
Keith Gray
f9f4e50004 Added logging port constants to logging.handlers stub (#2617)
Closes #2616
2018-11-21 18:08:34 +01:00
dgelessus
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 Rittau
cd75801aa5 Replace non-ellipsis default arguments (#2550) 2018-11-20 07:35:06 -08:00
Diego Elio Pettenò
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
dgelessus
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ò
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 Symes
113eda289f Add context manager to tarfile.TarFile (#2579) 2018-11-02 14:29:37 +01:00
Joey Wilhelm
292cbf1a35 Correct the param type for mapPriority (#2578)
Closes #2577
2018-11-01 23:55:01 +01:00
PRAJWAL M
60000d0898 correct parse_args namespace attribute (#2566)
Closes #2366
2018-10-28 18:48:34 +01:00
PRAJWAL M
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 M
c0d181605e Make backlog parameter optional in listen method (#2553) 2018-10-25 18:14:39 +02:00
PRAJWAL M
b33738e042 Add is_dir method to ZipInfo class (#2554) 2018-10-25 17:55:39 +02: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
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 Zbarsky
167f72dbac Fix typo in mmap const (#2537) 2018-10-22 20:02:05 -07:00
Rebecca Chen
ea0a0fd17e Fix _StrType in difflib in Python 2. (#2514)
difflib functions accept unicode as well.
2018-10-12 14:39:24 +02:00
Siva Chandra
1b37ca4297 Make csv.reader take Iterator[Text] argument instead of Iterator[str]. (#2508) 2018-10-05 13:10:41 -07:00
Manuel Vázquez Acosta
1297caa27b Make 'datetime' a subclass of 'date'. (#2488)
Fixes #2487.
2018-10-01 20:19:02 -07:00
Jan Teske
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 Dangoor
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. Crusoe
3af4ff9f94 PY2: UUID accepts both unicode and str (#2478) 2018-09-26 13:31:04 +02:00
Rebecca Chen
9fda6b20ec Make the signature of optparse.OptionParser.parse_args more precise. (#2464) 2018-09-25 21:15:10 -07:00
Siva Chandra
f73d060042 Use Text under Python 2 in shutil.pyi. (#2471) 2018-09-25 20:25:04 -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
Michael R. Crusoe
2e0af18dda slices of MutableSequences are also MutableSequences (#2428) 2018-09-25 13:06:59 -07:00
Nathaniel Manista
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 Hessman
d70a6cbcc0 Add missing instance attributes to logging.LoggerAdapter (#2462) 2018-09-18 20:23:04 +02:00
Rebecca Chen
7dbc8748dc Add __iter__ method to codecs.StreamReader. (#2463) 2018-09-18 13:46:16 +02:00
Matthew Christopher
110ebf4bfe Add exc_text to LogRecord (#2461) 2018-09-18 13:39:05 +02:00
Matt Robinson
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 Haudum
daae0c7980 Allow any keyword argument in argparse add_argument() method (#2460)
Closes #2457
2018-09-15 22:05:15 +02:00
Rebecca Chen
9e72a7fd0c Fix the return type of decimal.Decimal.__new__. (#2458) 2018-09-15 18:12:52 +02:00