Commit Graph

40 Commits

Author SHA1 Message Date
Jelle Zijlstra
4f2dd0f446 remove unused type ignore flags (#1346)
Verified that none of those are necessary for pytype.
2017-05-26 08:28:51 -07:00
Emily Morehouse
b6d08b81a3 #1286 Remove header comments from stubs (#1292)
- Updates documentation related to previously required comment headers.
- Removes all comment headers from stubs
- Occasionally included a header for stubs that were noted to be incomplete or contained todo's.
2017-05-22 15:14:15 -07:00
Jelle Zijlstra
7dd2f80194 Fixes to ContextManager (#1249)
* add typing.ContextManager for 3.6+ only

This fixes the easier part of #655.

Would it make sense to add a generic typing.ContextManager that exists in any Python version?

* update comment

* fix argument types for ContextManager.__exit__

* add AsyncContextManager

* add @asynccontextmanager

* typing.ContextManager now always exists

* back out async-related changes

Will submit those in a separate PR later

* fix import order

* AbstractContextManager only exists in 3.6+

* AbstractContextManager -> ContextManager
2017-05-08 16:21:51 -07:00
Naomi Seyfer
c96a64d421 Remove second empty line in mypy_extensions (#1237) 2017-05-02 21:41:23 +01:00
Naomi Seyfer
6a9d74d1c7 Args for "flexible callable" experimental mypy feature. (#793)
This is the typeshed for the constructors for the Arg types that we'll now be
able to pass to Callable.  They really just return their type arguments.
2017-05-02 21:40:41 +01:00
Łukasz Langa
f543ddd89a Move yaml stubs to 2and3 (#1155) 2017-04-12 21:09:23 -07:00
Ashwini Chaudhary
35b6795183 Stubs for boto.kms (#1081)
* Stubs for boto.kms

* Added types for params

* Added return type and fixed signatures(including review changes)

* Removed make_request from stub(https://github.com/python/mypy/issues/1237). Fixed Dict issue.

* Fixed typo

* Let's be precise about return type
2017-04-03 21:22:32 -07:00
Guido van Rossum
03bfcee0b8 Remove sqlalchemy. (#1105)
See discussion in https://github.com/python/typeshed/pull/1094.

If we do this we should make it easier in mypy to install 3rd party stubs that are used by default.
2017-03-28 08:25:00 -07:00
Jelle Zijlstra
8318953a17 remove if TYPE_CHECKING in sqlalchemy stub (#1074)
This isn't needed in typeshed, since the stubs aren't executed.
2017-03-22 08:02:38 -07:00
Stefan Urbanek
5b47bc956e Added SQLAlchemy annotations (#1029)
* Added SQLAlchemy annotations

* Made Connection and Engine sublcasses of Connectable (python/typeshed#1018)
* Moved execute() from Connection to Connectable
* Made RowProxy a Mapping and removed Mapping inherited methods
* Made ResultProxy an Iterator of RowProxy
* Added most relevant methods for fetching of ResultProxy
* Added where(), group_by(), order_by() and limit() to Select

* Follow squalchemy module structure

* Created sqlalchemy.engine.result and moved ResultProxy and RowProxy
  there
* Created sqlalchemy.engine.interfaces and moved Connectable there
* Added non-deprecated methods to Connectable: connect,
  contextual_connect and scalar
* Fixed return type of scalar() to Any

* Missed ResultProxy scalar return

... had it in Connectable only.
2017-03-21 23:11:41 -07:00
Jelle Zijlstra
37a854630c merge 2 and 3 stubs for requests (#1017)
* merge 2 and 3 stubs for requests

* fix version comparison
2017-03-18 16:39:40 -07:00
Jelle Zijlstra
eb07fd3c1a make sure typevars defined in stubs are private (#989)
And also a few type aliases I noticed in the process.

Found using 59f9cac095
2017-03-13 07:32:40 -07:00
Tim Abbott
e3831d8d80 jinja2: Add InternationalizationExtension elements. (#942)
Fixes #927.
2017-02-20 11:09:44 -08:00
Ivan Levkivskyi
22c0353498 Add missing imports from typing (#933) 2017-02-14 10:59:00 -08:00
Adam Marszałek
ca36070d51 Improved pytz support for timezone function (#911) 2017-02-03 10:54:59 -08:00
Alexey
f398628948 Adding pymysql stubs to third_party/2and3 (#861)
(Original by @ghagerer, extracted from #647 by @WouldYouKindly.)
2017-01-29 21:01:49 -08:00
Lukasz Langa
c88d865520 Missing variable annotations were failing mypy tests 2017-01-24 15:21:55 -08:00
Alexey
ccdc609706 Update sqlalchemy stubs (#857)
I believe this covers both #647 and #719.

Moved sqlalchemy stubs from 2 to 2and3;
changed sqlalchemy/util/compat.pyi:37 to be of type typing.Text;
added incomplete stubs for sqlalchemy.orm.utils and slqalchemy.sql.elements.ColumnElement.
2017-01-23 15:56:30 -08:00
Ryan C. Thompson
d18484095e atomicwrites: add pyi file (#705)
Authorized by atomicwrites author here:
https://github.com/untitaker/python-atomicwrites/pull/23#issuecomment-260422021
2017-01-09 15:13:48 -08:00
David Fisher
2cb8e184cc Add NoReturn (#811)
* Add NoReturn
2017-01-04 13:38:05 -08:00
Guido van Rossum
231f00d7da Fix boto stubs.
Replace two `FIXME` comments with `type: ignore`.
See https://github.com/python/mypy/issues/1237.
2016-12-24 09:06:38 -08:00
Alex Jurkiewicz
8e9c53f1db Add basic stub for characteristic (#771)
See https://characteristic.readthedocs.io/en/stable/
2016-12-23 19:11:34 -08:00
Lukasz Langa
4084296f3f Exclude boto from tests due to broken Liskov Substitution Principle
Starting with python/mypy#2521 mypy is performing stricter function signature
checks.

This makes the stubs diverge from the actual implementation but makes the stubs
internally consistent.  Since this is an actual typing issue in the base
implementation, we need to defer to the original authors to fix it.

Sadly, in this case the breakage is rather fundamental and unlikely to get
fixed by upstream. Consider:

```
  class AWSAuthConnection(object):
    def make_request(self, method, path, headers=None, data='', host=None,
      auth_path=None, sender=None, override_num_retries=None,
      params=None, retry_handler=None): ...

  class AWSQueryConnection(AWSAuthConnection):
    def make_request(self, action, params=None, path='/', verb='GET'): ...
```

Hence, until we have a workaround for the error produced by Mypy, we're
excluding those stubs from being tested against.
2016-12-22 15:54:20 -08:00
Roy Williams
7c706e1100 Move boto to 2and3, add stubs for s3
I've added types for the functions we've been using internally, will expand in the future.
2016-12-22 11:23:36 -08:00
Lukasz Langa
c0c982ada5 Add missing Dict imports. 2016-12-21 01:15:26 -08:00
Lukasz Langa
82b2d8e3bc Fixing flake8 F403, F405 errors 2016-12-20 02:28:12 -08:00
Lukasz Langa
6eb97964fd Fixing flake8 E401, E402 errors 2016-12-20 00:47:51 -08:00
Lukasz Langa
6b5c6626d6 Fixing flake8 E121, E122, E123, E124, E125, E126 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
Roy Williams
89da3a4159 Move Crypto to 2and3 and generate rest of stubs. (#782)
I implemented strong types for Crypto.Cipher
2016-12-19 20:13:51 -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
Roy Williams
5d61aa5acb Add stubs for jinja2 (#722)
I added strong types to the class that users are likely to interact with and left
the rest untyped for now.  This is needed to support Flask.

Permission is given here - https://github.com/pallets/flask/issues/2012
2016-12-01 13:38:15 +00:00
Roy Williams
0391e72a6e Expose pytz.UTC as an instance as opposed to as a class (#723)
* Expose pytz.UTC as an instance as opposed to as a class

pytz shadows UTC after declaring it with a singleton:
https://github.com/newvem/pytz/blob/master/pytz/__init__.py#L135

This fixes https://github.com/python/typeshed/issues/710
2016-11-29 23:04:53 -08:00
Roy Williams
1dff8e4a45 Add stubs for markupsafe (#718)
* Add stubs for markupsafe
* Add more specific types for markupsafe

This is needed for Flask. Permission was given here:
https://github.com/pallets/itsdangerous/issues/69#issuecomment-246516942
2016-11-29 13:32:12 -08:00
David Foster
5c4300a4bd Add mypy_extensions. (#611) 2016-10-17 16:39:17 -07:00
Tim Abbott
94e0625e82 Fix ujson stubs to properly use AnyStr. (#540)
The ujson module apparently will accept both bytes and text format
input, however, it does always output a str (both on Python 2 and
Python 3).

Some discussion in: https://github.com/python/typeshed/pull/460
2016-09-13 10:07:44 -07:00
Michael Lee
313b584e34 Add stubs for ujson (#460) 2016-08-11 17:08:03 -07:00
Fabian Heredia Montiel
4a408c014f Add pytz basic typing (#383)
* Add pytz basic typing

* Add pytz.lazy basic typing

* Move the files to the correct path

* Move files to correct directory

* Ignore issue with different sig from supertype
2016-07-22 05:52:40 -07:00
Ben Darnell
1626c25087 Add some third_party modules.
backports_abc and singledispatch were made with stubgen, certifi was
written by hand, and ssl_match_hostname was copied from ssl.pyi.
2016-01-16 16:56:25 -05:00