Commit Graph

41 Commits

Author SHA1 Message Date
Thomas Schaper 91deb7a79f Make FrameType.f_back optional (#3740) 2020-02-16 19:40:10 +01:00
Sebastian Rittau 0501e2b329 Annotations for remaining Python 3.8 additions (#3358)
* Add os.add_dll_directory()
* Add memfd_create() and flags
* Add type annotation to flags
* Add stat_result.st_reparse_tag and flags
* Add ncurses_version
* Add Path.link_to()
* Add Picker.reducer_override()
* Add plistlib.UID
* Add has_dualstack_ipv6() and create_server()
* Add shlex.join()
* Add SSL methods and fields
* Add Python 3.8 statistics functions and classes
* Remove obsolete sys.subversion
* Add sys.unraisablehook
* Add threading.excepthook
* Add get_native_id() and Thread.native_id
* Add Python 3.8 tkinter methods
* Add CLOCK_UPTIME_RAW
* Add SupportsIndex
* Add typing.get_origin() and get_args()
* Add unicodedata.is_normalized
* Add unittest.mock.AsyncMock

Currently this is just an alias for Any like Mock and MagicMock. All of
these classes should probably be sub-classing Any and add their own
methods. See also #3224.

* Add unittest cleanup methods
* Add IsolatedAsyncioTestCase
* Add ElementTree.canonicalize() and C14NWriterTarget
* cProfile.Profile can be used as a context manager
* Add asyncio task name handling
* mmap.flush() now always returns None
* Add posonlyargcount to CodeType
2019-10-14 09:53:48 +02:00
Sebastian Rittau 8a7d61741d Python3.8 additions and changes (#3337)
* Add as_integer_ratio() to a few types

* Add dirs_exist_ok to copytree()

* int, float, complex accept __index__ args

Also fix complex.__init__ argument names

* Add __reversed__ to dict et al.

* Python 3.8 date(time) arithmetic fixes

* Add CodeType.replace()
2019-10-10 20:51:27 -07:00
Sebastian Rittau c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Rune Tynan 58221cf20e Add types and functions in types.py that are new in 3.7 (#3066)
* Add types and functions in types.py that are new in 3.7

* Update `resolve_bases` to accept any iterable of objects, and the same
for `new_class` if the version is at least 3.7

* Add comparison overrides implemented by MethodWrapperType

* Fix mypy error due to over-constrained `__eq__`
2019-06-19 15:20:57 -07:00
Radu Matei Lăcraru a7785151aa Make AsyncGeneratorType.aclose() properly return Awaitable[None] (#3032) 2019-06-05 11:20:23 +02:00
Jelle Zijlstra b5493e8639 add types.FunctionType.__init__ (#2968)
Fixes #2930
2019-05-07 17:31:01 +02:00
Michael A. Smith 54069f4341 Annotate copy for MappingProxyType (#2955) 2019-05-05 14:10:59 -04:00
Michael Lee efb67946f8 Use variable annotations everywhere (#2909) 2019-04-13 10:40:52 +02:00
Rune Tynan cb7de8adfa Fix typo in FrameType 3.7 attributes (#2899) 2019-04-03 22:52:34 +01:00
Brandt Bucher 1857435e6f types.CodeType.co_filename isn't Optional. (#2639) 2018-11-27 20:53:05 -08:00
Yusuke Miyazaki 6192cce9d9 Avoid using string literals in type annotations (#2294) 2018-07-02 20:23:29 -07:00
Jelle Zijlstra 38fb53eab6 add __init__ to SimpleNamespace (#2207)
```In [11]: SimpleNamespace(x=3)
Out[11]: namespace(x=3)
```
2018-06-11 08:08:41 -07:00
Emil Hessman 97e261cce8 Define SimpleNamespace as a proper class (#2087) 2018-04-29 23:02:13 -07:00
Jelle Zijlstra 0acdfd1548 more 3.7 features (#2017) 2018-04-06 11:09:45 -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
Semyon Proshev 7c11ae03de Add __qualname__ to functions and methods (#1750) 2017-11-16 08:37:36 -08:00
Semyon Proshev 72fbc459a7 Add __init__ to types.MethodType (#1499) 2017-07-26 08:38:27 -07:00
Roy Williams ac87de50dd Add __name__ field to MethodType (#1442)
See https://github.com/python/cpython/blob/08c16016e2a2d1368d001ddebfe9ca92465773c4/Lib/types.py#L32-L34

```python
>>> class _C:
...     def _m(self): pass
...
>>> _C()._m.__name__
'_m'
```
2017-06-29 10:05:25 -07:00
Carl Meyer 6d88431403 Correct the type of MethodType.__func__. (#1383)
See python/mypy#3484 for background.
2017-06-02 11:06:07 -07:00
Jelle Zijlstra e8013fd808 add types.AsyncGeneratorType (#1322) 2017-05-26 08:37:39 -07:00
Jelle Zijlstra 349ff59f33 change empty bodies from "pass" to "..."
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.
2017-03-16 09:13:08 -07:00
Andrey Vlasovskikh 92534805b5 Added missing special attributes for PY3 functions (#875) 2017-01-29 20:34:35 -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
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
TrueBrain 15ec66cdd6 Consider __doc__ always Optional. (#641)
python/mypy#2380 showed a discrepancy between object and FunctionType in stdlib2. The first defined __doc__ to be str, the second Optional[str]. As FunctionType depends on object, this is no longer valid.

As suggested by @gvanrossum in python/mypy#2380, all __doc__ should be considered Optional.

(Final verdict was just to remove most __doc__ attributes since it's inherited from object.)
2016-10-30 11:48:23 -07:00
Guido van Rossum 8515cf5de8 Attempt to reduce cyclical dependencies between types and importlib. (#335)
- Move Loader and ModuleType into _importlib_modulespec.pyi.
- Add "import X as X" for these to types.pyi and importlib/abc.pyi.

The goal is to ensure mypy -i still works, to fix https://github.com/python/mypy/issues/1797.
2016-07-05 10:23:24 -07:00
Guido van Rossum 37e42bfa96 ModuleType has a __file__ attribute. 2016-07-02 10:05:02 -07:00
Brett Cannon 43c3406770 Add stubs for importlib.machinery (#323)
* Fix some misspelled method names that were also missing 'self'

* Initial stubs for importlib.machinery

* Use importlib.machinery.ModuleSpec everywhere
2016-06-30 17:07:49 -07:00
Brett Cannon 05e02c188f Implement stubs for importlib.abc and update types.ModuleType (#321) 2016-06-30 15:02:42 -07:00
Tomasz Elendt a277980d99 Fix types.MappingProxyType (#259) (#260) 2016-06-04 13:02:07 -07:00
Daniel Shaulov 14ffe7ea17 Inherit from Any in threading.local and SimpleNamespace 2016-01-22 12:24:36 +02:00
Matthias Kramm 94c9ce8fd0 Consistently use '= ...' for optional parameters. 2015-11-09 13:55:02 -08:00
Ben Longbons c0aea8e8aa Finish implementation of the types module
Note that many classes will need special handling in the typing module.
2015-10-27 20:17:35 -07:00
Ben Longbons 56fe787c74 Update a bunch of stubs 2015-10-19 20:02:10 -07:00
Matthias Kramm c1e554af68 fix syntax of types.pyi 2015-10-12 14:30:17 -07:00
Matthias Kramm 75b3d91e02 fixes for types.CodeType (in 2.7/ and 3/) 2015-10-12 10:44:45 -07:00
Ben Longbons 793f3399a7 Stub for inspect.stack() and related classes 2015-10-12 10:35:04 -07:00
Matthias Kramm 337abed05a add (overwrite with) mypy stubs, if available 2015-09-30 09:59:44 -07:00