Skip to content

Commit

Permalink
Merge branch 'main' into overloads
Browse files Browse the repository at this point in the history
* main: (29 commits)
  Updated conformance test results for the latest versions of type chec… (python#1904)
  Add content from typeshed/CONTRIBUTING.md (python#1882)
  Fix markup in generics specification (python#1900)
  Specs clarification: Forbid `ClassVar` and `Final` within `TypedDict` body (python#1890)
  Remove paragraph mentioning minor edits through the mailing list (python#1891)
  Writing Stubs: Add "Overloads and Flags" section (python#1894)
  Fix a typo (python#1893)
  Update conformance tests for recent generics spec change (python#1892)
  Clarify some behavior around user-defined generic classes (python#1879)
  Modernizing guide: Mention TypeGuard/TypeIs (python#1887)
  Tools can perform "some" refactorings (python#1886)
  Mention use of cast in enum type stub example (python#1877)
  Update conformance results after new pyre release (python#1878)
  Add a label for typed dictionaries class-based syntax (python#1873)
  Add missing return type to generic_syntax_infer_variance.py (python#1871)
  Updated conformance results for mypy 1.13 and pyright 1.1.386 (python#1870)
  Modernizing guide: also mention `com2ann` (python#1869)
  Suggest `pyupgrade` or `ruff` for modernizing superseded typing features (python#1868)
  Updated conformance results for pyright 1.1.385. (python#1867)
  Updated conformance results for mypy 1.12. (python#1866)
  ...
  • Loading branch information
carljm committed Jan 8, 2025
2 parents e13dbbe + e523717 commit eed0815
Show file tree
Hide file tree
Showing 342 changed files with 9,966 additions and 4,540 deletions.
3 changes: 2 additions & 1 deletion conformance/results/mypy/aliases_explicit.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ aliases_explicit.py:79: error: Invalid type alias: expression is not a valid typ
aliases_explicit.py:80: error: Bracketed expression "[...]" is not valid as a type [valid-type]
aliases_explicit.py:81: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_explicit.py:82: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_explicit.py:83: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_explicit.py:83: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
aliases_explicit.py:83: error: Name "b" is not defined [name-defined]
aliases_explicit.py:84: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_explicit.py:85: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_explicit.py:86: error: Invalid type alias: expression is not a valid type [valid-type]
Expand Down
33 changes: 14 additions & 19 deletions conformance/results/mypy/aliases_type_statement.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
conformant = "Partial"
notes = """
Does not reject use of TypeAliasType as base class.
Does not reject redefinition of type alias defined with type statement.
Does not reject type alias defined in function scope.
Does not reject type alias with circular definition.
"""
output = """
aliases_type_statement.py:17: error: "TypeAliasType" has no attribute "bit_count" [attr-defined]
aliases_type_statement.py:19: error: "TypeAliasType" not callable [operator]
aliases_type_statement.py:23: error: "TypeAliasType" has no attribute "other_attrib" [attr-defined]
aliases_type_statement.py:26: error: Type alias defined using "type" statement not valid as base class [misc]
aliases_type_statement.py:31: error: Parameterized generics cannot be used with class or instance checks [misc]
aliases_type_statement.py:31: error: Argument 2 to "isinstance" has incompatible type "TypeAliasType"; expected "_ClassInfo" [arg-type]
aliases_type_statement.py:37: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:38: error: Bracketed expression "[...]" is not valid as a type [valid-type]
aliases_type_statement.py:39: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:40: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:41: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:41: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
aliases_type_statement.py:41: error: Name "b" is not defined [name-defined]
aliases_type_statement.py:42: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:43: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:44: error: Invalid type alias: expression is not a valid type [valid-type]
Expand All @@ -25,22 +24,18 @@ aliases_type_statement.py:46: error: Invalid type: try using Literal[True] inste
aliases_type_statement.py:47: error: Invalid type: try using Literal[1] instead? [valid-type]
aliases_type_statement.py:48: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:49: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_type_statement.py:54: error: Name "BadTypeAlias14" already defined on line 52 [no-redef]
aliases_type_statement.py:64: error: All type parameters should be declared ("V" not declared) [valid-type]
aliases_type_statement.py:69: error: All type parameters should be declared ("T1" not declared) [valid-type]
aliases_type_statement.py:79: error: Type argument "str" of "RecursiveTypeAlias2" must be a subtype of "int" [type-var]
aliases_type_statement.py:81: error: Type argument "int" of "RecursiveTypeAlias2" must be a subtype of "str" [type-var]
aliases_type_statement.py:84: error: Cannot resolve name "RecursiveTypeAlias3" (possible cyclic definition) [misc]
aliases_type_statement.py:86: error: Invalid recursive alias: a union item of itself [misc]
aliases_type_statement.py:90: error: Cannot resolve name "RecursiveTypeAlias6" (possible cyclic definition) [misc]
aliases_type_statement.py:90: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
aliases_type_statement.py:91: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
aliases_type_statement.py:52: error: Name "BadTypeAlias14" already defined on line 51 [no-redef]
aliases_type_statement.py:62: error: All type parameters should be declared ("V" not declared) [valid-type]
aliases_type_statement.py:67: error: All type parameters should be declared ("T1" not declared) [valid-type]
aliases_type_statement.py:77: error: Type argument "str" of "RecursiveTypeAlias2" must be a subtype of "int" [type-var]
aliases_type_statement.py:79: error: Type argument "int" of "RecursiveTypeAlias2" must be a subtype of "str" [type-var]
aliases_type_statement.py:82: error: Cannot resolve name "RecursiveTypeAlias3" (possible cyclic definition) [misc]
aliases_type_statement.py:84: error: Invalid recursive alias: a union item of itself [misc]
aliases_type_statement.py:88: error: Cannot resolve name "RecursiveTypeAlias6" (possible cyclic definition) [misc]
aliases_type_statement.py:88: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
aliases_type_statement.py:89: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]
"""
conformance_automated = "Fail"
errors_diff = """
Line 26: Expected 1 errors
Line 52: Expected 1 errors
Line 58: Expected 1 errors
Line 54: Unexpected errors ['aliases_type_statement.py:54: error: Name "BadTypeAlias14" already defined on line 52 [no-redef]']
Line 91: Unexpected errors ['aliases_type_statement.py:91: error: Cannot resolve name "RecursiveTypeAlias7" (possible cyclic definition) [misc]']
Line 56: Expected 1 errors
"""
3 changes: 2 additions & 1 deletion conformance/results/mypy/aliases_typealiastype.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ aliases_typealiastype.py:52: error: Invalid type alias: expression is not a vali
aliases_typealiastype.py:53: error: Bracketed expression "[...]" is not valid as a type [valid-type]
aliases_typealiastype.py:54: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_typealiastype.py:55: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_typealiastype.py:56: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_typealiastype.py:56: error: Inline TypedDict is experimental, must be enabled with --enable-incomplete-feature=InlineTypedDict [misc]
aliases_typealiastype.py:56: error: Name "b" is not defined [name-defined]
aliases_typealiastype.py:57: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_typealiastype.py:58: error: Invalid type alias: expression is not a valid type [valid-type]
aliases_typealiastype.py:59: error: Invalid type alias: expression is not a valid type [valid-type]
Expand Down
11 changes: 5 additions & 6 deletions conformance/results/mypy/annotations_forward_refs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@ Incorrectly generates error for quoted type defined in class scope.
"""
output = """
annotations_forward_refs.py:41: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:42: error: Bracketed expression "[...]" is not valid as a type [valid-type]
annotations_forward_refs.py:43: error: Syntax error in type annotation [syntax]
annotations_forward_refs.py:43: note: Suggestion: Use Tuple[T1, ..., Tn] instead of (T1, ..., Tn)
annotations_forward_refs.py:42: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:43: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:44: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:45: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:46: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:47: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:48: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:49: error: Variable "annotations_forward_refs.var1" is not valid as a type [valid-type]
annotations_forward_refs.py:49: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
annotations_forward_refs.py:50: error: Invalid type: try using Literal[True] instead? [valid-type]
annotations_forward_refs.py:51: error: Invalid type: try using Literal[1] instead? [valid-type]
annotations_forward_refs.py:52: error: Invalid type: try using Literal[-1] instead? [valid-type]
annotations_forward_refs.py:50: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:51: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:52: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:53: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:54: error: Invalid type comment or annotation [valid-type]
annotations_forward_refs.py:55: error: Module "types" is not valid as a type [valid-type]
Expand Down
31 changes: 14 additions & 17 deletions conformance/results/mypy/directives_deprecated.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
conformant = "Unsupported"
notes = """
Does not support @deprecated.
"""
conformance_automated = "Fail"
conformant = "Pass"
conformance_automated = "Pass"
errors_diff = """
Line 18: Expected 1 errors
Line 24: Expected 1 errors
Line 25: Expected 1 errors
Line 30: Expected 1 errors
Line 41: Expected 1 errors
Line 42: Expected 1 errors
Line 44: Expected 1 errors
Line 47: Expected 1 errors
Line 48: Expected 1 errors
Line 58: Expected 1 errors
Line 69: Expected 1 errors
Line 98: Expected 1 errors
"""
output = """
directives_deprecated.py:18: error: class _directives_deprecated_library.Ham is deprecated: Use Spam instead [deprecated]
directives_deprecated.py:24: error: function _directives_deprecated_library.norwegian_blue is deprecated: It is pining for the fjords [deprecated]
directives_deprecated.py:25: error: function _directives_deprecated_library.norwegian_blue is deprecated: It is pining for the fjords [deprecated]
directives_deprecated.py:30: error: overload def (x: builtins.int) -> builtins.str of function _directives_deprecated_library.foo is deprecated: Only str will be allowed [deprecated]
directives_deprecated.py:41: error: function _directives_deprecated_library.Spam.__add__ is deprecated: There is enough spam in the world [deprecated]
directives_deprecated.py:42: error: function _directives_deprecated_library.Spam.__add__ is deprecated: There is enough spam in the world [deprecated]
directives_deprecated.py:44: error: function _directives_deprecated_library.Spam.greasy is deprecated: All spam will be equally greasy [deprecated]
directives_deprecated.py:47: error: function _directives_deprecated_library.Spam.shape is deprecated: Shapes are becoming immutable [deprecated]
directives_deprecated.py:48: error: function _directives_deprecated_library.Spam.shape is deprecated: Shapes are becoming immutable [deprecated]
directives_deprecated.py:58: error: function directives_deprecated.Invocable.__call__ is deprecated: Deprecated [deprecated]
directives_deprecated.py:69: error: function directives_deprecated.lorem is deprecated: Deprecated [deprecated]
directives_deprecated.py:98: error: function directives_deprecated.SupportsFoo1.foo is deprecated: Deprecated [deprecated]
"""
4 changes: 2 additions & 2 deletions conformance/results/mypy/enums_members.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
conformant = "Partial"
notes = """
Does not treat attribute with annotation and no assignment as non-member.
Does not reject use of annotation with enum member.
Does not treat callables as non-members.
Does not honor `enum.member` as method decorator.
Does not properly handle aliased enum members.
Expand All @@ -10,7 +9,6 @@ Does not treat attributes with private names as non-members.
"""
conformance_automated = "Fail"
errors_diff = """
Line 50: Expected 1 errors
Line 82: Expected 1 errors
Line 83: Expected 1 errors
Line 129: Expected 1 errors
Expand All @@ -26,6 +24,8 @@ enums_members.py:27: error: Expression is of type "Literal[Pet.genus]", not "str
enums_members.py:28: error: Expression is of type "Literal[Pet.species]", not "str" [assert-type]
enums_members.py:35: error: Expression is of type "Literal[Pet2.genus]", not "str" [assert-type]
enums_members.py:36: error: Expression is of type "Literal[Pet2.species]", not "str" [assert-type]
enums_members.py:50: error: Enum members must be left unannotated [misc]
enums_members.py:50: note: See https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members
enums_members.py:84: error: Expression is of type "Callable[[Pet4], str]", not "Any" [assert-type]
enums_members.py:84: error: Parameter 1 of Literal[...] is invalid [valid-type]
enums_members.py:85: error: Expression is of type "Callable[[Pet4], None]", not "Any" [assert-type]
Expand Down
8 changes: 6 additions & 2 deletions conformance/results/mypy/generics_base_class.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
conformant = "Pass"
conformant = "Partial"
notes = """
Does not detect inconsistent type variable ordering.
"""
output = """
generics_base_class.py:26: error: Argument 1 to "takes_dict_incorrect" has incompatible type "SymbolTable"; expected "dict[str, list[object]]" [arg-type]
generics_base_class.py:29: error: Variable "typing.Generic" is not valid as a type [valid-type]
Expand All @@ -9,6 +12,7 @@ generics_base_class.py:49: error: "LinkedList" expects 1 type argument, but 2 gi
generics_base_class.py:61: error: "MyDict" expects 1 type argument, but 2 given [type-arg]
generics_base_class.py:68: error: Duplicate type variables in Generic[...] or Protocol[...] [misc]
"""
conformance_automated = "Pass"
conformance_automated = "Fail"
errors_diff = """
Line 98: Expected 1 errors
"""
21 changes: 11 additions & 10 deletions conformance/results/mypy/generics_basic.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
conformant = "Partial"
notes = """
Does not reject the use of a constraint parameterized by another type variable.
"""
conformant = "Pass"
output = """
generics_basic.py:40: error: Value of type variable "AnyStr" of "concat" cannot be "Sequence[object]" [type-var]
generics_basic.py:41: error: Value of type variable "AnyStr" of "concat" cannot be "Sequence[object]" [type-var]
generics_basic.py:49: error: Type variable must have at least two constrained types [misc]
generics_basic.py:55: error: TypeVar constraint type cannot be parametrized by type variables [misc]
generics_basic.py:69: error: Value of type variable "AnyStr" of "concat" cannot be "Sequence[object]" [type-var]
generics_basic.py:121: error: Duplicate type variables in Generic[...] or Protocol[...] [misc]
generics_basic.py:157: error: Invalid index type "int" for "MyMap1[str, int]"; expected type "str" [index]
generics_basic.py:158: error: Invalid index type "int" for "MyMap2[int, str]"; expected type "str" [index]
generics_basic.py:191: error: Dynamic metaclass not supported for "GenericMetaInstance" [misc]
generics_basic.py:191: error: Type variable "generics_basic.T" is unbound [valid-type]
generics_basic.py:191: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_basic.py:191: note: (Hint: Use "T" in function signature to bind "T" inside a function)
generics_basic.py:162: error: Free type variable expected in Generic[...] [misc]
generics_basic.py:163: error: Free type variable expected in Protocol[...] [misc]
generics_basic.py:171: error: If Generic[...] or Protocol[...] is present it should list all type variables [misc]
generics_basic.py:172: error: If Generic[...] or Protocol[...] is present it should list all type variables [misc]
generics_basic.py:208: error: Dynamic metaclass not supported for "GenericMetaInstance" [misc]
generics_basic.py:208: error: Type variable "generics_basic.T" is unbound [valid-type]
generics_basic.py:208: note: (Hint: Use "Generic[T]" or "Protocol[T]" base class to bind "T" inside a class)
generics_basic.py:208: note: (Hint: Use "T" in function signature to bind "T" inside a function)
"""
conformance_automated = "Fail"
conformance_automated = "Pass"
errors_diff = """
Line 55: Expected 1 errors
"""
Loading

0 comments on commit eed0815

Please sign in to comment.