Commit Graph

443 Commits

Author SHA1 Message Date
Lukasz Langa
5b6a9937b2 Fixing flake8 E266 errors 2016-12-20 00:06:36 -08:00
Lukasz Langa
6b5c6626d6 Fixing flake8 E121, E122, E123, E124, E125, E126 errors 2016-12-19 23:53:19 -08:00
Lukasz Langa
67e38b6806 Fixing flake8 E231 errors 2016-12-19 23:53:19 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Lukasz Langa
b84f20a011 Fixing flake8 W errors 2016-12-19 21:52:56 -08:00
Reverb Chu
a6ecab3fe7 correct return value type TestRunner.run 2016-12-19 20:28:34 -08:00
TrueBrain
7e89fc0d49 Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]] (#780)
* Define __slots__ for object as Iterable[str] / Iterable[Union[str, unicode]]
* A string as __slots__ value is also valid and represents a single item
2016-12-19 13:09:04 -08:00
Lukasz Langa
2058ae30ab Proper singledispatch type definitions
Correctly detects calls to `register()` with a function of incompatible return
type.  Correctly recognizes the `register()`, `dispatch()`, and
`_clear_cache()` methods on a generic function, as well as the `registry`
mapping.

Possible future improvements: it would be amazing if `register()` checked if
the first argument of the registered callable is indeed of valid type. This
would require Callable[] to support varargs.  It would also be great if we
could read the arguments of the remaining arguments during `@singledispatch()`
and cross-check them during `register()` with the currently registered
implementation. Again, this would require Callable[] to become much more
advanced.
2016-12-19 12:54:08 -08:00
David Fisher
beb9183103 Swap order of overloads to fix filter without strict optional (#779)
Related to python/mypy#2587
2016-12-16 15:57:04 -08:00
Philip House
830c2fb089 updating stderr to return type Any (#776) 2016-12-16 11:51:52 +00:00
David Fisher
957307b785 Make filter work properly with Optional elements (#775) 2016-12-15 17:53:38 -08:00
KOSAKA Masayuki
6fc57a419b Adapt base64 stub to newer Python 3 versions (#762) 2016-12-14 08:52:19 -08:00
Henri Dwyer
6887edebda add calendar data attributes (#751) 2016-12-13 14:58:26 -08:00
jgarvin
0392ccaa9c Add stub for _thread.get_ident() (#746) 2016-12-13 14:56:06 -08:00
KOSAKA Masayuki
3cae92253b Fix datetime.fromtimestamp (#759) 2016-12-13 14:55:06 -08:00
Philip House
04f5c5699e Merge 3.4 and 3.5 pathlib stubs (#764)
Fixes #659
2016-12-13 12:03:03 -08:00
Guido van Rossum
b46280ec78 Make FrozenSet covariant. (#769)
Follow-up for PR #726.
2016-12-13 11:40:18 -08:00
Philip House
bc252d69ac set subprocess stdout to be type Any (#581) (#761) 2016-12-13 14:23:45 +00:00
Jelle Zijlstra
97a6d27558 Make first argument to filter optional
```
$ python3.4
Python 3.4.3 (default, Nov 17 2016, 01:08:31) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> list(filter(None, [False, True]))
[True]
>>> 
```
2016-12-12 11:31:12 -08:00
Daisuke Miyakawa
57aa1923d5 Make sqlite3's Connection.rollback() return None (#758)
Fixes #747.
2016-12-07 16:22:47 -08:00
George King
af5b5c83fd Make shutil.copytree stub's ignore parameter optional. (#740)
* Make `shutil.copytree` stub's `ignore` parameter optional.

* python2.7 shutil.copytree `ignore` annotated as optional.
2016-12-07 14:47:34 -08:00
George King
e7db9cda4d Add stub for os.path.commonpath (new in 3.5). (#738)
* Add stub for os.path.commonpath (new in 3.5).
2016-12-07 14:47:04 -08:00
George King
dccc29bc2f Add None to type union for subprocess.Popen.communicate input. (#743)
* Add `None` to type union for `subprocess.Popen.communicate` stub's `input` parameter.

* subprocess.communicate `input` annotated as `Optional[AnyStr]` for both 2.7 and 3.x; `timeout` as `Optional[float]`.
2016-12-07 14:46:34 -08:00
Daisuke Miyakawa
b33c2c6158 Introduce multiprocessing.freeze_support() (#749) 2016-12-07 13:30:14 -08:00
George King
00e4027b77 Add idx parameter to JSONDecoder.raw_decode. (#742) 2016-12-07 13:19:27 -08:00
George King
085c3f9915 Make json.load, json.loads stubs object_hook parameter optional. (#741) 2016-12-07 13:14:49 -08:00
Jon Dufresne
2b022d18a4 Add stub for unittest.mock (#731)
Stub generated by stubgen.

Fixes #372
2016-12-07 08:05:01 -08:00
Onno Kortmann
69ea0ad43f Iteration and fetch* fixes to the sqlite3.Cursor type (#663)
- Cursor is an Iterator of Any now, and .__iter__(..) and .__next__(..)
  have been changed / made explicit to reflect this.

- .fetchall(..)/.fetchmany(..)/.fetchone(..) return (lists of) Anys
  instead of tuples.

As per discussion in PR #663, the output of fetching values from the
cursor can be customized with a custom assignment to
.row_factory. Therefore the correct return type for fetching is Any and
not tuple.
2016-12-06 08:17:21 -08:00
Danny Weinberg
3855e7023f Ignore a stub class that extends Any (#745)
Ignore a stub class that extends Any so that programs can use `--disallow-subclassing-any`.
2016-12-05 14:30:14 -08:00
Danny Weinberg
679a6e5669 Give shutil.which a return annotation (#744) 2016-12-05 11:41:53 -08:00
thomascellerier
d18a225ec2 Fix type for base64.b64encode, it should accept str or bytes (#736)
Fixes #735
2016-12-05 11:15:40 -08:00
Calen Pennington
5ba7abc559 Add GenericMeta (so that classes can be Generic when they already hav… (#703) 2016-12-02 12:09:59 -08:00
Jelle Zijlstra
ed4f9e9b0b urlencode: change parameters to Any instead of AnyStr (#715)
The implementation of this function calls str() on all arguments, so it accepts
any object (https://hg.python.org/cpython/file/3.5/Lib/urllib/parse.py#l801).

This was discussed on the mypy gitter chat.
2016-12-01 11:38:23 +00:00
Josiah Boning
c9ad4b8dc0 Have frozenset inherit from FrozenSet (#726)
Fixes python/mypy#2514
2016-11-30 17:58:11 -08:00
Łukasz Langa
85807ed72a logging.Formatter attributes fixed (#721)
Fixes #720.

Related changes: used a NamedTuple for time.struct_time on Python 3, used
sys.version selectors for proper typing of #716, added missing *Style classes
to logging on Python 3.
2016-11-30 09:09:05 -08:00
rymdhund
eb90eddd8f Fix urllib.parse.urlencode signature (#702)
Fixes #700
2016-11-24 11:45:20 +00:00
Richard Eames
4f567d993b Add missing self parameters (#695)
A few methods are missing the `self` parameter in  `urllib.RobotFileParser`
2016-11-23 11:37:39 +00:00
Ryan C. Thompson
f36d7a3cd3 Multiprocessing fixes (#687)
* Fix type declarations for multiprocessing.pool.ThreadPool

The existing incomplete type declarations were replaced by a copy of
multiprocessing.Pool's declarations, suitably modified.

Fixes #683.

* Change iterable type to Iterable[Iterable[Any]] in starmap

multiprocessing.Pool and multiprocessing.pool.ThreadPool have starmap
and related methods, where the iterable argument is expected to yield
iterables. The type declarations now reflect this.
2016-11-12 17:31:54 -08:00
jgarvin
88350e7f47 Add ns accurate times in os.stat_result (#686) 2016-11-12 17:20:00 -08:00
Onno Kortmann
c4125739e5 The timeout argument to Queue.{get,put} may be None (#682)
Python 2 and 3.
2016-11-11 10:29:52 -08:00
Hong Minhee
5fc1b4b948 Add missing MutableSet abstract base class (#680) 2016-11-10 14:10:10 -08:00
Guido van Rossum
ec4987fa5d Fix AwaitableGenerator inheritance; Awaitable is the return value, not the yielded value (#679) 2016-11-10 11:57:31 -08:00
Elazar Gershuni
dfe4bf0a70 Fix broken sys.version_info check in importlib/abc.pyi (#673)
Fixes #672.
2016-11-09 08:43:06 -08:00
Hong Minhee
13b1cdc834 Stubs for collections.abc (#671)
The ABC types were moved to collections.abc in 3.3 (but still exist in collections too).
2016-11-08 21:37:33 -08:00
Roy Williams
1b30761802 Small changes by @rowilla to collections.pyi and urllib/requests.pyi.
(Extracted from PR #530.)
2016-11-08 19:40:10 -08:00
Jon Dufresne
4b369945d0 Change struct fmt argument to str instead of AnyStr (#669)
Switching between a bytes fmt and str fmt argument can cause a BytesWarning
when running Python with the -b command line argument.
2016-11-07 16:58:25 -08:00
TrueBrain
341c4edc37 Args is a predefined attribute on BaseException, and always Tuple[Any, ...] (#666) 2016-11-05 16:33:58 -07:00
TrueBrain
cecb64b59f In TextIO, 'errors' is Optional (#665) 2016-11-05 15:02:35 -07:00
Guido van Rossum
53014497c4 Add Coroutine. Fix signature for Generator.throw(). (#656) 2016-11-04 11:46:50 -07:00
Guido van Rossum
7c20adb715 Fix memoryview stub (#651)
Fixes python/mypy#2390
2016-11-02 17:18:44 -07:00