| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
(cherry picked from commit 5ef53a88f3130cfcf9a9be3abd2ff2f997902647)
Co-authored-by: John Belmonte <john@neggie.net>
|
|
|
|
|
|
| |
Automerge-Triggered-By: @gvanrossum.
(cherry picked from commit d4b9edd5052a2d9ae3d2be69975cc933afb37737)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
|
| |
Missed this occurrence before, sorry. Also changed "the PEP" to "PEP".
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 3fe614893742faee3c64e6d974e11329a496424f)
Co-authored-by: Andre Delfino <adelfino@gmail.com>
|
|
|
|
|
|
|
| |
(cherry picked from commit 8c58d2a216ca2b5965361df9b8d8944bc7d4854d)
Co-authored-by: MingZhe Hu <humingzhework@163.com>
Co-authored-by: MingZhe Hu <humingzhework@163.com>
|
|
|
|
|
|
| |
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit fa5d7251987c70a9c5d58b59a0b36ac9287eaafa)
Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
|
|
|
|
|
| |
(cherry picked from commit b40e434386cd94a367d4a256e3364771140160e7)
Co-authored-by: Zackery Spytz <zspytz@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit 2b0e654f91f28379c6c7ef5fd80e8754afb70935)
Co-authored-by: ziheng <zihenglv@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
(GH-18784)
(cherry picked from commit d4a09c13ddd91a9bc1b4ba76ff4e8a153334a1e2)
Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
|
|
|
|
|
| |
(cherry picked from commit ab6423fe2de0ed5f8a0dc86a9c7070229326b0f0)
Co-authored-by: ananthan-123 <ananthakrishnan15.2001@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit fdfe2833ace93021278fe4c41c40e1d08d70abf9)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
|
|
|
|
|
|
|
|
|
|
| |
(GH-16743)
Metaclass was removed in Python 3.7 (there is already a `versionchanged` item about this).
https://bugs.python.org/issue28556
(cherry picked from commit 8144095707f87bdee6f3e1bbb15283ea61381be6)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
|
|
|
|
|
|
|
|
|
| |
PR GH-4906 changed the typing.Generic class hierarchy, leaving an
outdated comment in the library reference. User-defined Generic ABCs now
must get a abc.ABCMeta metaclass from something other than typing.Generic
inheritance.
(cherry picked from commit d47f0dd2e85ce032aebfedbde18cdb2e728fa79f)
Co-authored-by: M. Eric Irrgang <mei2n@virginia.edu>
|
|
|
|
|
|
| |
This PR replaces the old note mentioning that `typing` is a provisional module with a new one mentioning types are not enforced at runtime. I am not sure if there was any official announcement about making `typing` non-provisional, but _de-facto_ no new features were added during Python 3.7, and no backwards incompatible changes were made except for few small things that were considered bugs.
(cherry picked from commit 81528ba2e81c39f4d6bca5b785e818c7d08b8501)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
|
|
|
|
|
|
|
|
|
|
| |
https://bugs.python.org/issue37814:
> The empty tuple syntax in type annotations, `Tuple[()]`, is not obvious from the examples given in the documentation (I naively expected `Tuple[]` to work); it has been documented in PEP 484 and in mypy, but not in the documentation for the typing module.
https://bugs.python.org/issue37814
(cherry picked from commit 8a784af750fa82c8355903309e5089eb2b60c16b)
Co-authored-by: Josh Holland <anowlcalledjosh@gmail.com>
|
|
|
|
|
| |
(cherry picked from commit 809ff1181ccc09c3b629f3d0ec66e13eaa111b2e)
Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(GH-13685)
This is an old feature request that appears from time to time. After a year of experimenting with various introspection capabilities in `typing_inspect` on PyPI, I propose to add these two most commonly used functions: `get_origin()` and `get_args()`. These are essentially thin public wrappers around private APIs: `__origin__` and `__args__`.
As discussed in the issue and on the typing tracker, exposing some public helpers instead of `__origin__` and `__args__` directly will give us more flexibility if we will decide to update the internal representation, while still maintaining backwards compatibility.
The implementation is very simple an is essentially a copy from `typing_inspect` with one exception: `ClassVar` was special-cased in `typing_inspect`, but I think this special-casing doesn't really help and only makes things more complicated.
|
|
|
|
|
| |
I tried to get rid of the `_ProtocolMeta`, but unfortunately it didn'y work. My idea to return a generic alias from `@runtime_checkable` made runtime protocols unpickleable. I am not sure what is worse (a custom metaclass or having some classes unpickleable), so I decided to stick with the status quo (since there were no complains so far). So essentially this is a copy of the implementation in `typing_extensions` with two modifications:
* Rename `@runtime` to `@runtime_checkable` (plus corresponding updates).
* Allow protocols that extend `collections.abc.Iterable` etc.
|
|
|
|
| |
The implementation is straightforward and essentially is just copied from `typing_extensions`.
|
|
|
|
| |
The implementation is straightforward and essentially is just copied from `typing_extensions`.
|
|
|
|
| |
The implementation is straightforward, it just mimics `ClassVar` (since the latter is also a name/access qualifier, not really a type). Also it is essentially copied from `typing_extensions`.
|
|
|
|
| |
In order to support typing checks calling hex(), oct() and bin() on user-defined classes, a SupportIndex protocol is required. The ability to check these at runtime would be good to add for completeness sake. This is pretty much just a copy of SupportsInt with the names tweaked.
|
|
|
| |
This paragraph doesn't seem to be a part of code, but merged into previous code block.
|
| |
|
|
|
|
|
|
| |
Also, deprecate the *_field_types* attributes which duplicated the information in *\__annotations__*.
https://bugs.python.org/issue36320
|
|
|
|
|
|
| |
* Replace external recipe link with a link to the dataclasses module.
* Highlight the class definition syntax for typing.NamedTuple
and add an example for clarity.
|
|
|
| |
The earliest version that `typing.NoReturn` appears in is [3.5.4rc1](https://docs.python.org/3/whatsnew/changelog.html#python-3-5-4-release-candidate-1)
|
|
|
|
| |
https://bugs.python.org/issue35631
|
| |
|
| |
|
|
|
|
| |
https://bugs.python.org/issue35089
|
| |
|
| |
|
|
|
|
|
|
| |
Currently, the docs state that when doing `Type[X]`, X is only allowed to
be a class, a union of classes, and Any. This pull request amends
that sentence to clarify X may also be a typevar (or a union involving
classes, Any, and TypeVars).
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
- Add "version added: 3.5.2" note where it was missing.
- Remove the mention that Reversible is new in 3.5.2
|
| |
|
|
|
| |
Mention that ``NewType`` can derive from another ``NewType``.
|
|
|
| |
When a class and its subclass are present, the latter is skipped.
|
|
|
|
|
|
|
|
| |
* Fix PEP 8 (SomeType instead of some_type)
* Add a function parameter annotation
* Explain, using wording from PEP 484 and PEP 526,
why one annotation is in quotes and another is not.
Suggested by Ivan Levkevskyi.
|
|
|
|
| |
Documents a few omitted classes and adds NamedTuple methods.
|
| |
|
|\ |
|