Commit Graph

2085 Commits

Author SHA1 Message Date
Semyon Proshev
ac70fdc614 Overloads for map (#1990) 2018-03-27 10:05:59 -07:00
Semyon Proshev
8ac7f68a86 Update return type for math.ceil in Python 2 (#1989) 2018-03-27 08:09:18 -07:00
Guido van Rossum
30791d4208 Give Python 2 sys.getprofile() and sys.gettrace() return types (Any). (#1988)
(In Python 3 their types are already correct.)
2018-03-26 18:37:04 -07:00
João Santos
afeecb478b RotatingFileHandler has a terminator property (#1952)
In python3 `RotatingFileHandler` is a subclass of `BaseRotatingHandler` which is a subclass of `FileHandler` which is a subclass of `StreamHandler` which as a `terminator` property but I'm getting a `"RotatingFileHandler" has no attribute "terminator"` error on my code.
2018-03-25 08:11:01 -07:00
Tuomas Suutari
4da20cb8b7 multiprocessing: Fix timeout args of AsyncResult methods (#1984)
The timeout argument of wait and get methods of AsyncResult accepts also
None so fix the type specification to include Optional.

Accepting None is not an implementation detail as it's clearly
documented too:

https://docs.python.org/2/library/multiprocessing.html#multiprocessing.pool.AsyncResult

https://docs.python.org/3/library/multiprocessing.html#multiprocessing.pool.AsyncResult
2018-03-24 08:15:39 -07:00
Michael J. Sullivan
eb571e9cbb Make protobuf's BaseContainer a MutableSequence (#1981) 2018-03-22 18:22:59 -07:00
David Euresti
097e9f5e71 Fix issue with attrib ordering. (#1980)
A call like this:

```
from attr import attrib
from attr.validators import optional, instance_of

c = attrib(default=None, validator=optional(instance_of(bytes)))
```

Was returning no return value, because the first overload was T -> T.
The solution was to change the ordering so that the first overload is
None -> T and infer the type from the other arguments.
2018-03-22 10:50:07 -07:00
Jelle Zijlstra
bbbffb5f4b implement some minor 3.7 features (#1966)
References:
- https://docs.python.org/dev/library/datetime.html#datetime.datetime.fromisoformat
- https://docs.python.org/dev/library/crypt.html#crypt.mksalt
- https://docs.python.org/dev/library/contextlib.html#contextlib.AbstractAsyncContextManager
- https://docs.python.org/dev/library/calendar.html#calendar.HTMLCalendar.cssclasses
- https://docs.python.org/dev/library/binascii.html#binascii.b2a_uu

Part of #1965.
2018-03-22 08:01:09 -07:00
matthewfranglen
9a6a7a2e75 See #1977: Delete DoneAndNotDoneFutures definition (#1978)
The generic type of the futures provided to the wait method cannot
currently be preserved through this definition. For now deleting the
unused NamedTuple is the best approach.
2018-03-22 07:59:13 -07:00
Jelle Zijlstra
b9c5e811df allow instantiating TracebackType in 3.7 (#1967)
See https://docs.python.org/dev/reference/datamodel.html#traceback-objects
and python/cpython#4793.

part of #1965
2018-03-21 15:26:23 -07:00
Jelle Zijlstra
bfe0b06953 add stub for contextvars.pyi (#1968)
Part of #1965.
2018-03-21 15:16:14 -07:00
Luka Sterbic
89cbd47344 Stubs for termcolor (#1935) 2018-03-20 15:32:50 -07:00
Leonardo Fedalto
a9cce0c94b Add requests.utils.set_environ (#1973) 2018-03-20 11:15:52 -07:00
Josh Holland
162d884d32 Make zipfile accept Text, not str (#1826) 2018-03-17 22:33:29 -07:00
Ashwini Chaudhary
164aa21fa1 Added stub for dircache(py2) (#1510) 2018-03-17 22:22:25 -07:00
Nipunn Koorapati
cac7264d3a Add google.protobuf.internal.containers.pyi to typeshed (#1718) 2018-03-17 22:05:43 -07:00
z33ky
c2c48424da Add missing collections.defaultdict.__init__ overloads (#1957) (#1958) 2018-03-17 08:22:11 -07:00
dgelessus
8009a34b90 Re-add stubs for ctypes (#1906)
* Convert type comments to variable annotations in ctypes.__init__

* Add missing List import in ctypes.__init__

* Add missing bound kwarg to _CT TypeVar in ctypes.__init__

* Fix ctypes._CData classmethod definitions

* Fix ctypes Structure/Union __getattr__ definitions

Both Structure's metaclass and Structure itself define a __getattr__.
The former returns field objects (each representing a field definition
in the Structure), while the latter can return anything (the value of
the field in a specific Structure instance).
Structure also defines a __setattr__, while Structure's metaclass
does not.

BigEndianStructure, LittleEndianStructure and Union support the same
operations as Structure does, but the semantics obviously differ.

Depending on the system endianness, exactly one of the EndianStructures
is an alias for Structure, and the other one is a special Structure
subclass. For simplicity, both EndianStructures are considered
subclasses of Structure here, even though this is technically not
always accurate.

* Fix swapped parameter types in ctypes._CData.in_dll

* Add limited support for ctypes._CData.__class__.__mul__

It's not possible to specify the correct return type for __mul__ and
__rmul__ here - see comments for explanation.

* Make ctypes._FuncPtr extend ctypes._CData

* Improve typing of ctypes.cast

* Mark class attributes with ClassVar in ctypes.__init__

* Mark ctypes._CData.from_buffer[_copy] offset arg as optional

* Remove trailing whitespace in ctypes.__init__

* Don't export ctypes.UnionT

* Add ctypes._DLL.__getitem__

* Make ctypes._DLL.__get(attr|item)__ return _FuncPtr instead of Any

* Change ctypes DLL inheritance hierarchy to match the real one better

* Add some missing attributes to ctypes.CDLL

* Rename ctypes._FuncPtr so it doesn't conflict with CDLL._FuncPtr

* Fix type of ctypes.CDLL._FuncPtr

* Merge _FuncProto into _FuncPointer

The function pointer types returned by CFUNCTYPE and friends are the
same as those encountered elsewhere, so there's no need to treat them
differently.

* Fix some leftover references to ctypes._DLL

* Simplify definition of ctypes._DLLT

* Add ctypes.LibraryLoader.__get(attr|item)__

* Use Text instead of str where appropriate in ctypes.__init__

* Make ctypes.c_char accept ints

* Make ctypes.c_[w]char_p accept None

* Remove unneeded Generic base from ctypes.py_object

* Make ctypes.cast accept _cparam

* Fix ctypes._PF being declared too late

* Remove incorrect ctypes.PyDLL.__init__ override
2018-03-16 20:17:24 -07:00
Sebastian Rittau
6cf97b8db2 Proper types for Common{Request,Response}DescriptorsMixin (#1948)
* werkzeug: Add proper types for CommonRequestDescriptorsMixin

* werkzeug: Add proper types for CommonResponseDescriptorsMixin
2018-03-16 20:13:03 -07:00
Sebastian Rittau
97d3cea9d1 Add module constants for smtplib (#1962) 2018-03-15 16:01:23 -07:00
rchen152
eda3f36cb9 Make abc.abstractproperty a class inheriting from property. (#1964) 2018-03-15 15:59:14 -07:00
Nipunn Koorapati
5af337b438 Add subprocess annotation for TimeoutExpired (#1954) 2018-03-13 08:26:59 -07:00
Sergey Passichenko
00efd76861 Rename parameter to match the actual name in stdlib (#1959) 2018-03-10 09:10:09 -08:00
Guido van Rossum
9d9527c94c Get rid of BLOCKED label in favor of [WIP] subject prefix (#1956)
We (I) introduced the BLOCKED label ~2 years ago, but it never got much usage, and I remember it startled some developers (Ivan may recall...). A better convention seems to put [WIP] in the subject, so let's standardize on that and get rid of the BLOCKED label.

I already removed the BLOCKED label and edited the subject of the one issue under it.

We also don't make good use of the other labels, but they seem more useful and less controversial.
2018-03-09 10:39:30 -08:00
Martin DeMello
b0d5a2100e add progress monitoring (#1945) 2018-03-08 15:37:45 -08:00
Dan Sully
ef87943397 Update click.option to allow for user defined kwargs. (#1950)
Click's option decorator can take a cls= argument, which allows that class to parse arbitrary arguments from the decorator.
2018-03-07 10:32:55 -08:00
David Euresti
df65f6ea15 Better type for click 'type' argument (#1903)
The call accepts tuples of types and callback methods
2018-03-06 21:41:21 -08:00
Svyatoslav Ilinskiy
d702d3621c Complete stubs for email package in python2 (#1936)
Fix #685, fix #275
2018-03-06 21:38:01 -08:00
Salvo 'LtWorf' Tomaselli
89e5d9607c Add missing headers field (#1946) 2018-03-06 21:36:33 -08:00
yed podtrzitko
1fe9fd83fa validator.instance_of can contain sequence of types (#1920) 2018-03-06 10:18:33 -08:00
David Euresti
50c7188300 Work around mypy issue #4554 in attr.Factory (#1933)
This makes the following not give a type error:

   y: DefaultDict[str, List[int]] = Factory(lambda: defaultdict(list))
2018-03-05 19:21:14 -08:00
Ethan Smith
1c47458ac6 Add cache_clear to lru_cache (#1941) 2018-03-05 18:52:46 -08:00
Matthias Kramm
6c30806d07 add deprecation comment to mypy_extensions (#1943) 2018-03-05 18:51:14 -08:00
rchen152
38dc8f5a6a Switch usages of mypy_extensions.NoReturn over to typing.NoReturn. (#1942)
* Change mypy_extensions.NoReturn to typing.NoReturn everywhere.
2018-03-05 12:42:29 -08:00
Rob Day
f91163d729 Fix type of loop parameter to start_unix_server (#1939) 2018-03-03 13:34:02 -08:00
Guido van Rossum
ac465ea224 Add guideline for undocumented objects. (#1938)
Also add Ivan as a typeshed core dev (since he is in the group).
2018-03-02 11:54:51 -08:00
Miguel Gaiowski
a8465da863 Add stub for subprocess.list2cmdline function (#1898) 2018-03-02 11:04:22 -08:00
Kenny Do
156927d2a2 tzinfo.tzname is optional (#1934) 2018-02-28 19:14:12 -08:00
Takuya Akiba
74345aa898 Add missing next method to iterators returned by Pool.imap (#1926) 2018-02-28 18:34:30 -08:00
Takuya Akiba
7e169a29c2 Add multiprocessing.pool to Python 2 stub (#1932) 2018-02-28 11:22:11 -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
Josh Holland
c9eead5890 Make some arguments in secrets module optional (#1929) 2018-02-27 10:52:21 -08:00
Takuya Akiba
5e37071a42 Fix imports to expose error classes in multiprocessing module (#1928) 2018-02-27 09:47:18 -08:00
rchen152
066c434410 Improve the unittest stubs. (#1927)
* Improvements to stdlib/2/unittest.pyi

* Adds a bunch of missing things.
* Fixes the signatures of assertRaises and failUnlessRaises.
* Corrects the name of a TestCase subclass from CallableTestCase
  to FunctionTestCase.
* Makes defaultTestLoader an instance of TestLoader, as it should
  be, rather than an alias. Based on https://docs.python.org/2/library/unittest.html and
  https://github.com/python/cpython/tree/2.7/Lib/unittest.

* Improvements to stdlib/3/unittest/__init__.pyi

* The constructor arguments to TextTestResult are all required.
* There is a module-level load_tests() function.
* removeResult() returns a bool. Based on https://docs.python.org/3/library/unittest.html and
  https://github.com/python/cpython/tree/master/Lib/unittest.
2018-02-27 06:46:10 -08:00
Łukasz Langa
9b6df1d6bc [tokenize.open] Accept PathLike filename (#1921)
* [tokenize.open] Accept PathLike filename

* Still accept str, bytes and int on Python 3.6+
2018-02-26 11:01:48 -08:00
Han Song
a5c9093edc Allow requests.post to accept str for data. (#1922)
```python
import json

url = 'https://api.github.com/some/endpoint'
payload = {'some': 'data'}
r = requests.post(url, data=json.dumps(payload))
```
2018-02-25 22:19:35 -08:00
David Euresti
61e63293f1 Work around mypy issue #4554 in attrs. (#1914) 2018-02-24 13:00:15 -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
Jelle Zijlstra
35d3effe03 Remove version check for deque.insert and deque.index (#1916)
Otherwise, deque is not instantiable in Python 3.4. We could do a dynamic base class instead
but that doesn't seem worth it.
2018-02-24 11:12:56 -08:00