| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
| |
(GH-16743)
Metaclass was removed in Python 3.7 (there is already a `versionchanged` item about this).
https://bugs.python.org/issue28556
|
|
|
|
|
|
|
| |
PR #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.
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
| |
|
|\ |
|
| |
| |
| |
| | |
Patch by Jelle Zijlstra.
|
|\ \
| |/ |
|
| |
| |
| |
| | |
Patch by Jelle Zijlstra.
|
| | |
|
| |
| |
| |
| | |
corresponding note to documentation. Patch by Ivan L.
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|
| | |
|
|\ \
| |/ |
|