Commit Graph

113 Commits

Author SHA1 Message Date
Miss Islington (bot) 734d6d9dfe
Doc: fix typo in typing.Type docs (GH-23460)
(cherry picked from commit 5ef53a88f3)

Co-authored-by: John Belmonte <john@neggie.net>
2020-11-22 07:12:20 -08:00
Andre Delfino b15fff620f
[3.8] [doc] Fix link to abc.collections.Iterable (GH-22502) (#22504)
Automerge-Triggered-By: @gvanrossum.
(cherry picked from commit d4b9edd505)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2020-10-11 10:32:02 -07:00
Miss Skeleton (bot) c3cd440e7b
[doc] Fix link to abc.collections.Iterable (GH-22520)
Missed this occurrence before, sorry. Also changed "the PEP" to "PEP".

Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 3fe6148937)

Co-authored-by: Andre Delfino <adelfino@gmail.com>
2020-10-03 09:00:38 -07:00
Karthikeyan Singaravelan 838316db08
[3.8] bpo-41624: fix documentation of typing.Coroutine (GH-21952). (#21983)
(cherry picked from commit 8c58d2a216)

Co-authored-by: MingZhe Hu <humingzhework@163.com>

Co-authored-by: MingZhe Hu <humingzhework@163.com>
2020-08-28 08:03:40 -07:00
Miss Islington (bot) 0a5b30d989
Fix typo in typing doc (GH-21879)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit fa5d725198)

Co-authored-by: Irit Katriel <iritkatriel@yahoo.com>
2020-08-14 16:09:58 -07:00
Miss Islington (bot) 6857ebefc0
bpo-33864: Clarify the docs for typing.ByteString (GH-21311)
(cherry picked from commit b40e434386)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-03 21:06:07 -07:00
Miss Islington (bot) b38bd8888a
bpo-40745: Fix typos in NewType docs (GH-20379)
(cherry picked from commit 2b0e654f91)

Co-authored-by: ziheng <zihenglv@gmail.com>
2020-05-25 21:52:55 -07:00
Serhiy Storchaka 0d1d7c8bae
bpo-36320: Use the deprecated-removed directive for _field_types (GH-19370) 2020-04-05 00:43:07 +03:00
Miss Islington (bot) 5a3926d559
Add a missing space after a period in 'typing.TypedDict' documentation (GH-18784)
(cherry picked from commit d4a09c13dd)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
2020-03-04 16:18:22 -08:00
Miss Islington (bot) 44c690112d
bpo-39572: Document ’total’ flag of TypedDict (GH-18554)
(cherry picked from commit ab6423fe2d)

Co-authored-by: ananthan-123 <ananthakrishnan15.2001@gmail.com>
2020-02-18 21:24:51 -08:00
Miss Islington (bot) c732660b7b
bpo-38467: Fix argument name of typing functions (GH-16753)
(cherry picked from commit fdfe2833ac)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2019-10-13 11:38:45 -07:00
Miss Islington (bot) e742826531
bpo-28556: Remove another mention of metaclass of Generic in typing docs (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 8144095707)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2019-10-13 10:00:19 -07:00
Miss Islington (bot) baf8a9b03a
bpo-32996: Documentation fix-up. (GH-16646)
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 d47f0dd2e8)

Co-authored-by: M. Eric Irrgang <mei2n@virginia.edu>
2019-10-10 04:19:03 -07:00
Miss Islington (bot) 7076764992
bpo-28556: Update the opening note in typing docs (GH-16204)
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 81528ba2e8)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2019-09-16 15:11:10 -07:00
Miss Islington (bot) 6ad902a088
bpo-37814: Document the empty tuple type annotation syntax (GH-15208)
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 8a784af750)

Co-authored-by: Josh Holland <anowlcalledjosh@gmail.com>
2019-08-13 12:12:55 -07:00
Miss Islington (bot) fff695b9ab
Document typing.ForwardRef (GH-14216)
(cherry picked from commit 809ff1181c)

Co-authored-by: Ivan Levkivskyi <levkivskyi@gmail.com>
2019-06-18 17:38:43 -07:00
Anthony Sottile b7daabd711 Improve version added references in `typing` module docs (GH-13457) 2019-06-02 01:13:25 +01:00
Ivan Levkivskyi 4c23aff065
bpo-29262: Add get_origin() and get_args() introspection helpers to typing (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.
2019-05-31 00:10:07 +01:00
Ivan Levkivskyi 74d7f76e2c
bpo-37058: PEP 544: Add Protocol to typing module (GH-13585)
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.
2019-05-28 08:40:15 +01:00
Ivan Levkivskyi 135c6a56e5
bpo-37049: PEP 589: Add TypedDict to typing module (GH-13573)
The implementation is straightforward and essentially is just copied from `typing_extensions`.
2019-05-26 09:39:24 +01:00
Ivan Levkivskyi b891c465bb
bpo-37046: PEP 586: Add Literal to typing module (#13572)
The implementation is straightforward and essentially is just copied from `typing_extensions`.
2019-05-26 09:37:48 +01:00
Ivan Levkivskyi f367242d10
bpo-37045: PEP 591: Add final qualifiers to typing module (GH-13571)
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`.
2019-05-26 09:37:07 +01:00
Paul Dagnelie 4c7a46eb3c bpo-36972: Add SupportsIndex (GH-13448)
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.
2019-05-22 15:23:01 +01:00
cocoatomo 9941f963fe Fix wrong indentation of a paragraph in documentation (GH-12868)
This paragraph doesn't seem to be a part of code, but merged into previous code block.
2019-04-18 01:54:51 +01:00
Sebastian Rittau 1e8295402b bpo-35581: Document @typing.type_check_only (GH-11312) 2019-04-12 15:33:40 -07:00
Raymond Hettinger f7b57df0c0 bpo-36320: Switch typing.NamedTuple from OrderedDict to regular dict (GH-12396)
Also,  deprecate the *_field_types* attributes which duplicated the information in *\__annotations__*.


https://bugs.python.org/issue36320
2019-03-18 09:53:56 -07:00
Raymond Hettinger 9c68543f02 Update the seealso entries for namedtuple() (GH-12373)
* 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.
2019-03-16 12:53:23 -07:00
Jack Wilsdon 903567e4f5 Fix the versionadded info for typing.NoReturn (GH-11880)
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)
2019-02-15 11:20:28 -08:00
Ville Skyttä 31ec52a9af bpo-35631: Improve typing docs wrt abstract/concrete collection types (GH-11396)
https://bugs.python.org/issue35631
2019-01-04 14:14:32 +00:00
Boštjan Mejak 284b787612 Add 2 missing commas (GH-10698) 2018-12-23 08:45:51 -08:00
Ismo Toijala 68b56d02ef bpo-35341: Add generic version of OrderedDict to typing (GH-10850) 2018-12-02 15:53:14 +00:00
Sebastian Rittau c8a8d6b347 bpo-35089: Don't mention typing.io and typing.re (GH-10173)
https://bugs.python.org/issue35089
2018-10-28 16:03:29 +00:00
Stéphane Wirtel 12e696b4f0 bpo-35042: Use the :pep: role where a PEP is specified (#10036) 2018-10-26 15:58:26 -07:00
Stéphane Wirtel e483f02423 bpo-35044, doc: Use the :exc: role for the exceptions (GH-10037) 2018-10-26 12:52:11 +02:00
Michael Lee 130717fe58 Clarify that Type[SomeTypeVar] is legal (#9585)
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).
2018-09-26 16:13:28 +01:00
Ville Skyttä 336c945858 bpo-34336: Don't promote possibility to leave out typing.Optional (#8677) 2018-08-05 17:38:04 +01:00
Ivan Levkivskyi 6e413f4327
Document typing.NoReturn (GH-7107) 2018-05-24 21:33:55 -07:00
Ivan Levkivskyi f65e31fee3
bpo-28556: Don't simplify unions at runtime (GH-6841) 2018-05-18 16:00:38 -07:00
Travis DePrato b7b493e2fb Add AsyncContextManager to typing module documentation. (GH-6822) 2018-05-14 18:14:07 -04:00
Sebastian Rittau c3e070f849 bpo-32284: Fix documentation of BinaryIO and TextIO (#4832) 2017-12-13 10:39:55 +02:00
Ivan Levkivskyi 0cd2e81bea bpo-29879: Update typing documentation. (GH-4573)
- Add "version added: 3.5.2" note where it was missing.
- Remove the mention that Reversible is new in 3.5.2
2017-11-26 14:23:02 -08:00
Éric Araujo 03b9537dc5 bpo-31567: more decorator markup fixes in docs (GH-3959) (#3966) 2017-10-12 12:28:55 -04:00
topper-123 039b25d8fd bpo-31564: Update typing documentation (GH-3696)
Mention that ``NewType`` can derive from another ``NewType``.
2017-09-23 19:37:48 -07:00
khyox 6580c19bbb bpo-30619: Clarify typing.Union documentation (GH-2326)
When a class and its subclass are present, the latter is skipped.
2017-06-22 06:14:57 -07:00
Mathias Rav 87c07fe9d9 bpo-29974: Improve typing.TYPE_CHECKING example (GH-982)
* 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.
2017-04-26 13:49:45 +03:00
Jelle Zijlstra 45d22c256b Improvements to typing documentation (#967)
Documents a few omitted classes and adds NamedTuple methods.
2017-04-08 19:09:14 +03:00
Mariatta 36da1c3589 bpo-29481: add versionadded 3.6.1 to typing.Deque docs (#107) 2017-02-15 11:37:18 -08:00
Berker Peksag 5a001eea5b Issue #29198: Merge from 3.5 2017-02-04 09:34:48 +03:00
Berker Peksag 5702fb7b4d Issue #29198: Fix indentation and markup in typing.rst
Patch by Jelle Zijlstra.
2017-02-04 09:34:16 +03:00
Berker Peksag 14169b2a89 Issue #29198: Merge from 3.5 2017-02-04 09:18:42 +03:00