* Add flags to pass on --warn-unused-ignores and --no-implicit-optional to mypy
* Make implicit Optional explicit in arg types (2and3 part)
* Convert {stdlib,third_party}/2 to explicit Optional
* Update default values to `...` in `__init__` and `__new__` in `int` and `str`.
* Add `__new__` to `enum.IntEnum` to override inherited `__new__`.
* Add `type: ignore` comment to `IntEnum`
* Tweak Click 6.6 Decorator Type Stubs
- Add context_settings for command
- Make callback Callable type accept some more types
To address Issue 1238
* Update decorators.pyi
- 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.
* Allow None in concurrent.futures.exception() and set_exception()
* Make Executor.map() signature more precise
* Remove superfluous signatures
* Specify str type for some concurrent.futures constants
* Update concurrent.futures backport
* CR fixes
* 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
* Add missing methods to Python 2 concurrent.futures
Future.exception_info() and Future.set_exception_info() are methods
present only in the Python 2 backport of concurrent.futures.
* Mark timeout args as optional
The latest mypy complained that the signature didn't match that in the
superclass: Serializer.load_payload() has a serializer argument. I
don't know this project but I think it's best to just add that
argument (rather than adding `# type: ignore`).
* 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
* 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.
This works towards fixing #924. To make the changes easier to review, I'm planning to
fix the issue in two steps:
- This commit makes the 3 stubs compatible with py2
- The next PR will move the 3 stubs to 2and3 and remove the 2 stubs
I wrote this code by diffing the files in third_party/{2,3}/requests and making
appropriate changes to the Python 3 stubs (mostly str/Text stuff). I verified
that the 3 stubs now pass mypy when parsed as 2.7, but I don't have an annotated
requests-using codebase to test on.
CONTRIBUTING.md says to prefer ... Not the most impactful change but fixing
these will allow us to lint for it in the future and get a consistent style.
third_party/2/concurrent/futures is for the Python 2 backport of the
concurrent.futures package from Python 3. In Python 3, all exceptions
are derived from BaseException, but Python 2 also supports exceptions
that are old-style objects (which don't derive from BaseException).
Switch from BaseException to Any to allow old-style exceptions.
All old-style objects are instances of types.InstanceType, so an
alternative to Any is Union[BaseException, types.InstanceType]. This
would help avoid accidentally passing a non-BaseException new-style
object to Future.set_exception(). However, only Executors call that
function (usually), and it's not clear that mypy understands old-style
objects and their relationship to types.InstanceType, so Any is
thought to be the more practical choice.
Mypy now supports metaclasses in Python 2, see python/mypy#2830
so that now __metaclass__ attribute has special treatment.
This PR makes small changes to fix the build (also most PRs are red because of this)
The concurrent.futures.Future class's set_exception() method might be
called with a BaseException that is not an Exception, so change
set_exception()'s parameter type from Exception to BaseException. The
exception set via set_exception() is returned by exception(), so
change exception()'s return type from Exception to BaseException.