Files
typeshed/stdlib
Stephen Rosen 38d32a916c Use enum trick for dataclasses.MISSING (#7127)
The goal of this change is to fix the behavior of
`dataclasses.Field`. Several attributes of a `Field` may have a value
of `MISSING` (a sentinel value). As a result, attributes of Field may
be checked against `MISSING` as in

     [f for f in fields(obj) if f.default is MISSING]

`default`, `default_factory`, and `kw_only` are the attributes
which may have a value of `MISSING`.

This workaround of defining `_MISSING_TYPE` as an enum, and `MISSING`
as its only member, allows `... | Literal[_MISSING_TYPE.MISSING]` to
be used in type annotations for these attributes. This is very
slightly inaccurate -- primarily in that `_MISSING_TYPE` isn't really
an enum -- but this allows for use in `Literal`.
After PEP 661 (Sentinel Values), there may be a more accurate way of
writing this, but for now this works.

This adjustment is only applied to the attributes of Field, not the
arguments to functions and methods.
2022-02-04 21:21:12 -08:00
..
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-08 16:09:29 +01:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-29 11:36:02 -08:00
2021-05-06 18:57:33 +03:00
2022-01-30 16:27:06 -08:00
2022-01-08 16:09:29 +01:00
2022-01-30 16:27:06 -08:00
2021-12-22 20:18:19 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-08 16:09:29 +01:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2021-12-22 20:18:19 -08:00
2022-01-30 16:27:06 -08:00
2022-01-05 17:58:03 +02:00
2022-01-27 09:04:48 -08:00
2022-02-04 21:19:34 -08:00
2022-02-02 08:37:41 -08:00
2022-01-31 10:46:26 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2021-04-14 19:14:07 -07:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-04 11:12:27 +02:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2021-12-22 20:18:19 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2021-12-22 20:18:19 -08:00
2022-01-30 16:27:06 -08:00
2022-01-25 10:22:56 +01:00
2021-12-22 20:18:19 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-01 14:19:05 +02:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2021-11-27 23:11:53 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-25 12:53:55 +01:00
2022-01-30 16:27:06 -08:00
2022-01-30 16:27:06 -08:00
2022-01-21 08:50:30 -08:00