Commit Graph

14 Commits

Author SHA1 Message Date
Jan Verbeek
95cafc0b7c sys: Correct types of sys.displayhook, sys.excepthook and variants (#3673)
displayhook should accept any object, not just integers.

displayhook and excepthook may be assigned to, so they should be
Callable values rather than function definitions. That way it's fine
to assign a function with different argument names. Their dunder
variants are supposed to be constant.
2020-01-29 11:25:35 +01:00
Sebastian Rittau
87d7dd3d95 Fix annotations with literal values (#3411) 2019-10-28 06:59:28 -07:00
Sebastian Rittau
de26a3d109 Remove raise statements from function bodies (#3355)
While it may eventually be useful to mark the exceptions that can be
raised from a function or method, the semantics are currently undefined
and unclear.
2019-10-13 21:51:43 +02:00
Ran Benita
4ae4714e00 sys: refine the return type of sys.exc_info() (#3111) 2019-07-11 10:43:37 +02:00
Michael Lee
efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Sebastian Rittau
25ac4d6af4 Implement StartResponse using a protocol (#2392)
* Add ExcInfo and OptExcInfo type aliases

* Implement StartResponse using a protocol

* Mark stub-only types with an underscore

* Remove wrong TODO note

python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
2018-08-17 08:36:00 -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
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
Matthias Kramm
9c04490e92 add sys.setdefaultencoding() (#1865) 2018-02-08 11:25:48 -08:00
Matthias Kramm
8d8708594e Make sys.modules a Dict[str, Any] (#1266)
* Add __getattr__ to ModuleType.

Modules can contain anything, so give them a generic "__getattr__(name) -> Any".
This makes code like the following type-check, in pytype:
    sys.modules.get("random").randint

* undo Python 3 change

* Revert "undo Python 3 change"

This reverts commit 96cf2d529e374a754f1ba681f0fc81aab25f81ef.

* Revert "Add __getattr__ to ModuleType."

This reverts commit 3ac1cf8a3b25dabfe386fbf34aef680fb1acd112.

* In stdlib/2/, make sys.modules a Dict[str, Any].

(Instead of Dict[str, ModuleType])
Same as stdlib/3/.
2017-05-20 11:08:25 -07:00
David Euresti
ac4cb7a619 Make sys.getfilesystemencoding not return None (#1245)
Fixes #1221
2017-05-05 07:45:10 -07:00
David Fisher
2cb8e184cc Add NoReturn (#811)
* Add NoReturn
2017-01-04 13:38:05 -08:00
Lukasz Langa
fe0e3744cc Fixing flake8 E261 errors 2016-12-19 22:09:35 -08:00
Guido van Rossum
cb97bb54c0 Move 2.7 to 2 (#635)
Closes #579.
2016-10-26 16:24:49 -07:00