Skip to content

Commit f292575

Browse files
authored
Merge branch 'main' into overloads
2 parents 67768f4 + f558518 commit f292575

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+305
-137
lines changed

.github/ISSUE_TEMPLATE/documentation-issue.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
name: Documentation issue
3-
about: Report a problem or suggest changes for the documentation at https://typing.readthedocs.io/
3+
about: Report a problem or suggest changes for the documentation at https://typing.python.org/
44
title: ''
55
labels: 'topic: documentation'
66
assignees: ''

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Documentation and Support
44

55
The documentation for Python's static typing can be found at
6-
[typing.readthedocs.io](https://typing.readthedocs.io/). You can get
6+
[typing.python.org](https://typing.python.org/). You can get
77
help in our [support forum](https://github.com/python/typing/discussions).
88

99
Improvements to the type system should be discussed on
@@ -20,10 +20,10 @@ For conversations that are more suitable to a chat platform, you can use one of
2020

2121
This GitHub repository is used for several things:
2222

23-
- The documentation at [typing.readthedocs.io](https://typing.readthedocs.io/)
23+
- The documentation at [typing.python.org](https://typing.python.org/)
2424
is maintained in the [docs directory](./docs). This includes the
25-
[specification](https://typing.readthedocs.io/en/latest/spec/index.html) for the
26-
type system. See especially [the update procedure](https://typing.readthedocs.io/en/latest/spec/meta.html)
25+
[specification](https://typing.python.org/en/latest/spec/index.html) for the
26+
type system. See especially [the update procedure](https://typing.python.org/en/latest/spec/meta.html)
2727
for the spec.
2828

2929
- A [discussion forum](https://github.com/python/typing/discussions) for typing-related user

conformance/README.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,34 @@
22

33
## Motivation
44

5-
[PEP 729](https://peps.python.org/pep-0729/) provides a structured and documented way to specify and evolve the Python type system. In support of this effort, an official [Python typing spec](https://github.com/python/typing/tree/main/docs/spec) has been drafted. This spec consolidates details from various historical typing-related PEPs. The spec will be modified over time to clarify unspecified and under-specified parts of the type system. It will also be extended to cover new features of the type system.
5+
[PEP 729](https://peps.python.org/pep-0729/) provides a structured and documented way to specify and evolve the Python type system. In support of this effort, an official [Python typing spec](https://typing.python.org/en/latest/spec/) has been drafted. This spec consolidates details from various historical typing-related PEPs. The spec will be modified over time to clarify unspecified and under-specified parts of the type system. It will also be extended to cover new features of the type system.
66

77
Accompanying the typing specification is this conformance test suite which validates the behavior of static type checkers against the specification.
88

99
## Structure & Name
1010

1111
This project contains test cases for behaviors defined in the Python typing spec. Tests are structured and grouped in accordance with the specification's chapter headings.
1212

13-
* [concepts](https://typing.readthedocs.io/en/latest/spec/concepts.html)
14-
* [annotations](https://typing.readthedocs.io/en/latest/spec/annotations.html)
15-
* [specialtypes](https://typing.readthedocs.io/en/latest/spec/special-types.html)
16-
* [generics](https://typing.readthedocs.io/en/latest/spec/generics.html)
17-
* [qualifiers](https://typing.readthedocs.io/en/latest/spec/qualifiers.html)
18-
* [classes](https://typing.readthedocs.io/en/latest/spec/class-compat.html)
19-
* [aliases](https://typing.readthedocs.io/en/latest/spec/aliases.html)
20-
* [literals](https://typing.readthedocs.io/en/latest/spec/literal.html)
21-
* [protocols](https://typing.readthedocs.io/en/latest/spec/protocol.html)
22-
* [callables](https://typing.readthedocs.io/en/latest/spec/callables.html)
23-
* [constructors](https://typing.readthedocs.io/en/latest/spec/constructors.html)
24-
* [overloads](https://typing.readthedocs.io/en/latest/spec/overload.html)
25-
* [dataclasses](https://typing.readthedocs.io/en/latest/spec/dataclasses.html)
26-
* [typeddicts](https://typing.readthedocs.io/en/latest/spec/typeddict.html)
27-
* [tuples](https://typing.readthedocs.io/en/latest/spec/tuples.html)
28-
* [namedtuples](https://typing.readthedocs.io/en/latest/spec/namedtuples.html)
29-
* [narrowing](https://typing.readthedocs.io/en/latest/spec/narrowing.html)
30-
* [directives](https://typing.readthedocs.io/en/latest/spec/directives.html)
31-
* [distribution](https://typing.readthedocs.io/en/latest/spec/distributing.html)
32-
* [historical](https://typing.readthedocs.io/en/latest/spec/historical.html)
13+
* [concepts](https://typing.python.org/en/latest/spec/concepts.html)
14+
* [annotations](https://typing.python.org/en/latest/spec/annotations.html)
15+
* [specialtypes](https://typing.python.org/en/latest/spec/special-types.html)
16+
* [generics](https://typing.python.org/en/latest/spec/generics.html)
17+
* [qualifiers](https://typing.python.org/en/latest/spec/qualifiers.html)
18+
* [classes](https://typing.python.org/en/latest/spec/class-compat.html)
19+
* [aliases](https://typing.python.org/en/latest/spec/aliases.html)
20+
* [literals](https://typing.python.org/en/latest/spec/literal.html)
21+
* [protocols](https://typing.python.org/en/latest/spec/protocol.html)
22+
* [callables](https://typing.python.org/en/latest/spec/callables.html)
23+
* [constructors](https://typing.python.org/en/latest/spec/constructors.html)
24+
* [overloads](https://typing.python.org/en/latest/spec/overload.html)
25+
* [dataclasses](https://typing.python.org/en/latest/spec/dataclasses.html)
26+
* [typeddicts](https://typing.python.org/en/latest/spec/typeddict.html)
27+
* [tuples](https://typing.python.org/en/latest/spec/tuples.html)
28+
* [namedtuples](https://typing.python.org/en/latest/spec/namedtuples.html)
29+
* [narrowing](https://typing.python.org/en/latest/spec/narrowing.html)
30+
* [directives](https://typing.python.org/en/latest/spec/directives.html)
31+
* [distribution](https://typing.python.org/en/latest/spec/distributing.html)
32+
* [historical](https://typing.python.org/en/latest/spec/historical.html)
3333

3434
A test file is a ".py" file. The file name should start with one of the above names followed by a description of the test (with words separated by underscores). For example, `generics_paramspec_basic_usage.py` would contain the basic usage tests for `ParamSpec`. Each test file can contain multiple individual unit tests, but these tests should be related to each other. If the number of unit tests in a single test file exceeds ten, it may be desirable to split it into separate test files. This will help maintain a consistent level of granularity across tests.
3535

conformance/results/mypy/callables_kwargs.toml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
conformant = "Pass"
1+
conformant = "Partial"
2+
notes = """
3+
Allows callable without kwargs to be assigned to callable with unpacked kwargs
4+
"""
25
output = """
36
callables_kwargs.py:22: note: "func1" defined here
47
callables_kwargs.py:46: error: Missing named argument "v1" for "func1" [call-arg]
@@ -21,6 +24,7 @@ callables_kwargs.py:103: note: "TDProtocol5.__call__" has type "Callable[[Arg(in
2124
callables_kwargs.py:111: error: Overlap between argument names and ** TypedDict items: "v1" [misc]
2225
callables_kwargs.py:122: error: Unpack item in ** argument must be a TypedDict [misc]
2326
"""
24-
conformance_automated = "Pass"
27+
conformance_automated = "Fail"
2528
errors_diff = """
29+
Line 134: Expected 1 errors
2630
"""

conformance/results/mypy/generics_defaults.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
conformant = "Partial"
22
output = """
33
generics_defaults.py:24: error: "T" cannot appear after "DefaultStrT" in type parameter list because it has no default type [misc]
4-
generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[Any, Any]]", not "type[NoNonDefaults[str, int]]" [assert-type]
5-
generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[Any, Any]]", not "type[NoNonDefaults[str, int]]" [assert-type]
6-
generics_defaults.py:38: error: Expression is of type "type[OneDefault[Any, Any]]", not "type[OneDefault[float, bool]]" [assert-type]
7-
generics_defaults.py:45: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[Any, Any, str, int, bool]]" [assert-type]
8-
generics_defaults.py:46: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
4+
generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[DefaultStrT, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]
5+
generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[str, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]
6+
generics_defaults.py:38: error: Expression is of type "type[OneDefault[float, DefaultBoolT]]", not "type[OneDefault[float, bool]]" [assert-type]
7+
generics_defaults.py:45: error: Expression is of type "type[AllTheDefaults[T1, T2, DefaultStrT, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[Any, Any, str, int, bool]]" [assert-type]
8+
generics_defaults.py:46: error: Expression is of type "type[AllTheDefaults[int, complex, DefaultStrT, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
99
generics_defaults.py:50: error: Type application has too few types (expected between 2 and 5) [misc]
10-
generics_defaults.py:52: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
11-
generics_defaults.py:55: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
12-
generics_defaults.py:59: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
13-
generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[Any]]", not "type[Class_ParamSpec[[str, int]]]" [assert-type]
14-
generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*tuple[Any, ...]]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]
10+
generics_defaults.py:52: error: Expression is of type "type[AllTheDefaults[int, complex, DefaultStrT, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
11+
generics_defaults.py:55: error: Expression is of type "type[AllTheDefaults[int, complex, str, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
12+
generics_defaults.py:59: error: Expression is of type "type[AllTheDefaults[int, complex, str, int, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]
13+
generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[DefaultP]]", not "type[Class_ParamSpec[[str, int]]]" [assert-type]
14+
generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]
1515
generics_defaults.py:151: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]
1616
generics_defaults.py:151: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]
1717
generics_defaults.py:152: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]
@@ -25,16 +25,16 @@ errors_diff = """
2525
Line 104: Expected 1 errors
2626
Line 111: Expected 1 errors
2727
Line 138: Expected 1 errors
28-
Line 30: Unexpected errors ['generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[Any, Any]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
29-
Line 31: Unexpected errors ['generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[Any, Any]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
30-
Line 38: Unexpected errors ['generics_defaults.py:38: error: Expression is of type "type[OneDefault[Any, Any]]", not "type[OneDefault[float, bool]]" [assert-type]']
31-
Line 45: Unexpected errors ['generics_defaults.py:45: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[Any, Any, str, int, bool]]" [assert-type]']
32-
Line 46: Unexpected errors ['generics_defaults.py:46: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
33-
Line 52: Unexpected errors ['generics_defaults.py:52: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
34-
Line 55: Unexpected errors ['generics_defaults.py:55: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
35-
Line 59: Unexpected errors ['generics_defaults.py:59: error: Expression is of type "type[AllTheDefaults[Any, Any, Any, Any, Any]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
36-
Line 79: Unexpected errors ['generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[Any]]", not "type[Class_ParamSpec[[str, int]]]" [assert-type]']
37-
Line 94: Unexpected errors ['generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*tuple[Any, ...]]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]']
28+
Line 30: Unexpected errors ['generics_defaults.py:30: error: Expression is of type "type[NoNonDefaults[DefaultStrT, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
29+
Line 31: Unexpected errors ['generics_defaults.py:31: error: Expression is of type "type[NoNonDefaults[str, DefaultIntT]]", not "type[NoNonDefaults[str, int]]" [assert-type]']
30+
Line 38: Unexpected errors ['generics_defaults.py:38: error: Expression is of type "type[OneDefault[float, DefaultBoolT]]", not "type[OneDefault[float, bool]]" [assert-type]']
31+
Line 45: Unexpected errors ['generics_defaults.py:45: error: Expression is of type "type[AllTheDefaults[T1, T2, DefaultStrT, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[Any, Any, str, int, bool]]" [assert-type]']
32+
Line 46: Unexpected errors ['generics_defaults.py:46: error: Expression is of type "type[AllTheDefaults[int, complex, DefaultStrT, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
33+
Line 52: Unexpected errors ['generics_defaults.py:52: error: Expression is of type "type[AllTheDefaults[int, complex, DefaultStrT, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
34+
Line 55: Unexpected errors ['generics_defaults.py:55: error: Expression is of type "type[AllTheDefaults[int, complex, str, DefaultIntT, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
35+
Line 59: Unexpected errors ['generics_defaults.py:59: error: Expression is of type "type[AllTheDefaults[int, complex, str, int, DefaultBoolT]]", not "type[AllTheDefaults[int, complex, str, int, bool]]" [assert-type]']
36+
Line 79: Unexpected errors ['generics_defaults.py:79: error: Expression is of type "type[Class_ParamSpec[DefaultP]]", not "type[Class_ParamSpec[[str, int]]]" [assert-type]']
37+
Line 94: Unexpected errors ['generics_defaults.py:94: error: Expression is of type "type[Class_TypeVarTuple[*DefaultTs]]", not "type[Class_TypeVarTuple[str, int]]" [assert-type]']
3838
Line 151: Unexpected errors ['generics_defaults.py:151: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [float, bool]]]" [assert-type]', 'generics_defaults.py:151: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
3939
Line 152: Unexpected errors ['generics_defaults.py:152: error: Expression is of type "type[Foo6[*tuple[Any, ...], Any]]", not "type[Foo6[int, str, [bytes]]]" [assert-type]', 'generics_defaults.py:152: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "str" [misc]']
4040
Line 166: Unexpected errors ['generics_defaults.py:166: error: Expression is of type "Callable[[Self], Self]", not "Callable[[Foo7[int]], Foo7[int]]" [assert-type]']
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
conformant = "Partial"
22
output = """
3-
generics_defaults_referential.py:23: error: Expression is of type "type[slice[Any, Any, Any]]", not "type[slice[int, int, int | None]]" [assert-type]
3+
generics_defaults_referential.py:23: error: Expression is of type "type[slice[StartT, StopT, StepT]]", not "type[slice[int, int, int | None]]" [assert-type]
44
generics_defaults_referential.py:37: error: Argument 1 to "Foo" has incompatible type "str"; expected "int" [arg-type]
55
generics_defaults_referential.py:53: error: Type parameter "Start2T" has a default type that refers to one or more type variables that are out of scope [misc]
6-
generics_defaults_referential.py:94: error: Expression is of type "type[Bar[Any, Any]]", not "type[Bar[Any, list[Any]]]" [assert-type]
7-
generics_defaults_referential.py:95: error: Expression is of type "type[Bar[Any, Any]]", not "type[Bar[int, list[int]]]" [assert-type]
6+
generics_defaults_referential.py:94: error: Expression is of type "type[Bar[Z1, ListDefaultT]]", not "type[Bar[Any, list[Any]]]" [assert-type]
7+
generics_defaults_referential.py:95: error: Expression is of type "type[Bar[int, ListDefaultT]]", not "type[Bar[int, list[int]]]" [assert-type]
88
generics_defaults_referential.py:96: error: Expression is of type "Bar[int, list[Never]]", not "Bar[int, list[int]]" [assert-type]
99
"""
1010
conformance_automated = "Fail"
@@ -14,8 +14,8 @@ Line 60: Expected 1 errors
1414
Line 68: Expected 1 errors
1515
Line 74: Expected 1 errors
1616
Line 78: Expected 1 errors
17-
Line 23: Unexpected errors ['generics_defaults_referential.py:23: error: Expression is of type "type[slice[Any, Any, Any]]", not "type[slice[int, int, int | None]]" [assert-type]']
18-
Line 94: Unexpected errors ['generics_defaults_referential.py:94: error: Expression is of type "type[Bar[Any, Any]]", not "type[Bar[Any, list[Any]]]" [assert-type]']
19-
Line 95: Unexpected errors ['generics_defaults_referential.py:95: error: Expression is of type "type[Bar[Any, Any]]", not "type[Bar[int, list[int]]]" [assert-type]']
17+
Line 23: Unexpected errors ['generics_defaults_referential.py:23: error: Expression is of type "type[slice[StartT, StopT, StepT]]", not "type[slice[int, int, int | None]]" [assert-type]']
18+
Line 94: Unexpected errors ['generics_defaults_referential.py:94: error: Expression is of type "type[Bar[Z1, ListDefaultT]]", not "type[Bar[Any, list[Any]]]" [assert-type]']
19+
Line 95: Unexpected errors ['generics_defaults_referential.py:95: error: Expression is of type "type[Bar[int, ListDefaultT]]", not "type[Bar[int, list[int]]]" [assert-type]']
2020
Line 96: Unexpected errors ['generics_defaults_referential.py:96: error: Expression is of type "Bar[int, list[Never]]", not "Bar[int, list[int]]" [assert-type]']
2121
"""
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
conformant = "Partial"
22
output = """
33
generics_defaults_specialization.py:30: error: Bad number of arguments for type alias, expected between 0 and 1, given 2 [type-arg]
4-
generics_defaults_specialization.py:45: error: Expression is of type "type[Bar[Any]]", not "type[Bar[str]]" [assert-type]
4+
generics_defaults_specialization.py:45: error: Expression is of type "type[Bar[DefaultStrT]]", not "type[Bar[str]]" [assert-type]
55
generics_defaults_specialization.py:55: error: The type "type[Foo]" is not generic and not indexable [misc]
66
"""
77
conformance_automated = "Fail"
88
errors_diff = """
9-
Line 45: Unexpected errors ['generics_defaults_specialization.py:45: error: Expression is of type "type[Bar[Any]]", not "type[Bar[str]]" [assert-type]']
9+
Line 45: Unexpected errors ['generics_defaults_specialization.py:45: error: Expression is of type "type[Bar[DefaultStrT]]", not "type[Bar[str]]" [assert-type]']
1010
"""

0 commit comments

Comments
 (0)