Commit Graph
1472 Commits
Author SHA1 Message Date
Sebastian SteenbuckandJelle Zijlstra 2551b76bde Replace default strings ' ' with ... (#1721)
This fixes a problem with pytype.
2017-11-08 08:49:54 -08:00
FichteFollandJelle Zijlstra f933b9384c Refine str.maketrans and str.translate (#1613)
str.translate requires a Mapping or Sequence (in essence, anything
with __getitem__), not a Dict.

str.maketrans in the one-argument form only converts character string
keys to their unicode ordinal, leaving any of the values untouched.
This mapping may use both integers or strings as keys at the same time.

str.maketrans in the multi-argument form returns a dict with any of the
values str, int or None, as recognized by str.translate.
2017-11-07 18:55:05 -08:00
Alex WillmerandJelle Zijlstra c7bc0bdb00 Add BaseException.__getitem__ & __getslice__ (#1719)
Refs python/mypy#4215
Fixes false positive

    error: Value of type Exception is not indexable
2017-11-07 12:57:51 -08:00
Sebastian SteenbuckandMatthias Kramm ef46c95c9e Add List to the typing imports and order the imports (#1717)
List is used but not imported. According to PEP-484 "Suggested syntax for Python 2.7 and straddling code" it should be imports. 

"Like other type comments, any names used in the annotations must be imported or defined by the module containing the annotation.".

Also order the typing import list, because it looks nicer.
2017-11-07 06:42:23 -08:00
Alan DuandJelle Zijlstra 275d9b5818 Python 3 multiprocesisng synchronization stubs (#1678)
* Add multiprocessing.Array to Python 3 stub

* Add Pipe and Connection type

* Add synchronize type-stub

* Add multiprocessing Exceptions

* Update context with synchronization primitives

* Code review comments

* Add acquire and release from _make_method

* Remove Array stub

* add missing Optional
2017-11-06 23:07:02 -08:00
Roy WilliamsandJelle Zijlstra f4e3657c57 Allow subprocess functions to accept PathLike objects in 3.6 and above (#1713)
* Allow subprocess functions to accept PathLike objects in 3.6 and above

* Split up _PATH from _TXT in subprocess
2017-11-06 10:28:08 -08:00
Josh StaigerandJelle Zijlstra 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
Josh StaigerandJelle Zijlstra bc2f88d6ee Make Executor.__enter__ self and return types match (#1711)
Specifically, this solves a problem in code such as:

with ThreadPoolExecutor() as p: ...

Where the p variable would be typed as an abstract `Executor`, rather than the specific `ThreadPoolExecutor` as expected.
2017-11-04 13:56:55 -07:00
anentropicandJelle Zijlstra 05f527c089 BaseException.__init__ accepts **kwargs (#1704) 2017-11-03 23:10:34 -07:00
Zac Hatfield DoddsandJelle Zijlstra 89cfa64577 Complete Py3 stub for sre_constants (#1709) 2017-11-03 22:48:10 -07:00
rchen152andMatthias Kramm 85e75c9a6a Fix a parameter type in threading.Thread.__init__ (#1706) 2017-11-01 15:41:10 -07:00
Sebastian RittauandJelle Zijlstra 87ef6b8d53 Add stub for unittest.mock.patch.multiple() (#1686)
* Add stub for unittest.mock.patch.multiple()

* Use ... for default arguments in unittest.mock.patch() et al.

* Tighten type of create argument to patch() et al.
2017-10-26 00:57:56 -04:00
Matěj CeplandGuido van Rossum 8ead136300 IMAPlib stub. (#1685)
Fixes #295.
2017-10-25 16:37:04 -07:00
Matthew WrightandJelle Zijlstra 0b721b7af5 Update type of "throw" method of generators to reflect that it can return a value (#1672) 2017-10-25 16:54:18 -04:00
hashstatandMatthias Kramm c366a1be55 Merge v2 and v3 array stubs (#1670)
See #1608
2017-10-25 09:46:25 -07:00
SallyandMatthias Kramm 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
Martin DeMelloandMatthias Kramm 817c270c32 Clean out the pytype blacklist (#1667) 2017-10-24 10:38:34 -07:00
Carl MeyerandJelle Zijlstra 9e76d44b09 Fix sys.setprofile annotation. (#1679)
`sys.setprofile(None)` is valid, and is in fact the only way to clear a profiler once set.
2017-10-23 15:26:58 -04:00
marienzandJelle Zijlstra c888bc8a1a Fix distutils.setup's cmdclass argument (#1682) 2017-10-22 15:47:31 -04:00
hashstatandJelle Zijlstra 6accffca28 popen() is function, not method, so remove self argument (#1671) 2017-10-12 12:16:14 -07:00
Guido van RossumandMatthias Kramm 05ffb1f912 Make initial_indent and subsequent_indent AnyStr in wrap() and fill() (#1662)
Leave them alone in TextWrap.__init__(), since I don't want to make the whole class generic.
2017-10-10 15:11:48 -07:00
Guido van RossumandJelle Zijlstra 6d619e013c Add textwrap.dedent() to Py2 stubs (#1661) 2017-10-10 10:07:18 -07:00
FichteFollandJelle Zijlstra 8b6234ad2c Use self-type in asyncio.Future.*_done_callback (#1614) 2017-10-10 10:06:57 -07:00
hashstatandJelle Zijlstra d333474ed9 Update and add stubs for os module (#1645) 2017-10-09 21:02:10 -07:00
hashstatandJelle Zijlstra 0349f9becd Add additional type annotations to ipaddress stub (#1654)
Makes heavier use of generics to minimize code. Fixes some incorrect
types. Also reordered to allow easy comparison against class listings
and documentation.
2017-10-09 21:00:07 -07:00
hashstatandMatthias Kramm 29473745a8 Implement array.array as a MutableSequence (#1649)
It also improves the type checking of contained values. Some methods
were removed because they are implemented by a base class (i.e.,
*__iter__()*, *__str__()*, and *__contains__()*).  *__hash__()* was
removed because arrays are unhashable types.
2017-10-09 10:12:01 -07:00
Suren NihalaniandJelle Zijlstra 898299969c typeshed: declare that ordereddict's copy returns ordereddict (#1656) 2017-10-08 21:15:11 -07:00
Michael LeeandJelle Zijlstra 51829c1bc8 Update textwrap stubs (#1634)
This commit adds a few missing return types to the Python 3 textwrap
stubs and fleshes out the Python 2 textwrap stubs so they're on par with
the Python 3 version.

This change:

1.  Changes the order of the arguments in Python 2 and Python 3
    to match the order from the source code instead of the
    documentation.

2.  Adds other undocumented attributes besides whitespace_trans
    (for consistency).

3.  Moves the '*' argument in TextWrapper.__init__ for Python 3
    to match the source code.

4.  Made function stub formatting consistent with typeshed style
    conventions.
2017-10-08 21:12:19 -07:00
hashstatandJelle Zijlstra 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
Semyon ProshevandJelle Zijlstra bc91a22e4e Update datetime.timetuple and datetime.utctimetuple (Py3), and datetime.__init__ (Py2) (#1648)
* Update return type for datetime.timetuple and datetime.utctimetuple

* Fix microsecond parameter in datetime
2017-10-07 08:39:39 -07:00
hashstatandJelle Zijlstra 97b16a0b34 itertools.count() can take floats as well as ints (#1650) 2017-10-07 08:30:07 -07:00
Ashwini ChaudharyandMatthias Kramm c03e3a7ac0 Added stub for whichdb(py2) (#1508)
Added stub for whichdb(py2)
2017-10-06 19:04:18 -07:00
Travis ParkerandJelle Zijlstra 355f30cc70 Correct return type of sum() builtin (#1582)
`sum([])` always returns the integer 0.
2017-10-04 21:42:35 -07:00
Naman BharadwajandJelle Zijlstra 000041761e month, day parameters to datetime.datetime are required (#1633) 2017-10-04 21:38:09 -07:00
hashstatandJelle Zijlstra f48731ac7a Add stub for standard library crypt module (#1641) 2017-10-04 20:39:33 -07:00
hashstatandJelle Zijlstra 6661377597 Ensure AF_*, SOCK_*, AI_*, and MSG_* constants use enum types (#1637) 2017-10-04 08:55:36 -07:00
hashstatandJelle Zijlstra fc74f53c5a Corrects timeout type annotations. (#1639)
Timeouts should be floats, but were ints for some reason.
2017-10-04 08:40:40 -07:00
hashstatandJelle Zijlstra 15f737d2a8 Corrects return type of warnings.formatwarning(). (#1640) 2017-10-04 08:37:08 -07:00
Gábor BernátandJelle Zijlstra 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
Carl MeyerandJelle Zijlstra a19d4e34c3 Add 3-argument overload for asyncio.gather. (#1644) 2017-10-03 11:41:25 -07:00
Jelle ZijlstraandGuido van Rossum 78587dc895 Revert "make __class__ refer to the current object's class (#1549)" (#1632)
This reverts commit 1a164b630c.

Reverts python/typeshed#1549.

See Guido's comments in the original PR.
2017-09-29 11:37:54 -07:00
Jelle ZijlstraandMatthias Kramm 1a164b630c make __class__ refer to the current object's class (#1549)
Fixes python/mypy#3061
2017-09-27 18:11:59 -07:00
Martin DeMelloandMatthias Kramm d389ef3d85 Remove a few files from the pytype blacklist. (#1628)
Fixes the following issues:

* Literals rather than ... for default values
* None rather than ... for default value of typed variable
* Literals rather than ... # type for top level constants
* # Foo rather than # type: Foo
* return value of init not set to None
2017-09-27 07:57:13 -07:00
daidandMatthias Kramm d14272a14f Fix the typing for clock_settime (#1629)
clock_settime expects a float as parameter, and returns nothing.
2017-09-27 07:52:50 -07:00
Neil PilgrimandMatthias Kramm ffe2bee7a7 Fix email.utils parseaddr and formataddr to accept Optional[str] (#1626) 2017-09-26 14:10:35 -07:00
Ben LeslieandJelle Zijlstra 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
Luka SterbicandJelle Zijlstra 1f867d8ab8 Fix int(Union[str, int]) (#1551) 2017-09-23 09:59:15 -04:00
Pieter-Jan BriersandJelle Zijlstra d7533152f9 (3.6+) Adds re.RegexFlag and use it. (#1592)
* Make 3.6 functions take Union[int, RegexFlag] instead.
2017-09-23 08:58:31 -04:00
Øystein OlsenandJelle Zijlstra 6bfd43d6b6 Update utime stub (#1594)
times can be either a tuple of ints or floats
2017-09-23 08:57:38 -04:00
Bruce MerryandJelle Zijlstra 55dbb967ad Corrections to the asyncio exception stubs (#1623)
Fixes #1622:

- Missing attribute `LimitOverrunError.consumed`
- Missing attribute `IncompleteReadError.expected` and `.partial`
- `partial` argument to `IncompleteReadError` had incorrect type
- `expected` argument to `IncompleteReadError` missing `Optional`
2017-09-22 07:47:17 -07:00