Commit Graph

295 Commits

Author SHA1 Message Date
Kenny Do
156927d2a2 tzinfo.tzname is optional (#1934) 2018-02-28 19:14:12 -08:00
rchen152
e1243d0103 Add missing attributes, fix some parameter types in argparse.Action. (#1907) 2018-02-28 11:20:04 -08:00
Roy Williams
a618ee30d4 Fix instantiating a xml.etree.ElementTree.Element (#1930)
The methods removed by https://github.com/python/typeshed/pull/1816
are abstract in `MutableSequence` and therefore must be specified on `Element`.
2018-02-27 14:59:11 -08:00
Sebastian Rittau
38aea73b4b Merge Python 2 and 3 versions of time.pyi (#1909)
* Use variable annotations
* Replace default values by ellipses
* Remove exceptions from function bodies
* Remove superfluous comments
* Remove superfluous newlines
* Use Optional instead of Union[..., None]
* Replace Union[int, float] by just float

* Make time.pyi (Python 2) more closely resemble the Python 3 stub

* Replace _TIME_TUPLE by TimeTuple
* Reorder imports

* time.pyi: Mark two arguments as optional, mark Unix-only function

* time.pyi (Python 2): Use TimeTuple in NamedTuple and reformat

This makes time.pyi more closely match the Python3 version.

* Merge Python 2 and 3 versions of time.pyi

* Only import SimpleNamespace on Python >= 3.3

* Remove default values from module properties

* Remove Optional from strftime() and asctime()

* accept2dyear was removed in Python 3.3

* Rename TimeTuple to _TimeTuple
2018-02-24 11:49:37 -08:00
Jason Fried
f5b3979b70 contextlib.pyi ExitStack.callback take Callable (#1908)
* contextlib.pyi ExitStack.callback take Callable

The documentation for ExitStack does not specify the return type of the callable's passed to callback.  
Saying that they always return None breaks a very common use case for ExitStack, which is to "schedule" changes to a collection 
while iterating it.  

```
with ExitStack() as stack:
    for key, value in adict.items():
        if ...:
            stack.callback(adict.pop, key)
```

I also added AsyncExitStack, using Awaitable.

* Moving to Explicit Any in Generics
2018-02-24 09:41:13 -08:00
Ethan Smith
f91c891ad4 Fix name collision in contextlib on 3.7 (#1915) 2018-02-24 09:25:47 -08:00
David Euresti
8ecb74012a Add __divmod__ to numeric types (#1900)
Helps with #1889
2018-02-18 16:59:12 -08:00
Mark Amery
0c2249fbd6 Add FileHandler properties (#1834)
Fixes #1833.
2018-02-16 17:21:30 -08:00
Ilya Kulakov
1e8b953182 Add stub for AsyncExitContext added by bpo-29302. (#1876)
* Add stub for AsyncExitContext added by bpo-29302.

* ExitStack's pop_all returns an instance of type(self).
2018-02-16 17:17:17 -08:00
Łukasz Langa
2e278f2aeb [stdlib/2and3/__future__] Add PEP 563 annotations (#1880) 2018-02-14 09:23:17 -08:00
Jelle Zijlstra
fe4bea39a2 fix return type of linecache.getlines (#1877)
Randomly noticed this looking at the stub. Here is the code: https://github.com/python/cpython/blob/3.7/Lib/linecache.py#L37.
2018-02-13 16:19:44 -08:00
Guido van Rossum
fa98de6d57 Accept Text in distutils *Version classes (#1854) 2018-02-05 10:50:04 -08:00
James M. Allen
33039f913e Adding py36 additions to datetime module (#1848) 2018-01-31 16:22:25 -08:00
Michael Lee
1e4c2a9031 Refine types for distutils.version (#1835)
Note: these type signatures were derived mainly by looking at the
docstrings inside distutils.version. For reference:

- py3 impl: https://github.com/python/cpython/blob/master/Lib/distutils/version.py
- py2 impl: https://github.com/python/cpython/blob/2.7/Lib/distutils/version.py
2018-01-23 14:29:22 -08:00
Sebastian Rittau
7073bc0a49 Cleanup and merge datetime.pyi (#1805) 2018-01-09 22:06:31 +00:00
Elliott Beach
688f813457 fix subclassing ExitStack (#1810) 2018-01-08 06:02:30 -08:00
rchen152
db6e2a637b Fix some bugs in xml.etree.ElementTree.Element's container behavior. (#1816)
* Have Element inherit from MutableSequence, which is more precise than Sequence.
* Remove unnecessary inherited methods (e.g., __getitem__).
* Correct extend() to take an Iterable. (Sequence was too specific.)
* Alphabetize the typing imports, for sanity.
2018-01-04 19:04:46 -08:00
rchen152
af98a29823 Add __getslice__ to the Python 2 definition of mmap.mmap (#1812) 2018-01-04 16:16:00 -08:00
Daniel Bowtell
bb8b9bdaec codecs.iter(en|de)code fix return type (#1807)
codecs.iterencode and codecs.iterdecode should both return Generators rather than Iterators
2018-01-02 12:49:34 -08:00
Salvo 'LtWorf' Tomaselli
c8c4a8f208 Added filelist attribute to ZipFile (#1798) 2018-01-02 10:18:03 -08:00
Ashwini Chaudhary
c5439668fe Added stub for sre_compile(2and3) (#1493) 2017-12-14 20:52:54 -08:00
Semyon Proshev
a1e85be4c9 Add __int__ to uuid.UUID (#1783) 2017-12-13 08:20:47 -08:00
Neil Conway
46125886c0 argparse: Add annotations for instance variables. (#1763) 2017-12-12 15:10:31 -08:00
Neil Pilgrim
fc10a94db1 Distutils improvements to cmd.pyi and log.pyi (#1748)
* Add more functions to distutils.cmd.Command.

* Add detail to distutils.log, previously an empty file.
2017-11-27 15:47:04 -05:00
Tim Abbott
c1971fb443 imaplib: Fix annotation for search. (#1762)
* imaplib: Fix annotation for search.

https://docs.python.org/3/library/imaplib.html#imaplib.IMAP4.search
shows that IMAP4.search takes a number of str args, not a number of
List[str] args (I can see how one would be confused, though, because
of the *criteria).

* imaplib: Fix annotation for store.

While it's called "flag_list",
https://docs.python.org/3/library/imaplib.html#imaplib.IMAP4.store
clearly shows it's expecting a string with a list of flags in it, not
a Python list.
2017-11-25 13:23:57 -08:00
Ben Leslie
7806420105 Fix missing colon in StreamHandler.stream type annotation (#1753)
The missing colon in the variable type annotation means that the type of stream is currently incorrectly determined to be of type ellipsis, rather than IO[str].
2017-11-18 15:57:55 -08:00
Patrick Valsecchi
d62743d788 Make traceback.FrameSummary Iterable (#1741)
To make this code valid:
```python
import traceback
for filename, lineno, name, line in traceback.extract_stack(stack):
    pass
```
2017-11-13 07:05:16 -08:00
Jelle Zijlstra
83ca997140 Change more defaults to ... (#1729)
* codemod ': Any = None' ': Any = ...'
* codemod ': (Union|Optional)([^=]+)\s+=\s+-?\d+' ': \1\2 = ...'
* codemod ': (Union|Optional)([^=]+)\s*=\s*-?(None|False|True)' ': \1\2 = ...'
* codemod ': (int|float|bool)\s*=\s*-?\d+' ': \1 = ...'
* codemod ': (bool)\s*=\s*(False|True)' ': \1 = ...'
* codemod ': Any\s*=\s*(False|True|None)' ': Any = ...'
2017-11-13 06:56:24 -08:00
Jelle Zijlstra
0080017d02 fill out bz2 stub (#1728)
- add a default value to ...
- add some missing version checks
- add some missing arguments
2017-11-13 06:55:43 -08:00
FichteFoll
a44de46a00 use_builtin_types is optional for plistlib.load (#1738) 2017-11-11 16:54:11 -08:00
Jelle Zijlstra
97be335160 don't import enum in Python 2 (#1724)
* don't import enum in Python 2

Fixes a pytype issue from #1720.

* move enums together
2017-11-10 10:23:22 -08:00
Jelle Zijlstra
324f1761f4 Change more defaults to ... (#1727) 2017-11-09 10:32:17 -08:00
Josh Staiger
fd25e534ad Add default timeout for Condition.wait_for (#1726)
Fixes:

- Too few arguments for "wait_for" of "Condition"

when timeout is not specified.
2017-11-09 10:12:33 -08:00
Jelle Zijlstra
54dd6ba27c Change numerous default values to ... (#1722)
This is the convention, and some default values (e.g. strings) apparently
break pytype.
2017-11-09 06:28:40 -08:00
Kenny Do
26ea6c0740 pkgutils.walk_packages takes optional list of str for path (#1725) 2017-11-09 05:57:29 -08:00
Josh Staiger
8b367c770b Make pkgutil.get_data return Optional[bytes] (#1714)
As per the docs (and implementation):

- https://docs.python.org/3/library/pkgutil.html#pkgutil.get_data

If the package cannot be located or loaded ... then None is returned.
2017-11-05 14:00:51 -08:00
rchen152
85e75c9a6a Fix a parameter type in threading.Thread.__init__ (#1706) 2017-11-01 15:41:10 -07:00
Matěj Cepl
8ead136300 IMAPlib stub. (#1685)
Fixes #295.
2017-10-25 16:37:04 -07:00
hashstat
c366a1be55 Merge v2 and v3 array stubs (#1670)
See #1608
2017-10-25 09:46:25 -07:00
Sally
37f1bf54a5 Fix type of source for xml.sax.parse (#1666)
Fixes https://github.com/python/typeshed/issues/1655
2017-10-25 09:45:48 -07:00
marienz
c888bc8a1a Fix distutils.setup's cmdclass argument (#1682) 2017-10-22 15:47:31 -04:00
hashstat
0917560195 Add new methods to socket stubs. (#1638)
* Add new methods to socket stubs.

Also fix a couple of invalid types in recv*_into() socket methods.

* Add double-underscores to parameters for position-only arguments
2017-10-07 08:41:06 -07:00
hashstat
f48731ac7a Add stub for standard library crypt module (#1641) 2017-10-04 20:39:33 -07:00
hashstat
6661377597 Ensure AF_*, SOCK_*, AI_*, and MSG_* constants use enum types (#1637) 2017-10-04 08:55:36 -07:00
hashstat
fc74f53c5a Corrects timeout type annotations. (#1639)
Timeouts should be floats, but were ints for some reason.
2017-10-04 08:40:40 -07:00
hashstat
15f737d2a8 Corrects return type of warnings.formatwarning(). (#1640) 2017-10-04 08:37:08 -07:00
Gábor Bernát
f1a01b3017 [XML] iterparse is None for end-ns, Tuple[str, str] for start-ns, Element otherwise (#1520) 2017-10-04 08:24:27 -07:00
Ben Leslie
b8f7ba8e8a Corrections to logging.StreamHandler stubs (#1624) (#1625)
- Missing attribute `StreamHandler.stream`
- Missing attribute `StreamHandler.terminator`
- terminator is only available in 3.3+
2017-09-23 18:36:51 -04:00
Dominik Gabi
693509bff6 Change Union[float, None] to Optional in socket.pyi (#1602) 2017-09-13 13:23:54 -07:00
Robert T. McGibbon
f1a13cea9c Add __init__ and __contains__ to argparse.Namespace (#1578) 2017-08-27 14:14:01 -07:00