├── .editorconfig ├── .flake8 ├── .github ├── ISSUE_TEMPLATE │ ├── documentation-issue.md │ ├── new-typing-feature.md │ └── other-issue.md ├── dependabot.yml └── workflows │ ├── build-docs.yml │ └── ci.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .readthedocs.yaml ├── LICENSE ├── README.md ├── conformance ├── .gitignore ├── README.md ├── requirements.txt ├── results │ ├── mypy │ │ ├── aliases_explicit.toml │ │ ├── aliases_implicit.toml │ │ ├── aliases_newtype.toml │ │ ├── aliases_recursive.toml │ │ ├── aliases_type_statement.toml │ │ ├── aliases_typealiastype.toml │ │ ├── aliases_variance.toml │ │ ├── annotations_coroutines.toml │ │ ├── annotations_forward_refs.toml │ │ ├── annotations_generators.toml │ │ ├── annotations_methods.toml │ │ ├── annotations_typeexpr.toml │ │ ├── callables_annotation.toml │ │ ├── callables_kwargs.toml │ │ ├── callables_protocol.toml │ │ ├── callables_subtyping.toml │ │ ├── classes_classvar.toml │ │ ├── classes_override.toml │ │ ├── constructors_call_init.toml │ │ ├── constructors_call_metaclass.toml │ │ ├── constructors_call_new.toml │ │ ├── constructors_call_type.toml │ │ ├── constructors_callable.toml │ │ ├── constructors_consistency.toml │ │ ├── dataclasses_descriptors.toml │ │ ├── dataclasses_final.toml │ │ ├── dataclasses_frozen.toml │ │ ├── dataclasses_hash.toml │ │ ├── dataclasses_inheritance.toml │ │ ├── dataclasses_kwonly.toml │ │ ├── dataclasses_order.toml │ │ ├── dataclasses_postinit.toml │ │ ├── dataclasses_slots.toml │ │ ├── dataclasses_transform_class.toml │ │ ├── dataclasses_transform_converter.toml │ │ ├── dataclasses_transform_field.toml │ │ ├── dataclasses_transform_func.toml │ │ ├── dataclasses_transform_meta.toml │ │ ├── dataclasses_usage.toml │ │ ├── directives_assert_type.toml │ │ ├── directives_cast.toml │ │ ├── directives_deprecated.toml │ │ ├── directives_no_type_check.toml │ │ ├── directives_reveal_type.toml │ │ ├── directives_type_checking.toml │ │ ├── directives_type_ignore.toml │ │ ├── directives_type_ignore_file1.toml │ │ ├── directives_type_ignore_file2.toml │ │ ├── directives_version_platform.toml │ │ ├── enums_behaviors.toml │ │ ├── enums_definition.toml │ │ ├── enums_expansion.toml │ │ ├── enums_member_names.toml │ │ ├── enums_member_values.toml │ │ ├── enums_members.toml │ │ ├── exceptions_context_managers.toml │ │ ├── generics_base_class.toml │ │ ├── generics_basic.toml │ │ ├── generics_defaults.toml │ │ ├── generics_defaults_referential.toml │ │ ├── generics_defaults_specialization.toml │ │ ├── generics_paramspec_basic.toml │ │ ├── generics_paramspec_components.toml │ │ ├── generics_paramspec_semantics.toml │ │ ├── generics_paramspec_specialization.toml │ │ ├── generics_scoping.toml │ │ ├── generics_self_advanced.toml │ │ ├── generics_self_attributes.toml │ │ ├── generics_self_basic.toml │ │ ├── generics_self_protocols.toml │ │ ├── generics_self_usage.toml │ │ ├── generics_syntax_compatibility.toml │ │ ├── generics_syntax_declarations.toml │ │ ├── generics_syntax_infer_variance.toml │ │ ├── generics_syntax_scoping.toml │ │ ├── generics_type_erasure.toml │ │ ├── generics_typevartuple_args.toml │ │ ├── generics_typevartuple_basic.toml │ │ ├── generics_typevartuple_callable.toml │ │ ├── generics_typevartuple_concat.toml │ │ ├── generics_typevartuple_overloads.toml │ │ ├── generics_typevartuple_specialization.toml │ │ ├── generics_typevartuple_unpack.toml │ │ ├── generics_upper_bound.toml │ │ ├── generics_variance.toml │ │ ├── generics_variance_inference.toml │ │ ├── historical_positional.toml │ │ ├── literals_interactions.toml │ │ ├── literals_literalstring.toml │ │ ├── literals_parameterizations.toml │ │ ├── literals_semantics.toml │ │ ├── namedtuples_define_class.toml │ │ ├── namedtuples_define_functional.toml │ │ ├── namedtuples_type_compat.toml │ │ ├── namedtuples_usage.toml │ │ ├── narrowing_typeguard.toml │ │ ├── narrowing_typeis.toml │ │ ├── overloads_basic.toml │ │ ├── overloads_consistency.toml │ │ ├── overloads_definitions.toml │ │ ├── overloads_definitions_stub.toml │ │ ├── overloads_evaluation.toml │ │ ├── protocols_class_objects.toml │ │ ├── protocols_definition.toml │ │ ├── protocols_explicit.toml │ │ ├── protocols_generic.toml │ │ ├── protocols_merging.toml │ │ ├── protocols_modules.toml │ │ ├── protocols_recursive.toml │ │ ├── protocols_runtime_checkable.toml │ │ ├── protocols_self.toml │ │ ├── protocols_subtyping.toml │ │ ├── protocols_variance.toml │ │ ├── qualifiers_annotated.toml │ │ ├── qualifiers_final_annotation.toml │ │ ├── qualifiers_final_decorator.toml │ │ ├── specialtypes_any.toml │ │ ├── specialtypes_never.toml │ │ ├── specialtypes_none.toml │ │ ├── specialtypes_promotions.toml │ │ ├── specialtypes_type.toml │ │ ├── tuples_type_compat.toml │ │ ├── tuples_type_form.toml │ │ ├── tuples_unpacked.toml │ │ ├── typeddicts_alt_syntax.toml │ │ ├── typeddicts_class_syntax.toml │ │ ├── typeddicts_final.toml │ │ ├── typeddicts_inheritance.toml │ │ ├── typeddicts_operations.toml │ │ ├── typeddicts_readonly.toml │ │ ├── typeddicts_readonly_consistency.toml │ │ ├── typeddicts_readonly_inheritance.toml │ │ ├── typeddicts_readonly_kwargs.toml │ │ ├── typeddicts_readonly_update.toml │ │ ├── typeddicts_required.toml │ │ ├── typeddicts_type_consistency.toml │ │ ├── typeddicts_usage.toml │ │ └── version.toml │ ├── pyre │ │ ├── aliases_explicit.toml │ │ ├── aliases_implicit.toml │ │ ├── aliases_newtype.toml │ │ ├── aliases_recursive.toml │ │ ├── aliases_type_statement.toml │ │ ├── aliases_typealiastype.toml │ │ ├── aliases_variance.toml │ │ ├── annotations_coroutines.toml │ │ ├── annotations_forward_refs.toml │ │ ├── annotations_generators.toml │ │ ├── annotations_methods.toml │ │ ├── annotations_typeexpr.toml │ │ ├── callables_annotation.toml │ │ ├── callables_kwargs.toml │ │ ├── callables_protocol.toml │ │ ├── callables_subtyping.toml │ │ ├── classes_classvar.toml │ │ ├── classes_override.toml │ │ ├── constructors_call_init.toml │ │ ├── constructors_call_metaclass.toml │ │ ├── constructors_call_new.toml │ │ ├── constructors_call_type.toml │ │ ├── constructors_callable.toml │ │ ├── constructors_consistency.toml │ │ ├── dataclasses_descriptors.toml │ │ ├── dataclasses_final.toml │ │ ├── dataclasses_frozen.toml │ │ ├── dataclasses_hash.toml │ │ ├── dataclasses_inheritance.toml │ │ ├── dataclasses_kwonly.toml │ │ ├── dataclasses_order.toml │ │ ├── dataclasses_postinit.toml │ │ ├── dataclasses_slots.toml │ │ ├── dataclasses_transform_class.toml │ │ ├── dataclasses_transform_converter.toml │ │ ├── dataclasses_transform_field.toml │ │ ├── dataclasses_transform_func.toml │ │ ├── dataclasses_transform_meta.toml │ │ ├── dataclasses_usage.toml │ │ ├── directives_assert_type.toml │ │ ├── directives_cast.toml │ │ ├── directives_deprecated.toml │ │ ├── directives_no_type_check.toml │ │ ├── directives_reveal_type.toml │ │ ├── directives_type_checking.toml │ │ ├── directives_type_ignore.toml │ │ ├── directives_type_ignore_file1.toml │ │ ├── directives_type_ignore_file2.toml │ │ ├── directives_version_platform.toml │ │ ├── enums_behaviors.toml │ │ ├── enums_definition.toml │ │ ├── enums_expansion.toml │ │ ├── enums_member_names.toml │ │ ├── enums_member_values.toml │ │ ├── enums_members.toml │ │ ├── exceptions_context_managers.toml │ │ ├── generics_base_class.toml │ │ ├── generics_basic.toml │ │ ├── generics_defaults.toml │ │ ├── generics_defaults_referential.toml │ │ ├── generics_defaults_specialization.toml │ │ ├── generics_paramspec_basic.toml │ │ ├── generics_paramspec_components.toml │ │ ├── generics_paramspec_semantics.toml │ │ ├── generics_paramspec_specialization.toml │ │ ├── generics_scoping.toml │ │ ├── generics_self_advanced.toml │ │ ├── generics_self_attributes.toml │ │ ├── generics_self_basic.toml │ │ ├── generics_self_protocols.toml │ │ ├── generics_self_usage.toml │ │ ├── generics_syntax_compatibility.toml │ │ ├── generics_syntax_declarations.toml │ │ ├── generics_syntax_infer_variance.toml │ │ ├── generics_syntax_scoping.toml │ │ ├── generics_type_erasure.toml │ │ ├── generics_typevartuple_args.toml │ │ ├── generics_typevartuple_basic.toml │ │ ├── generics_typevartuple_callable.toml │ │ ├── generics_typevartuple_concat.toml │ │ ├── generics_typevartuple_overloads.toml │ │ ├── generics_typevartuple_specialization.toml │ │ ├── generics_typevartuple_unpack.toml │ │ ├── generics_upper_bound.toml │ │ ├── generics_variance.toml │ │ ├── generics_variance_inference.toml │ │ ├── historical_positional.toml │ │ ├── literals_interactions.toml │ │ ├── literals_literalstring.toml │ │ ├── literals_parameterizations.toml │ │ ├── literals_semantics.toml │ │ ├── namedtuples_define_class.toml │ │ ├── namedtuples_define_functional.toml │ │ ├── namedtuples_type_compat.toml │ │ ├── namedtuples_usage.toml │ │ ├── narrowing_typeguard.toml │ │ ├── narrowing_typeis.toml │ │ ├── overloads_basic.toml │ │ ├── overloads_consistency.toml │ │ ├── overloads_definitions.toml │ │ ├── overloads_definitions_stub.toml │ │ ├── overloads_evaluation.toml │ │ ├── protocols_class_objects.toml │ │ ├── protocols_definition.toml │ │ ├── protocols_explicit.toml │ │ ├── protocols_generic.toml │ │ ├── protocols_merging.toml │ │ ├── protocols_modules.toml │ │ ├── protocols_recursive.toml │ │ ├── protocols_runtime_checkable.toml │ │ ├── protocols_self.toml │ │ ├── protocols_subtyping.toml │ │ ├── protocols_variance.toml │ │ ├── qualifiers_annotated.toml │ │ ├── qualifiers_final_annotation.toml │ │ ├── qualifiers_final_decorator.toml │ │ ├── specialtypes_any.toml │ │ ├── specialtypes_never.toml │ │ ├── specialtypes_none.toml │ │ ├── specialtypes_promotions.toml │ │ ├── specialtypes_type.toml │ │ ├── tuples_type_compat.toml │ │ ├── tuples_type_form.toml │ │ ├── tuples_unpacked.toml │ │ ├── typeddicts_alt_syntax.toml │ │ ├── typeddicts_class_syntax.toml │ │ ├── typeddicts_final.toml │ │ ├── typeddicts_inheritance.toml │ │ ├── typeddicts_operations.toml │ │ ├── typeddicts_readonly.toml │ │ ├── typeddicts_readonly_consistency.toml │ │ ├── typeddicts_readonly_inheritance.toml │ │ ├── typeddicts_readonly_kwargs.toml │ │ ├── typeddicts_readonly_update.toml │ │ ├── typeddicts_required.toml │ │ ├── typeddicts_type_consistency.toml │ │ ├── typeddicts_usage.toml │ │ └── version.toml │ ├── pyright │ │ ├── aliases_explicit.toml │ │ ├── aliases_implicit.toml │ │ ├── aliases_newtype.toml │ │ ├── aliases_recursive.toml │ │ ├── aliases_type_statement.toml │ │ ├── aliases_typealiastype.toml │ │ ├── aliases_variance.toml │ │ ├── annotations_coroutines.toml │ │ ├── annotations_forward_refs.toml │ │ ├── annotations_generators.toml │ │ ├── annotations_methods.toml │ │ ├── annotations_typeexpr.toml │ │ ├── callables_annotation.toml │ │ ├── callables_kwargs.toml │ │ ├── callables_protocol.toml │ │ ├── callables_subtyping.toml │ │ ├── classes_classvar.toml │ │ ├── classes_override.toml │ │ ├── constructors_call_init.toml │ │ ├── constructors_call_metaclass.toml │ │ ├── constructors_call_new.toml │ │ ├── constructors_call_type.toml │ │ ├── constructors_callable.toml │ │ ├── constructors_consistency.toml │ │ ├── dataclasses_descriptors.toml │ │ ├── dataclasses_final.toml │ │ ├── dataclasses_frozen.toml │ │ ├── dataclasses_hash.toml │ │ ├── dataclasses_inheritance.toml │ │ ├── dataclasses_kwonly.toml │ │ ├── dataclasses_order.toml │ │ ├── dataclasses_postinit.toml │ │ ├── dataclasses_slots.toml │ │ ├── dataclasses_transform_class.toml │ │ ├── dataclasses_transform_converter.toml │ │ ├── dataclasses_transform_field.toml │ │ ├── dataclasses_transform_func.toml │ │ ├── dataclasses_transform_meta.toml │ │ ├── dataclasses_usage.toml │ │ ├── directives_assert_type.toml │ │ ├── directives_cast.toml │ │ ├── directives_deprecated.toml │ │ ├── directives_no_type_check.toml │ │ ├── directives_reveal_type.toml │ │ ├── directives_type_checking.toml │ │ ├── directives_type_ignore.toml │ │ ├── directives_type_ignore_file1.toml │ │ ├── directives_type_ignore_file2.toml │ │ ├── directives_version_platform.toml │ │ ├── enums_behaviors.toml │ │ ├── enums_definition.toml │ │ ├── enums_expansion.toml │ │ ├── enums_member_names.toml │ │ ├── enums_member_values.toml │ │ ├── enums_members.toml │ │ ├── exceptions_context_managers.toml │ │ ├── generics_base_class.toml │ │ ├── generics_basic.toml │ │ ├── generics_defaults.toml │ │ ├── generics_defaults_referential.toml │ │ ├── generics_defaults_specialization.toml │ │ ├── generics_paramspec_basic.toml │ │ ├── generics_paramspec_components.toml │ │ ├── generics_paramspec_semantics.toml │ │ ├── generics_paramspec_specialization.toml │ │ ├── generics_scoping.toml │ │ ├── generics_self_advanced.toml │ │ ├── generics_self_attributes.toml │ │ ├── generics_self_basic.toml │ │ ├── generics_self_protocols.toml │ │ ├── generics_self_usage.toml │ │ ├── generics_syntax_compatibility.toml │ │ ├── generics_syntax_declarations.toml │ │ ├── generics_syntax_infer_variance.toml │ │ ├── generics_syntax_scoping.toml │ │ ├── generics_type_erasure.toml │ │ ├── generics_typevartuple_args.toml │ │ ├── generics_typevartuple_basic.toml │ │ ├── generics_typevartuple_callable.toml │ │ ├── generics_typevartuple_concat.toml │ │ ├── generics_typevartuple_overloads.toml │ │ ├── generics_typevartuple_specialization.toml │ │ ├── generics_typevartuple_unpack.toml │ │ ├── generics_upper_bound.toml │ │ ├── generics_variance.toml │ │ ├── generics_variance_inference.toml │ │ ├── historical_positional.toml │ │ ├── literals_interactions.toml │ │ ├── literals_literalstring.toml │ │ ├── literals_parameterizations.toml │ │ ├── literals_semantics.toml │ │ ├── namedtuples_define_class.toml │ │ ├── namedtuples_define_functional.toml │ │ ├── namedtuples_type_compat.toml │ │ ├── namedtuples_usage.toml │ │ ├── narrowing_typeguard.toml │ │ ├── narrowing_typeis.toml │ │ ├── overloads_basic.toml │ │ ├── overloads_consistency.toml │ │ ├── overloads_definitions.toml │ │ ├── overloads_definitions_stub.toml │ │ ├── overloads_evaluation.toml │ │ ├── protocols_class_objects.toml │ │ ├── protocols_definition.toml │ │ ├── protocols_explicit.toml │ │ ├── protocols_generic.toml │ │ ├── protocols_merging.toml │ │ ├── protocols_modules.toml │ │ ├── protocols_recursive.toml │ │ ├── protocols_runtime_checkable.toml │ │ ├── protocols_self.toml │ │ ├── protocols_subtyping.toml │ │ ├── protocols_variance.toml │ │ ├── qualifiers_annotated.toml │ │ ├── qualifiers_final_annotation.toml │ │ ├── qualifiers_final_decorator.toml │ │ ├── specialtypes_any.toml │ │ ├── specialtypes_never.toml │ │ ├── specialtypes_none.toml │ │ ├── specialtypes_promotions.toml │ │ ├── specialtypes_type.toml │ │ ├── tuples_type_compat.toml │ │ ├── tuples_type_form.toml │ │ ├── tuples_unpacked.toml │ │ ├── typeddicts_alt_syntax.toml │ │ ├── typeddicts_class_syntax.toml │ │ ├── typeddicts_final.toml │ │ ├── typeddicts_inheritance.toml │ │ ├── typeddicts_operations.toml │ │ ├── typeddicts_readonly.toml │ │ ├── typeddicts_readonly_consistency.toml │ │ ├── typeddicts_readonly_inheritance.toml │ │ ├── typeddicts_readonly_kwargs.toml │ │ ├── typeddicts_readonly_update.toml │ │ ├── typeddicts_required.toml │ │ ├── typeddicts_type_consistency.toml │ │ ├── typeddicts_usage.toml │ │ └── version.toml │ └── results.html ├── src │ ├── __init__.py │ ├── main.py │ ├── options.py │ ├── reporting.py │ ├── results_template.html │ ├── test_groups.py │ ├── test_groups.toml │ ├── type_checker.py │ └── unexpected_fails.py └── tests │ ├── _directives_deprecated_library.py │ ├── _enums_member_values.py │ ├── _enums_member_values.pyi │ ├── _enums_members.py │ ├── _enums_members.pyi │ ├── _protocols_modules1.py │ ├── _protocols_modules2.py │ ├── _qualifiers_final_annotation_1.py │ ├── _qualifiers_final_annotation_2.py │ ├── _qualifiers_final_decorator.pyi │ ├── aliases_explicit.py │ ├── aliases_implicit.py │ ├── aliases_newtype.py │ ├── aliases_recursive.py │ ├── aliases_type_statement.py │ ├── aliases_typealiastype.py │ ├── aliases_variance.py │ ├── annotations_coroutines.py │ ├── annotations_forward_refs.py │ ├── annotations_generators.py │ ├── annotations_methods.py │ ├── annotations_typeexpr.py │ ├── callables_annotation.py │ ├── callables_kwargs.py │ ├── callables_protocol.py │ ├── callables_subtyping.py │ ├── classes_classvar.py │ ├── classes_override.py │ ├── constructors_call_init.py │ ├── constructors_call_metaclass.py │ ├── constructors_call_new.py │ ├── constructors_call_type.py │ ├── constructors_callable.py │ ├── constructors_consistency.py │ ├── dataclasses_descriptors.py │ ├── dataclasses_final.py │ ├── dataclasses_frozen.py │ ├── dataclasses_hash.py │ ├── dataclasses_inheritance.py │ ├── dataclasses_kwonly.py │ ├── dataclasses_order.py │ ├── dataclasses_postinit.py │ ├── dataclasses_slots.py │ ├── dataclasses_transform_class.py │ ├── dataclasses_transform_converter.py │ ├── dataclasses_transform_field.py │ ├── dataclasses_transform_func.py │ ├── dataclasses_transform_meta.py │ ├── dataclasses_usage.py │ ├── directives_assert_type.py │ ├── directives_cast.py │ ├── directives_deprecated.py │ ├── directives_no_type_check.py │ ├── directives_reveal_type.py │ ├── directives_type_checking.py │ ├── directives_type_ignore.py │ ├── directives_type_ignore_file1.py │ ├── directives_type_ignore_file2.py │ ├── directives_version_platform.py │ ├── enums_behaviors.py │ ├── enums_definition.py │ ├── enums_expansion.py │ ├── enums_member_names.py │ ├── enums_member_values.py │ ├── enums_members.py │ ├── exceptions_context_managers.py │ ├── generics_base_class.py │ ├── generics_basic.py │ ├── generics_defaults.py │ ├── generics_defaults_referential.py │ ├── generics_defaults_specialization.py │ ├── generics_paramspec_basic.py │ ├── generics_paramspec_components.py │ ├── generics_paramspec_semantics.py │ ├── generics_paramspec_specialization.py │ ├── generics_scoping.py │ ├── generics_self_advanced.py │ ├── generics_self_attributes.py │ ├── generics_self_basic.py │ ├── generics_self_protocols.py │ ├── generics_self_usage.py │ ├── generics_syntax_compatibility.py │ ├── generics_syntax_declarations.py │ ├── generics_syntax_infer_variance.py │ ├── generics_syntax_scoping.py │ ├── generics_type_erasure.py │ ├── generics_typevartuple_args.py │ ├── generics_typevartuple_basic.py │ ├── generics_typevartuple_callable.py │ ├── generics_typevartuple_concat.py │ ├── generics_typevartuple_overloads.py │ ├── generics_typevartuple_specialization.py │ ├── generics_typevartuple_unpack.py │ ├── generics_upper_bound.py │ ├── generics_variance.py │ ├── generics_variance_inference.py │ ├── historical_positional.py │ ├── literals_interactions.py │ ├── literals_literalstring.py │ ├── literals_parameterizations.py │ ├── literals_semantics.py │ ├── namedtuples_define_class.py │ ├── namedtuples_define_functional.py │ ├── namedtuples_type_compat.py │ ├── namedtuples_usage.py │ ├── narrowing_typeguard.py │ ├── narrowing_typeis.py │ ├── overloads_basic.py │ ├── overloads_consistency.py │ ├── overloads_definitions.py │ ├── overloads_definitions_stub.pyi │ ├── overloads_evaluation.py │ ├── protocols_class_objects.py │ ├── protocols_definition.py │ ├── protocols_explicit.py │ ├── protocols_generic.py │ ├── protocols_merging.py │ ├── protocols_modules.py │ ├── protocols_recursive.py │ ├── protocols_runtime_checkable.py │ ├── protocols_self.py │ ├── protocols_subtyping.py │ ├── protocols_variance.py │ ├── qualifiers_annotated.py │ ├── qualifiers_final_annotation.py │ ├── qualifiers_final_decorator.py │ ├── specialtypes_any.py │ ├── specialtypes_never.py │ ├── specialtypes_none.py │ ├── specialtypes_promotions.py │ ├── specialtypes_type.py │ ├── tuples_type_compat.py │ ├── tuples_type_form.py │ ├── tuples_unpacked.py │ ├── typeddicts_alt_syntax.py │ ├── typeddicts_class_syntax.py │ ├── typeddicts_final.py │ ├── typeddicts_inheritance.py │ ├── typeddicts_operations.py │ ├── typeddicts_readonly.py │ ├── typeddicts_readonly_consistency.py │ ├── typeddicts_readonly_inheritance.py │ ├── typeddicts_readonly_kwargs.py │ ├── typeddicts_readonly_update.py │ ├── typeddicts_required.py │ ├── typeddicts_type_consistency.py │ └── typeddicts_usage.py ├── docs ├── Makefile ├── README.rst ├── conf.py ├── guides │ ├── index.rst │ ├── libraries.rst │ ├── modernizing.rst │ ├── type_narrowing.rst │ ├── typing_anti_pitch.rst │ ├── unreachable.rst │ └── writing_stubs.rst ├── index.rst ├── make.bat ├── reference │ ├── best_practices.rst │ ├── generics.rst │ ├── index.rst │ ├── protocols.rst │ ├── quality.rst │ └── stubs.rst ├── requirements.txt └── spec │ ├── aliases.rst │ ├── annotations.rst │ ├── callables.rst │ ├── class-compat.rst │ ├── concepts.rst │ ├── constructors.rst │ ├── dataclasses.rst │ ├── directives.rst │ ├── distributing.rst │ ├── enums.rst │ ├── exceptions.rst │ ├── generics.rst │ ├── glossary.rst │ ├── historical.rst │ ├── index.rst │ ├── literal.rst │ ├── meta.rst │ ├── namedtuples.rst │ ├── narrowing.rst │ ├── overload.rst │ ├── protocol.rst │ ├── qualifiers.rst │ ├── special-types.rst │ ├── tuples.rst │ ├── type-system.rst │ └── typeddict.rst └── test-requirements.txt /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*.{py,pyi,rst,md,yml,yaml,toml,json}] 4 | trim_trailing_whitespace = true 5 | insert_final_newline = true 6 | indent_style = space 7 | 8 | [*.{py,pyi,toml,json}] 9 | indent_size = 4 10 | 11 | [*.{yml,yaml}] 12 | indent_size = 2 13 | -------------------------------------------------------------------------------- /.flake8: -------------------------------------------------------------------------------- 1 | [flake8] 2 | 3 | max-line-length = 90 4 | exclude = conformance 5 | ignore = 6 | # irrelevant plugins 7 | B3, 8 | DW12, 9 | # code is sometimes better without this 10 | E129, 11 | # consistency with mypy 12 | W504 13 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/documentation-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Documentation issue 3 | about: Report a problem or suggest changes for the documentation at https://typing.python.org/ 4 | title: '' 5 | labels: 'topic: documentation' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/new-typing-feature.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: New typing feature 3 | about: Suggest a new feature for Python's typing system 4 | title: '' 5 | labels: 'topic: feature' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/other-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Other issue 3 | about: Report any other issue 4 | title: '' 5 | labels: 'topic: other' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: monthly 7 | groups: 8 | actions: 9 | patterns: 10 | - "*" 11 | -------------------------------------------------------------------------------- /.github/workflows/build-docs.yml: -------------------------------------------------------------------------------- 1 | name: Build the documentation 2 | 3 | on: 4 | pull_request: 5 | 6 | permissions: 7 | contents: read 8 | 9 | jobs: 10 | build: 11 | 12 | name: Build documentation 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v4 17 | - name: Set up Python 18 | uses: actions/setup-python@v5 19 | with: 20 | python-version: 3.9 21 | - name: Install dependencies 22 | run: | 23 | pip install --upgrade pip 24 | pip install -r docs/requirements.txt 25 | - name: Build the documentation 26 | run: make -C docs html 27 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Test and lint 2 | 3 | on: 4 | push: 5 | pull_request: 6 | 7 | permissions: 8 | contents: read 9 | 10 | jobs: 11 | linting: 12 | name: Lint 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v4 18 | - name: Set up Python 3 19 | uses: actions/setup-python@v5 20 | with: 21 | python-version: 3 22 | cache: "pip" 23 | cache-dependency-path: "test-requirements.txt" 24 | 25 | - name: Install dependencies 26 | run: | 27 | pip install --upgrade pip 28 | pip install -r test-requirements.txt 29 | 30 | - name: Lint implementation 31 | run: flake8 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | MANIFEST 2 | 3 | __pycache__/ 4 | build/ 5 | dist/ 6 | tmp/ 7 | venv*/ 8 | 9 | .cache/ 10 | .idea/ 11 | .tox/ 12 | .venv*/ 13 | .vscode/ 14 | 15 | *.swp 16 | *.pyc 17 | *.egg-info/ 18 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v4.6.0 4 | hooks: 5 | - id: trailing-whitespace 6 | exclude: conformance/results/.*/.*\.toml 7 | - id: end-of-file-fixer 8 | - id: check-yaml 9 | - id: check-toml 10 | - id: check-merge-conflict 11 | - id: mixed-line-ending 12 | args: [--fix=lf] 13 | exclude: docs/make\.bat 14 | - id: check-case-conflict 15 | - repo: meta 16 | hooks: 17 | - id: check-hooks-apply 18 | 19 | ci: 20 | autofix_commit_msg: "[pre-commit.ci] auto fixes from pre-commit.com hooks" 21 | autofix_prs: true 22 | autoupdate_commit_msg: "[pre-commit.ci] pre-commit autoupdate" 23 | autoupdate_schedule: quarterly 24 | submodules: false 25 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # Read the Docs configuration file 2 | # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details 3 | 4 | version: 2 5 | 6 | build: 7 | os: ubuntu-22.04 8 | tools: 9 | python: "3" 10 | 11 | sphinx: 12 | configuration: docs/conf.py 13 | 14 | python: 15 | install: 16 | - requirements: docs/requirements.txt 17 | -------------------------------------------------------------------------------- /conformance/.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # Environments 30 | .env 31 | .venv 32 | 33 | # Tools 34 | .mypy_cache 35 | .pyre_configuration 36 | .pyre 37 | .coverage 38 | htmlcov 39 | 40 | # General 41 | .DS_Store 42 | 43 | # Editor temp files 44 | .*.swp 45 | 46 | # Workspace configurations 47 | .vscode 48 | -------------------------------------------------------------------------------- /conformance/requirements.txt: -------------------------------------------------------------------------------- 1 | tomli 2 | tomlkit 3 | tqdm 4 | pyright 5 | mypy 6 | pip 7 | pyre-check; platform_system != "Windows" 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/aliases_variance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | aliases_variance.py:24: error: Variance of TypeVar "T_co" incompatible with variance in parent type [type-var] 4 | aliases_variance.py:28: error: Variance of TypeVar "T_co" incompatible with variance in parent type [type-var] 5 | aliases_variance.py:32: error: Variance of TypeVar "T_co" incompatible with variance in parent type [type-var] 6 | aliases_variance.py:44: error: Variance of TypeVar "T_contra" incompatible with variance in parent type [type-var] 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/annotations_coroutines.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/annotations_methods.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. 4 | """ 5 | output = """ 6 | annotations_methods.py:42: error: Expression is of type "B", not "A" [assert-type] 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/classes_override.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not handle case where parent class derives from Any. 4 | """ 5 | output = """ 6 | classes_override.py:53: error: Method "method3" is marked as an override, but no base method was found with this name [misc] 7 | classes_override.py:56: error: Method "method4" is marked as an override, but no base method was found with this name [misc] 8 | classes_override.py:79: error: Method "static_method1" is marked as an override, but no base method was found with this name [misc] 9 | classes_override.py:84: error: Method "class_method1" is marked as an override, but no base method was found with this name [misc] 10 | classes_override.py:89: error: Method "property1" is marked as an override, but no base method was found with this name [misc] 11 | classes_override.py:101: error: Method "method1" is marked as an override, but no base method was found with this name [misc] 12 | """ 13 | conformance_automated = "Fail" 14 | errors_diff = """ 15 | Line 101: Unexpected errors ['classes_override.py:101: error: Method "method1" is marked as an override, but no base method was found with this name [misc]'] 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/mypy/constructors_call_init.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report errors during binding to self parameter of __init__ method. 4 | Does not reject use of class-scoped type variables in annotation of self parameter in __init__ method. 5 | """ 6 | conformance_automated = "Fail" 7 | errors_diff = """ 8 | Line 56: Expected 1 errors 9 | Line 107: Expected 1 errors 10 | Line 73: Unexpected errors ['constructors_call_init.py:73: error: Expression is of type "Class5[list[int]]", not "Class5[int]" [assert-type]'] 11 | """ 12 | output = """ 13 | constructors_call_init.py:21: error: Argument 1 to "Class1" has incompatible type "float"; expected "int" [arg-type] 14 | constructors_call_init.py:42: error: Argument 1 to "Class3" has incompatible type "Class2[Never]"; expected "Class3 | None" [arg-type] 15 | constructors_call_init.py:73: error: Expression is of type "Class5[list[int]]", not "Class5[int]" [assert-type] 16 | constructors_call_init.py:130: error: Too many arguments for "Class11" [call-arg] 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/constructors_call_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not validate call to custom metaclass __call__ method through type[T]. 4 | """ 5 | conformance_automated = "Fail" 6 | errors_diff = """ 7 | Line 30: Expected 1 errors 8 | Line 72: Expected 1 errors 9 | """ 10 | output = """ 11 | constructors_call_type.py:40: error: Missing positional arguments "x", "y" in call to "Class2" [call-arg] 12 | constructors_call_type.py:50: error: Missing positional arguments "x", "y" in call to "Class3" [call-arg] 13 | constructors_call_type.py:59: error: Too many arguments for "Class4" [call-arg] 14 | constructors_call_type.py:64: error: Too many arguments for "object" [call-arg] 15 | constructors_call_type.py:81: error: Missing positional argument "y" in call to "Class2" [call-arg] 16 | constructors_call_type.py:82: error: Argument 2 to "Class2" has incompatible type "int"; expected "str" [arg-type] 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/constructors_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not report inconsistency between __new__ and __init__ (optional). 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | output = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_descriptors.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not correctly evaluate type of descriptor access. 4 | """ 5 | output = """ 6 | dataclasses_descriptors.py:66: error: Expression is of type "Desc2[int]", not "int" [assert-type] 7 | dataclasses_descriptors.py:67: error: Expression is of type "Desc2[str]", not "str" [assert-type] 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 66: Unexpected errors ['dataclasses_descriptors.py:66: error: Expression is of type "Desc2[int]", not "int" [assert-type]'] 12 | Line 67: Unexpected errors ['dataclasses_descriptors.py:67: error: Expression is of type "Desc2[str]", not "str" [assert-type]'] 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_frozen.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_frozen.py:16: error: Property "a" defined in "DC1" is read-only [misc] 4 | dataclasses_frozen.py:17: error: Property "b" defined in "DC1" is read-only [misc] 5 | dataclasses_frozen.py:23: error: Cannot inherit non-frozen dataclass from a frozen one [misc] 6 | dataclasses_frozen.py:33: error: Cannot inherit frozen dataclass from a non-frozen one [misc] 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_hash.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report when dataclass is not compatible with Hashable protocol. 4 | """ 5 | output = """ 6 | """ 7 | conformance_automated = "Fail" 8 | errors_diff = """ 9 | Line 15: Expected 1 errors 10 | Line 32: Expected 1 errors 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_inheritance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_inheritance.py:60: error: Cannot override instance variable (previously declared on base class "DC6") with class variable [misc] 4 | dataclasses_inheritance.py:64: error: Cannot override class variable (previously declared on base class "DC6") with instance variable [misc] 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_order.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_order.py:50: error: Unsupported operand types for < ("DC1" and "DC2") [operator] 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_postinit.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_postinit.py:19: error: Argument 3 of "__post_init__" is incompatible with supertype "dataclass"; supertype defines the argument type as "str" [override] 4 | dataclasses_postinit.py:28: error: "DC1" has no attribute "x" [attr-defined] 5 | dataclasses_postinit.py:29: error: "DC1" has no attribute "y" [attr-defined] 6 | dataclasses_postinit.py:36: error: Signature of "__post_init__" incompatible with supertype "dataclass" [override] 7 | dataclasses_postinit.py:36: note: Superclass: 8 | dataclasses_postinit.py:36: note: def __post_init__(self: DC2, x: int, y: str) -> None 9 | dataclasses_postinit.py:36: note: Subclass: 10 | dataclasses_postinit.py:36: note: def __post_init__(self: DC2, x: int) -> None 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_slots.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject write to instance variable that is not defined in __slots__. 4 | """ 5 | output = """ 6 | dataclasses_slots.py:11: error: "DC1" both defines "__slots__" and is used with "slots=True" [misc] 7 | dataclasses_slots.py:66: error: "type[DC6]" has no attribute "__slots__" [attr-defined] 8 | dataclasses_slots.py:69: error: "DC6" has no attribute "__slots__" [attr-defined] 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 25: Expected 1 errors 13 | Line 38: Expected 1 errors 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_transform_class.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_transform_class.py:51: error: Cannot inherit non-frozen dataclass from a frozen one [misc] 4 | dataclasses_transform_class.py:63: error: Property "id" defined in "Customer1" is read-only [misc] 5 | dataclasses_transform_class.py:66: error: Too many positional arguments for "Customer1" [misc] 6 | dataclasses_transform_class.py:72: error: Unsupported left operand type for < ("Customer1") [operator] 7 | dataclasses_transform_class.py:82: error: Too many positional arguments for "Customer2" [misc] 8 | dataclasses_transform_class.py:122: error: Property "id" defined in "Customer3" is read-only [misc] 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_transform_field.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not properly handle field constructor that has default value for `kw_only` or `init` parameter. 4 | """ 5 | output = """ 6 | dataclasses_transform_field.py:64: error: Unexpected keyword argument "id" for "CustomerModel1" [call-arg] 7 | dataclasses_transform_field.py:75: error: Too many positional arguments for "CustomerModel2" [misc] 8 | dataclasses_transform_field.py:75: error: Missing named argument "name" for "CustomerModel2" [call-arg] 9 | dataclasses_transform_field.py:77: error: Missing named argument "id" for "CustomerModel2" [call-arg] 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 77: Unexpected errors ['dataclasses_transform_field.py:77: error: Missing named argument "id" for "CustomerModel2" [call-arg]'] 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_transform_func.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not handle `kw_only=False` override when `kw_only_default=True`. 4 | Does not report error when `order=False` and comparison operators are used. 5 | """ 6 | output = """ 7 | dataclasses_transform_func.py:53: error: Too many positional arguments for "Customer1" [misc] 8 | dataclasses_transform_func.py:57: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment] 9 | dataclasses_transform_func.py:65: error: Unexpected keyword argument "salary" for "Customer1" [call-arg] 10 | dataclasses_transform_func.py:71: error: Too many positional arguments for "Customer2" [misc] 11 | dataclasses_transform_func.py:90: error: Cannot inherit non-frozen dataclass from a frozen one [misc] 12 | dataclasses_transform_func.py:97: error: Property "id" defined in "Customer3" is read-only [misc] 13 | """ 14 | conformance_automated = "Fail" 15 | errors_diff = """ 16 | Line 61: Expected 1 errors 17 | Line 53: Unexpected errors ['dataclasses_transform_func.py:53: error: Too many positional arguments for "Customer1" [misc]'] 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/mypy/dataclasses_transform_meta.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_transform_meta.py:51: error: Cannot inherit non-frozen dataclass from a frozen one [misc] 4 | dataclasses_transform_meta.py:63: error: Property "id" defined in "Customer1" is read-only [misc] 5 | dataclasses_transform_meta.py:66: error: Too many positional arguments for "Customer1" [misc] 6 | dataclasses_transform_meta.py:73: error: Unsupported left operand type for < ("Customer1") [operator] 7 | dataclasses_transform_meta.py:83: error: Too many positional arguments for "Customer2" [misc] 8 | dataclasses_transform_meta.py:103: error: Property "id" defined in "Customer3" is read-only [misc] 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_assert_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_assert_type.py:27: error: Expression is of type "int | str", not "int" [assert-type] 4 | directives_assert_type.py:28: error: Expression is of type "Any", not "int" [assert-type] 5 | directives_assert_type.py:29: error: Expression is of type "Literal[4]", not "int" [assert-type] 6 | directives_assert_type.py:31: error: "assert_type" expects 2 arguments [misc] 7 | directives_assert_type.py:31: error: Too few arguments for "assert_type" [call-arg] 8 | directives_assert_type.py:32: error: Expression is of type "Literal['']", not "int" [assert-type] 9 | directives_assert_type.py:33: error: "assert_type" expects 2 arguments [misc] 10 | directives_assert_type.py:33: error: Too many arguments for "assert_type" [call-arg] 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_cast.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_cast.py:15: error: "cast" expects 2 arguments [misc] 4 | directives_cast.py:15: error: All overload variants of "cast" require at least one argument [call-overload] 5 | directives_cast.py:15: note: Possible overload variants: 6 | directives_cast.py:15: note: def [_T] cast(typ: type[_T], val: Any) -> _T 7 | directives_cast.py:15: note: def cast(typ: str, val: Any) -> Any 8 | directives_cast.py:15: note: def cast(typ: object, val: Any) -> Any 9 | directives_cast.py:16: error: Invalid type: try using Literal[1] instead? [valid-type] 10 | directives_cast.py:17: error: "cast" expects 2 arguments [misc] 11 | directives_cast.py:17: error: No overload variant of "cast" matches argument types "Any", "str", "str" [call-overload] 12 | directives_cast.py:17: note: Possible overload variants: 13 | directives_cast.py:17: note: def [_T] cast(typ: type[_T], val: Any) -> _T 14 | directives_cast.py:17: note: def cast(typ: str, val: Any) -> Any 15 | directives_cast.py:17: note: def cast(typ: object, val: Any) -> Any 16 | """ 17 | conformance_automated = "Pass" 18 | errors_diff = """ 19 | """ 20 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_no_type_check.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not honor `@no_type_check` class decorator (allowed). 4 | Does not reject invalid call of `@no_type_check` function. 5 | """ 6 | output = """ 7 | directives_no_type_check.py:15: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 32: Expected 1 errors 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_reveal_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_reveal_type.py:14: note: Revealed type is "Union[builtins.int, builtins.str]" 4 | directives_reveal_type.py:15: note: Revealed type is "builtins.list[builtins.int]" 5 | directives_reveal_type.py:16: note: Revealed type is "Any" 6 | directives_reveal_type.py:17: note: Revealed type is "directives_reveal_type.ForwardReference" 7 | directives_reveal_type.py:19: error: "reveal_type" expects 1 argument [misc] 8 | directives_reveal_type.py:19: error: Too few arguments for "reveal_type" [call-arg] 9 | directives_reveal_type.py:20: error: "reveal_type" expects 1 argument [misc] 10 | directives_reveal_type.py:20: error: Too many arguments for "reveal_type" [call-arg] 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_type_checking.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_type_ignore.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not honor "# type: ignore" comment if comment includes additional text. 4 | """ 5 | output = """ 6 | directives_type_ignore.py:11: error: Invalid "type: ignore" comment [syntax] 7 | directives_type_ignore.py:11: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 8 | directives_type_ignore.py:14: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 9 | directives_type_ignore.py:14: note: Error code "assignment" not covered by "type: ignore" comment 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 11: Unexpected errors ['directives_type_ignore.py:11: error: Invalid "type: ignore" comment [syntax]', 'directives_type_ignore.py:11: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] 14 | Line 14: Unexpected errors ['directives_type_ignore.py:14: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]'] 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_type_ignore_file1.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_type_ignore_file2.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_type_ignore_file2.py:14: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/directives_version_platform.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not understand three-element form of sys.version checks. 4 | Does not understand os.name checks. 5 | """ 6 | output = """ 7 | directives_version_platform.py:19: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 8 | directives_version_platform.py:27: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 9 | directives_version_platform.py:40: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 10 | directives_version_platform.py:45: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment] 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/mypy/enums_behaviors.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | enums_behaviors.py:39: error: Cannot extend enum with existing members: "Shape" [misc] 6 | """ 7 | conformance_automated = "Pass" 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/enums_definition.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | """ 6 | conformance_automated = "Pass" 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/enums_expansion.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Improperly applies narrowing to Flag subclass. 4 | """ 5 | conformance_automated = "Fail" 6 | errors_diff = """ 7 | Line 53: Expected 1 errors 8 | Line 52: Unexpected errors ['enums_expansion.py:52: error: Expression is of type "Literal[CustomFlags.FLAG3]", not "CustomFlags" [assert-type]'] 9 | """ 10 | output = """ 11 | enums_expansion.py:52: error: Expression is of type "Literal[CustomFlags.FLAG3]", not "CustomFlags" [assert-type] 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/mypy/enums_member_names.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not support special-cased handling of member name literal types in some cases (optional). 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | output = """ 9 | enums_member_names.py:26: error: Expression is of type "str", not "Literal['RED', 'BLUE']" [assert-type] 10 | enums_member_names.py:30: error: Expression is of type "str", not "Literal['RED', 'BLUE', 'GREEN']" [assert-type] 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/mypy/enums_member_values.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not enforce declared type of `_value_`. 4 | Does not enforce assigned tuple types for enum members (optional). 5 | """ 6 | conformance_automated = "Fail" 7 | errors_diff = """ 8 | Line 78: Expected 1 errors 9 | """ 10 | output = """ 11 | enums_member_values.py:26: error: Expression is of type "Any", not "Literal[1, 3]" [assert-type] 12 | enums_member_values.py:54: error: Expression is of type "tuple[int, float, float]", not "Literal[1]" [assert-type] 13 | enums_member_values.py:68: error: Expression is of type "int", not "Literal[1]" [assert-type] 14 | enums_member_values.py:85: error: Incompatible types in assignment (expression has type "int", variable has type "str") [assignment] 15 | enums_member_values.py:96: error: Expression is of type "EllipsisType", not "int" [assert-type] 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/mypy/exceptions_context_managers.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | """ 6 | conformance_automated = "Pass" 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_base_class.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not detect inconsistent type variable ordering. 4 | """ 5 | output = """ 6 | generics_base_class.py:26: error: Argument 1 to "takes_dict_incorrect" has incompatible type "SymbolTable"; expected "dict[str, list[object]]" [arg-type] 7 | generics_base_class.py:29: error: Variable "typing.Generic" is not valid as a type [valid-type] 8 | generics_base_class.py:29: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases 9 | generics_base_class.py:30: error: Variable "typing.Generic" is not valid as a type [valid-type] 10 | generics_base_class.py:30: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases 11 | generics_base_class.py:49: error: "LinkedList" expects 1 type argument, but 2 given [type-arg] 12 | generics_base_class.py:61: error: "MyDict" expects 1 type argument, but 2 given [type-arg] 13 | generics_base_class.py:68: error: Duplicate type variables in Generic[...] or Protocol[...] [misc] 14 | """ 15 | conformance_automated = "Fail" 16 | errors_diff = """ 17 | Line 98: Expected 1 errors 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_defaults_specialization.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | output = """ 3 | 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[DefaultStrT]]", not "type[Bar[str]]" [assert-type] 5 | generics_defaults_specialization.py:55: error: The type "type[Foo]" is not generic and not indexable [misc] 6 | """ 7 | conformance_automated = "Fail" 8 | errors_diff = """ 9 | Line 45: Unexpected errors ['generics_defaults_specialization.py:45: error: Expression is of type "type[Bar[DefaultStrT]]", not "type[Bar[str]]" [assert-type]'] 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_paramspec_specialization.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_paramspec_specialization.py:44: error: Can only replace ParamSpec with a parameter types list or another ParamSpec, got "int" [valid-type] 4 | generics_paramspec_specialization.py:54: error: Argument 1 has incompatible type "str"; expected "int" [arg-type] 5 | generics_paramspec_specialization.py:55: error: Argument 3 has incompatible type "str"; expected "bool" [arg-type] 6 | generics_paramspec_specialization.py:60: error: Argument 1 has incompatible type "str"; expected "int" [arg-type] 7 | generics_paramspec_specialization.py:61: error: Argument 3 has incompatible type "str"; expected "bool" [arg-type] 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_self_attributes.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_self_attributes.py:26: error: Argument "next" to "OrdinalLinkedList" has incompatible type "LinkedList[int]"; expected "OrdinalLinkedList | None" [arg-type] 4 | generics_self_attributes.py:32: error: Incompatible types in assignment (expression has type "LinkedList[int]", variable has type "OrdinalLinkedList | None") [assignment] 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_self_basic.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_self_basic.py:20: error: Incompatible return value type (got "Shape", expected "Self") [return-value] 4 | generics_self_basic.py:33: error: Incompatible return value type (got "Shape", expected "Self") [return-value] 5 | generics_self_basic.py:67: error: Self type cannot have type arguments [misc] 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_self_protocols.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_self_protocols.py:61: error: Argument 1 to "accepts_shape" has incompatible type "BadReturnType"; expected "ShapeProtocol" [arg-type] 4 | generics_self_protocols.py:61: note: Following member(s) of "BadReturnType" have conflicts: 5 | generics_self_protocols.py:61: note: Expected: 6 | generics_self_protocols.py:61: note: def set_scale(self, scale: float) -> BadReturnType 7 | generics_self_protocols.py:61: note: Got: 8 | generics_self_protocols.py:61: note: def set_scale(self, scale: float) -> int 9 | generics_self_protocols.py:64: error: Argument 1 to "accepts_shape" has incompatible type "ReturnDifferentClass"; expected "ShapeProtocol" [arg-type] 10 | generics_self_protocols.py:64: note: Following member(s) of "ReturnDifferentClass" have conflicts: 11 | generics_self_protocols.py:64: note: Expected: 12 | generics_self_protocols.py:64: note: def set_scale(self, scale: float) -> ReturnDifferentClass 13 | generics_self_protocols.py:64: note: Got: 14 | generics_self_protocols.py:64: note: def set_scale(self, scale: float) -> ReturnConcreteShape 15 | """ 16 | conformance_automated = "Pass" 17 | errors_diff = """ 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_syntax_compatibility.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_syntax_compatibility.py:14: error: All type parameters should be declared ("K" not declared) [valid-type] 4 | generics_syntax_compatibility.py:26: error: All type parameters should be declared ("K" not declared) [valid-type] 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_syntax_declarations.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_syntax_declarations.py:17: error: Generic[...] base class is redundant [misc] 4 | generics_syntax_declarations.py:25: error: No arguments expected for "Protocol" base class [misc] 5 | generics_syntax_declarations.py:32: error: "T" has no attribute "is_integer" [attr-defined] 6 | generics_syntax_declarations.py:44: error: Name "V" is not defined [name-defined] 7 | generics_syntax_declarations.py:48: error: Bracketed expression "[...]" is not valid as a type [valid-type] 8 | generics_syntax_declarations.py:60: error: Type variable must have at least two constrained types [misc] 9 | generics_syntax_declarations.py:64: error: Type variable must have at least two constrained types [misc] 10 | generics_syntax_declarations.py:71: error: Variable "generics_syntax_declarations.t1" is not valid as a type [valid-type] 11 | generics_syntax_declarations.py:71: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases 12 | generics_syntax_declarations.py:75: error: Invalid type: try using Literal[3] instead? [valid-type] 13 | generics_syntax_declarations.py:79: error: Name "S" is not defined [name-defined] 14 | """ 15 | conformance_automated = "Pass" 16 | errors_diff = """ 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_typevartuple_args.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not enforce that tuples captured by TypeVarTuple are same type. 4 | """ 5 | output = """ 6 | generics_typevartuple_args.py:33: error: Argument 3 to "exec_le" has incompatible type "str"; expected "Env" [arg-type] 7 | generics_typevartuple_args.py:34: error: Argument 3 to "exec_le" has incompatible type "str"; expected "Env" [arg-type] 8 | generics_typevartuple_args.py:48: error: Argument 2 to "func1" has incompatible type "str"; expected "int" [arg-type] 9 | generics_typevartuple_args.py:57: error: Argument 2 to "func2" has incompatible type "int"; expected "*tuple[*tuple[str, ...], str]" [arg-type] 10 | generics_typevartuple_args.py:58: error: Too few arguments for "func2" [call-arg] 11 | generics_typevartuple_args.py:59: error: Too few arguments for "func2" [call-arg] 12 | generics_typevartuple_args.py:59: error: Argument 1 to "func2" has incompatible type "str"; expected "int" [arg-type] 13 | generics_typevartuple_args.py:67: error: Too few arguments for "func3" [call-arg] 14 | """ 15 | conformance_automated = "Fail" 16 | errors_diff = """ 17 | Line 75: Expected 1 errors 18 | Line 76: Expected 1 errors 19 | """ 20 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_typevartuple_callable.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_typevartuple_callable.py:26: error: Argument "target" to "Process" has incompatible type "Callable[[int, str], None]"; expected "Callable[[str, int], None]" [arg-type] 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_typevartuple_concat.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_typevartuple_overloads.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_typevartuple_unpack.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_typevartuple_unpack.py:30: error: Argument 1 to "process_batch_channels" has incompatible type "Array[Batch]"; expected "Array[Batch, *tuple[Any, ...], Channels]" [arg-type] 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/generics_upper_bound.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject use of type variable within an upper bound. 4 | """ 5 | output = """ 6 | generics_upper_bound.py:43: error: Expression is of type "Collection[int]", not "list[int] | set[int]" [assert-type] 7 | generics_upper_bound.py:51: error: Value of type variable "ST" of "longer" cannot be "int" [type-var] 8 | generics_upper_bound.py:56: error: TypeVar cannot have both values and an upper bound [misc] 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 24: Expected 1 errors 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/mypy/literals_interactions.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not narrow type of `x` with `x in Literal` type guard pattern. 4 | """ 5 | output = """ 6 | literals_interactions.py:15: error: Tuple index out of range [misc] 7 | literals_interactions.py:16: error: Tuple index out of range [misc] 8 | literals_interactions.py:17: error: Tuple index out of range [misc] 9 | literals_interactions.py:18: error: Tuple index out of range [misc] 10 | literals_interactions.py:106: error: Argument 1 to "expects_bad_status" has incompatible type "str"; expected "Literal['MALFORMED', 'ABORTED']" [arg-type] 11 | literals_interactions.py:109: error: Argument 1 to "expects_pending_status" has incompatible type "str"; expected "Literal['PENDING']" [arg-type] 12 | """ 13 | conformance_automated = "Fail" 14 | errors_diff = """ 15 | Line 106: Unexpected errors ['literals_interactions.py:106: error: Argument 1 to "expects_bad_status" has incompatible type "str"; expected "Literal[\\'MALFORMED\\', \\'ABORTED\\']" [arg-type]'] 16 | Line 109: Unexpected errors ['literals_interactions.py:109: error: Argument 1 to "expects_pending_status" has incompatible type "str"; expected "Literal[\\'PENDING\\']" [arg-type]'] 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/literals_semantics.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | literals_semantics.py:10: error: Incompatible types in assignment (expression has type "Literal[4]", variable has type "Literal[3]") [assignment] 4 | literals_semantics.py:24: error: Incompatible types in assignment (expression has type "Literal[0]", variable has type "Literal[False]") [assignment] 5 | literals_semantics.py:25: error: Incompatible types in assignment (expression has type "Literal[False]", variable has type "Literal[0]") [assignment] 6 | literals_semantics.py:33: error: Incompatible types in assignment (expression has type "int", variable has type "Literal[3, 4, 5]") [assignment] 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/namedtuples_type_compat.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | namedtuples_type_compat.py:22: error: Incompatible types in assignment (expression has type "Point", variable has type "tuple[int, int]") [assignment] 4 | namedtuples_type_compat.py:23: error: Incompatible types in assignment (expression has type "Point", variable has type "tuple[int, str, str]") [assignment] 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/mypy/namedtuples_usage.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject attempt to delete named tuple field by name. 4 | """ 5 | output = """ 6 | namedtuples_usage.py:34: error: Tuple index out of range [misc] 7 | namedtuples_usage.py:35: error: Tuple index out of range [misc] 8 | namedtuples_usage.py:40: error: Property "x" defined in "Point" is read-only [misc] 9 | namedtuples_usage.py:41: error: Unsupported target for indexed assignment ("Point") [index] 10 | namedtuples_usage.py:43: error: "Point" has no attribute "__delitem__" [attr-defined] 11 | namedtuples_usage.py:52: error: Too many values to unpack (2 expected, 3 provided) [misc] 12 | namedtuples_usage.py:53: error: Need more than 3 values to unpack (4 expected) [misc] 13 | """ 14 | conformance_automated = "Fail" 15 | errors_diff = """ 16 | Line 42: Expected 1 errors 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/narrowing_typeguard.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | narrowing_typeguard.py:102: error: TypeGuard functions must have a positional argument [valid-type] 4 | narrowing_typeguard.py:107: error: TypeGuard functions must have a positional argument [valid-type] 5 | narrowing_typeguard.py:128: error: Argument 1 to "takes_callable_str" has incompatible type "Callable[[object], TypeGuard[int]]"; expected "Callable[[object], str]" [arg-type] 6 | narrowing_typeguard.py:148: error: Argument 1 to "takes_callable_str_proto" has incompatible type "Callable[[object], TypeGuard[int]]"; expected "CallableStrProto" [arg-type] 7 | narrowing_typeguard.py:148: note: "CallableStrProto.__call__" has type "Callable[[Arg(object, 'val')], str]" 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/mypy/overloads_basic.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | overloads_basic.py:39: error: No overload variant of "__getitem__" of "Bytes" matches argument type "str" [call-overload] 4 | overloads_basic.py:39: note: Possible overload variants: 5 | overloads_basic.py:39: note: def __getitem__(self, int, /) -> int 6 | overloads_basic.py:39: note: def __getitem__(self, slice[Any, Any, Any], /) -> bytes 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/overloads_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | overloads_consistency.py:28: error: Overloaded function implementation cannot produce return type of signature 2 [misc] 7 | overloads_consistency.py:44: error: Overloaded function implementation does not accept all possible arguments of signature 2 [misc] 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/mypy/overloads_definitions_stub.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Allows @override to appear in a stub file not on the first overload. 4 | """ 5 | conformance_automated = "Fail" 6 | errors_diff = """ 7 | Lines 143, 147, 149: Expected error (tag 'override_impl') 8 | """ 9 | output = """ 10 | overloads_definitions_stub.pyi:13: error: Single overload definition, multiple required [misc] 11 | overloads_definitions_stub.pyi:32: error: Overload does not consistently use the "@staticmethod" decorator on all function signatures. [misc] 12 | overloads_definitions_stub.pyi:39: error: Overload does not consistently use the "@classmethod" decorator on all function signatures. [misc] 13 | overloads_definitions_stub.pyi:71: error: In a stub file @final must be applied only to the first overload [misc] 14 | overloads_definitions_stub.pyi:84: error: In a stub file @final must be applied only to the first overload [misc] 15 | overloads_definitions_stub.pyi:107: error: Cannot override final attribute "final_method" (previously declared in base class "Base") [misc] 16 | overloads_definitions_stub.pyi:120: error: Method "bad_override" is marked as an override, but no base method was found with this name [misc] 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_explicit.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not report unimplemented attributes for class that explicitly derives from protocol until it is instantiated. 4 | """ 5 | output = """ 6 | protocols_explicit.py:27: error: Call to abstract method "draw" of "PColor" with trivial body via super() is unsafe [safe-super] 7 | protocols_explicit.py:56: error: Incompatible types in assignment (expression has type "tuple[int, int, str]", base class "RGB" defined the type as "tuple[int, int, int]") [assignment] 8 | protocols_explicit.py:60: error: Cannot instantiate abstract class "Point" with abstract attributes "intensity" and "transparency" [abstract] 9 | protocols_explicit.py:135: error: Cannot instantiate abstract class "Concrete5" with abstract attribute "method1" [abstract] 10 | protocols_explicit.py:165: error: Cannot instantiate abstract class "Concrete7A" with abstract attribute "method1" [abstract] 11 | """ 12 | conformance_automated = "Fail" 13 | errors_diff = """ 14 | Line 90: Expected 1 errors 15 | Line 110: Expected 1 errors 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_merging.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | protocols_merging.py:52: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable1") [assignment] 4 | protocols_merging.py:52: note: "SCConcrete2" is missing following "SizedAndClosable1" protocol member: 5 | protocols_merging.py:52: note: __len__ 6 | protocols_merging.py:53: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable2") [assignment] 7 | protocols_merging.py:53: note: "SCConcrete2" is missing following "SizedAndClosable2" protocol member: 8 | protocols_merging.py:53: note: __len__ 9 | protocols_merging.py:54: error: Incompatible types in assignment (expression has type "SCConcrete2", variable has type "SizedAndClosable3") [assignment] 10 | protocols_merging.py:67: error: All bases of a protocol must be protocols [misc] 11 | protocols_merging.py:82: error: Cannot instantiate abstract class "SizedAndClosable4" with abstract attribute "close" [abstract] 12 | protocols_merging.py:83: error: Incompatible types in assignment (expression has type "SCConcrete1", variable has type "SizedAndClosable4") [assignment] 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_modules.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | protocols_modules.py:26: error: Incompatible types in assignment (expression has type Module, variable has type "Options2") [assignment] 4 | protocols_modules.py:26: note: Following member(s) of Module "_protocols_modules1" have conflicts: 5 | protocols_modules.py:26: note: timeout: expected "str", got "int" 6 | protocols_modules.py:48: error: Incompatible types in assignment (expression has type Module, variable has type "Reporter2") [assignment] 7 | protocols_modules.py:48: note: Following member(s) of Module "_protocols_modules2" have conflicts: 8 | protocols_modules.py:48: note: Expected: 9 | protocols_modules.py:48: note: def on_error(x: int) -> int 10 | protocols_modules.py:48: note: Got: 11 | protocols_modules.py:48: note: def on_error(x: int) -> None 12 | protocols_modules.py:49: error: Incompatible types in assignment (expression has type Module, variable has type "Reporter3") [assignment] 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_recursive.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_runtime_checkable.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report unsafe overlap for runtime_checkable protocol. 4 | """ 5 | output = """ 6 | protocols_runtime_checkable.py:23: error: Only @runtime_checkable protocols can be used with instance and class checks [misc] 7 | protocols_runtime_checkable.py:55: error: Only protocols that don't have non-method members can be used with issubclass() [misc] 8 | protocols_runtime_checkable.py:55: note: Protocol "DataProtocol" has non-method member(s): name 9 | protocols_runtime_checkable.py:61: error: Only protocols that don't have non-method members can be used with issubclass() [misc] 10 | protocols_runtime_checkable.py:61: note: Protocol "DataProtocol" has non-method member(s): name 11 | """ 12 | conformance_automated = "Fail" 13 | errors_diff = """ 14 | Line 88: Expected 1 errors 15 | Line 92: Expected 1 errors 16 | Line 96: Expected 1 errors 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_self.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/protocols_variance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | protocols_variance.py:21: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] 4 | protocols_variance.py:40: error: Invariant type variable "T3" used in protocol where contravariant one is expected [misc] 5 | protocols_variance.py:56: error: Invariant type variable "T1" used in protocol where contravariant one is expected [misc] 6 | protocols_variance.py:61: error: Covariant type variable "T1_co" used in protocol where contravariant one is expected [misc] 7 | protocols_variance.py:62: error: Cannot use a covariant type variable as a parameter [misc] 8 | protocols_variance.py:66: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] 9 | protocols_variance.py:71: error: Contravariant type variable "T1_contra" used in protocol where covariant one is expected [misc] 10 | protocols_variance.py:72: error: Cannot use a contravariant type variable as return type [misc] 11 | protocols_variance.py:104: error: Invariant type variable "T1" used in protocol where covariant one is expected [misc] 12 | """ 13 | conformance_automated = "Pass" 14 | errors_diff = """ 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/mypy/specialtypes_any.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_any.py:37: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] 4 | specialtypes_any.py:38: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked] 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/mypy/specialtypes_never.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_never.py:19: error: Implicit return in function which does not return [misc] 4 | specialtypes_never.py:86: error: Incompatible types in assignment (expression has type "list[Never]", variable has type "list[int]") [assignment] 5 | specialtypes_never.py:86: note: "List" is invariant -- see https://mypy.readthedocs.io/en/stable/common_issues.html#variance 6 | specialtypes_never.py:86: note: Consider using "Sequence" instead, which is covariant 7 | specialtypes_never.py:105: error: Incompatible return value type (got "ClassC[Never]", expected "ClassC[U]") [return-value] 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/mypy/specialtypes_none.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_none.py:21: error: Argument 1 to "func1" has incompatible type "type[None]"; expected "None" [arg-type] 4 | specialtypes_none.py:27: error: Incompatible types in assignment (expression has type "None", variable has type "Iterable[Any]") [assignment] 5 | specialtypes_none.py:41: error: Argument 1 to "func2" has incompatible type "None"; expected "type[None]" [arg-type] 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/mypy/specialtypes_promotions.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_promotions.py:13: error: "float" has no attribute "numerator" [attr-defined] 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/tuples_unpacked.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | "More than one unpack" error is missing a line number. 4 | """ 5 | output = """ 6 | tuples_unpacked.py: error: More than one Unpack in a type is not allowed [misc] 7 | tuples_unpacked.py:59: error: More than one Unpack in a type is not allowed [misc] 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 40: Expected 1 errors 12 | Line 41: Expected 1 errors 13 | Line 51: Expected 1 errors 14 | Lines 60, 61: Expected error (tag 't14') 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_alt_syntax.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not support keyword-argument form of alternative syntax (deprecated in 3.11). 4 | """ 5 | output = """ 6 | typeddicts_alt_syntax.py:23: error: TypedDict() expects a dictionary literal as the second argument [misc] 7 | typeddicts_alt_syntax.py:27: error: Invalid TypedDict() field name [misc] 8 | typeddicts_alt_syntax.py:31: error: First argument "WrongName" to TypedDict() does not match variable name "BadTypedDict3" [name-match] 9 | typeddicts_alt_syntax.py:35: error: Too many arguments for TypedDict() [misc] 10 | typeddicts_alt_syntax.py:41: error: Unexpected arguments to TypedDict() [misc] 11 | typeddicts_alt_syntax.py:44: error: Extra keys ("name", "year") for TypedDict "Movie2" [typeddict-unknown-key] 12 | typeddicts_alt_syntax.py:45: error: Extra keys ("name", "year") for TypedDict "Movie2" [typeddict-unknown-key] 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_class_syntax.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_class_syntax.py:29: error: Invalid statement in TypedDict definition; expected "field_name: field_type" [misc] 4 | typeddicts_class_syntax.py:33: error: Invalid statement in TypedDict definition; expected "field_name: field_type" [misc] 5 | typeddicts_class_syntax.py:38: error: Invalid statement in TypedDict definition; expected "field_name: field_type" [misc] 6 | typeddicts_class_syntax.py:44: error: Unexpected keyword argument "metaclass" for "__init_subclass__" of "TypedDict" [call-arg] 7 | typeddicts_class_syntax.py:49: error: Unexpected keyword argument "other" for "__init_subclass__" of "TypedDict" [call-arg] 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_final.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_inheritance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_inheritance.py:44: error: All bases of a new TypedDict must be TypedDict types [misc] 4 | typeddicts_inheritance.py:55: error: Overwriting TypedDict field "x" while extending [misc] 5 | typeddicts_inheritance.py:65: error: Overwriting TypedDict field "x" while merging [misc] 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_operations.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_operations.py:22: error: Value of "name" has incompatible type "int"; expected "str" [typeddict-item] 4 | typeddicts_operations.py:23: error: Value of "year" has incompatible type "str"; expected "int" [typeddict-item] 5 | typeddicts_operations.py:24: error: TypedDict "Movie" has no key "other" [typeddict-unknown-key] 6 | typeddicts_operations.py:26: error: TypedDict "Movie" has no key "other" [typeddict-item] 7 | typeddicts_operations.py:28: error: Missing key "year" for TypedDict "Movie" [typeddict-item] 8 | typeddicts_operations.py:29: error: Incompatible types (expression has type "float", TypedDict item "year" has type "int") [typeddict-item] 9 | typeddicts_operations.py:32: error: Extra key "other" for TypedDict "Movie" [typeddict-unknown-key] 10 | typeddicts_operations.py:37: error: Expected TypedDict key to be string literal [misc] 11 | typeddicts_operations.py:47: error: "Movie" has no attribute "clear" [attr-defined] 12 | typeddicts_operations.py:49: error: Key "name" of TypedDict "Movie" cannot be deleted [misc] 13 | typeddicts_operations.py:62: error: "MovieOptional" has no attribute "clear" [attr-defined] 14 | """ 15 | conformance_automated = "Pass" 16 | errors_diff = """ 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_readonly.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly.py:24: error: ReadOnly TypedDict key "members" TypedDict is mutated [typeddict-readonly-mutated] 4 | typeddicts_readonly.py:36: error: ReadOnly TypedDict key "members" TypedDict is mutated [typeddict-readonly-mutated] 5 | typeddicts_readonly.py:50: error: ReadOnly TypedDict key "title" TypedDict is mutated [typeddict-readonly-mutated] 6 | typeddicts_readonly.py:51: error: ReadOnly TypedDict key "year" TypedDict is mutated [typeddict-readonly-mutated] 7 | typeddicts_readonly.py:60: error: ReadOnly TypedDict key "title" TypedDict is mutated [typeddict-readonly-mutated] 8 | typeddicts_readonly.py:61: error: ReadOnly TypedDict key "year" TypedDict is mutated [typeddict-readonly-mutated] 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_readonly_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_consistency.py:37: error: Incompatible types in assignment (expression has type "A1", variable has type "B1") [assignment] 4 | typeddicts_readonly_consistency.py:38: error: Incompatible types in assignment (expression has type "C1", variable has type "B1") [assignment] 5 | typeddicts_readonly_consistency.py:40: error: Incompatible types in assignment (expression has type "A1", variable has type "C1") [assignment] 6 | typeddicts_readonly_consistency.py:81: error: Incompatible types in assignment (expression has type "A2", variable has type "B2") [assignment] 7 | typeddicts_readonly_consistency.py:82: error: Incompatible types in assignment (expression has type "C2", variable has type "B2") [assignment] 8 | typeddicts_readonly_consistency.py:84: error: Incompatible types in assignment (expression has type "A2", variable has type "C2") [assignment] 9 | typeddicts_readonly_consistency.py:85: error: Incompatible types in assignment (expression has type "B2", variable has type "C2") [assignment] 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_readonly_kwargs.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_kwargs.py:33: error: ReadOnly TypedDict key "key1" TypedDict is mutated [typeddict-readonly-mutated] 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_readonly_update.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Incorrectly allows update of ReadOnly item. 4 | Incorrectly rejects update involving an item with Never type. 5 | """ 6 | output = """ 7 | typeddicts_readonly_update.py:34: error: Argument 1 to "update" of "TypedDict" has incompatible type "B"; expected "TypedDict({'x'?=: int, 'y': int})" [typeddict-item] 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 23: Expected 1 errors 12 | Line 34: Unexpected errors ['typeddicts_readonly_update.py:34: error: Argument 1 to "update" of "TypedDict" has incompatible type "B"; expected "TypedDict({\\'x\\'?=: int, \\'y\\': int})" [typeddict-item]'] 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_required.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_required.py:12: error: Required[] can be only used in a TypedDict definition [valid-type] 4 | typeddicts_required.py:19: error: NotRequired[] can be only used in a TypedDict definition [valid-type] 5 | typeddicts_required.py:62: error: "Required[]" type cannot be nested [valid-type] 6 | typeddicts_required.py:63: error: "NotRequired[]" type cannot be nested [valid-type] 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/mypy/typeddicts_usage.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_usage.py:23: error: TypedDict "Movie" has no key "director" [typeddict-unknown-key] 4 | typeddicts_usage.py:24: error: Value of "year" has incompatible type "str"; expected "int" [typeddict-item] 5 | typeddicts_usage.py:28: error: Missing key "name" for TypedDict "Movie" [typeddict-item] 6 | typeddicts_usage.py:28: error: Extra key "title" for TypedDict "Movie" [typeddict-unknown-key] 7 | typeddicts_usage.py:35: error: Cannot use isinstance() with TypedDict type [misc] 8 | typeddicts_usage.py:40: error: Variable "typing.TypedDict" is not valid as a type [valid-type] 9 | typeddicts_usage.py:40: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/mypy/version.toml: -------------------------------------------------------------------------------- 1 | version = "mypy 1.15.0" 2 | test_duration = 1.5 3 | -------------------------------------------------------------------------------- /conformance/results/pyre/aliases_variance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | aliases_variance.py:24:0 Invalid type variance [46]: The type variable `Variable[T_co](covariant)` is incompatible with parent class type variable `Variable[T](invariant)` because subclasses cannot use more permissive type variables than their superclasses. 4 | aliases_variance.py:28:0 Invalid type variance [46]: The type variable `Variable[T_co](covariant)` is incompatible with parent class type variable `Variable[T](invariant)` because subclasses cannot use more permissive type variables than their superclasses. 5 | aliases_variance.py:32:0 Invalid type variance [46]: The type variable `Variable[T_co](covariant)` is incompatible with parent class type variable `Variable[T](invariant)` because subclasses cannot use more permissive type variables than their superclasses. 6 | aliases_variance.py:44:0 Invalid type variance [46]: The type variable `Variable[T_contra](contravariant)` is incompatible with parent class type variable `Variable[T](invariant)` because subclasses cannot use more permissive type variables than their superclasses. 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/annotations_coroutines.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyre/annotations_methods.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. 4 | """ 5 | output = """ 6 | annotations_methods.py:42:0 Assert type [70]: Expected `A` but got `B`. 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/classes_override.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | classes_override.py:53:4 Invalid override [40]: `classes_override.ChildA.method3` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. 6 | classes_override.py:65:4 Incompatible overload [43]: This definition does not have the same decorators as the preceding overload(s). 7 | classes_override.py:65:4 Invalid override [40]: `classes_override.ChildA.method4` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. 8 | classes_override.py:79:4 Invalid override [40]: `classes_override.ChildA.static_method1` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. 9 | classes_override.py:84:4 Invalid override [40]: `classes_override.ChildA.class_method1` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. 10 | classes_override.py:89:4 Invalid override [40]: `classes_override.ChildA.property1` is decorated with @override, but no method of the same name exists in superclasses of `ChildA`. 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/constructors_call_metaclass.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not evaluate __new__ if metaclass __call__ is defined. 4 | """ 5 | conformance_automated = "Fail" 6 | errors_diff = """ 7 | Line 51: Expected 1 errors 8 | Line 65: Expected 1 errors 9 | """ 10 | output = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/constructors_call_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | constructors_call_type.py:30:4 Missing argument [20]: Call `Meta1.__call__` expects argument `x`. 6 | constructors_call_type.py:40:4 Missing argument [20]: Call `Class2.__new__` expects argument `x`. 7 | constructors_call_type.py:50:4 Missing argument [20]: Call `Class3.__init__` expects argument `x`. 8 | constructors_call_type.py:59:4 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided. 9 | constructors_call_type.py:64:4 Too many arguments [19]: Call `object.__init__` expects 0 positional arguments, 1 was provided. 10 | constructors_call_type.py:72:4 Missing argument [20]: Call `Meta1.__call__` expects argument `x`. 11 | constructors_call_type.py:81:4 Missing argument [20]: Call `Class2.__new__` expects argument `y`. 12 | constructors_call_type.py:82:11 Incompatible parameter type [6]: In call `Class2.__new__`, for 2nd positional argument, expected `str` but got `int`. 13 | """ 14 | conformance_automated = "Pass" 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/constructors_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not report inconsistency between __new__ and __init__ (optional). 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | output = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_final.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | dataclasses_final.py:27:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_classvar`. 7 | dataclasses_final.py:35:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_no_default`. 8 | dataclasses_final.py:36:0 Invalid assignment [41]: Cannot reassign final attribute `d.final_with_default`. 9 | dataclasses_final.py:37:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_no_default`. 10 | dataclasses_final.py:38:0 Invalid assignment [41]: Cannot reassign final attribute `D.final_with_default`. 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_frozen.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_frozen.py:16:0 Invalid assignment [41]: Cannot reassign final attribute `dc1.a`. 4 | dataclasses_frozen.py:17:0 Invalid assignment [41]: Cannot reassign final attribute `dc1.b`. 5 | dataclasses_frozen.py:23:0 Invalid inheritance [39]: Non-frozen dataclass `DC2` cannot inherit from frozen dataclass `DC1`. 6 | dataclasses_frozen.py:33:0 Invalid inheritance [39]: Frozen dataclass `DC4` cannot inherit from non-frozen dataclass `DC3`. 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_hash.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report when dataclass is not compatible with Hashable protocol. 4 | """ 5 | output = """ 6 | """ 7 | conformance_automated = "Fail" 8 | errors_diff = """ 9 | Line 15: Expected 1 errors 10 | Line 32: Expected 1 errors 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_inheritance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject ClassVar that is overridden by instance variable. 4 | Does not reject instance variable that is overridden by ClassVar. 5 | """ 6 | output = """ 7 | """ 8 | conformance_automated = "Fail" 9 | errors_diff = """ 10 | Line 60: Expected 1 errors 11 | Line 64: Expected 1 errors 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_kwonly.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Rejects legitimate use of dataclass field with `kw_only=True`. 4 | """ 5 | output = """ 6 | dataclasses_kwonly.py:23:0 Too many arguments [19]: Call `DC1.__init__` expects 1 positional argument, 2 were provided. 7 | dataclasses_kwonly.py:38:0 Too many arguments [19]: Call `DC2.__init__` expects 1 positional argument, 2 were provided. 8 | dataclasses_kwonly.py:53:0 Too many arguments [19]: Call `DC3.__init__` expects 1 positional argument, 2 were provided. 9 | dataclasses_kwonly.py:61:0 Unexpected keyword [28]: Unexpected keyword argument `b` to call `DC4.__init__`. 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 61: Unexpected errors ['dataclasses_kwonly.py:61:0 Unexpected keyword [28]: Unexpected keyword argument `b` to call `DC4.__init__`.'] 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_order.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_order.py:50:3 Unsupported operand [58]: `<` is not supported for operand types `DC1` and `DC2`. 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyre/dataclasses_slots.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report error when `slots=True` is used with `__slots__` definition. 4 | Does not reject write to instance variable that is not defined in __slots__. 5 | Does not reject access to `__slots__` from dataclass instance when `slots=False`. 6 | """ 7 | output = """ 8 | dataclasses_slots.py:66:0 Undefined attribute [16]: `DC6` has no attribute `__slots__`. 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 25: Expected 1 errors 13 | Line 38: Expected 1 errors 14 | Line 69: Expected 1 errors 15 | Lines 10, 11: Expected error (tag 'DC1') 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_assert_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | directives_assert_type.py:27:4 Assert type [70]: Expected `int` but got `Union[int, str]`. 6 | directives_assert_type.py:28:4 Assert type [70]: Expected `int` but got `typing.Any`. 7 | directives_assert_type.py:29:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal[4]`. 8 | directives_assert_type.py:31:4 Missing argument [20]: Call `assert_type` expects argument in position 0. 9 | directives_assert_type.py:32:4 Assert type [70]: Expected `int` but got `typing_extensions.Literal['']`. 10 | directives_assert_type.py:33:4 Too many arguments [19]: Call `assert_type` expects 2 positional arguments, 3 were provided. 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_cast.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_cast.py:15:7 Missing argument [20]: Call `cast` expects argument `typ`. 4 | directives_cast.py:16:12 Invalid type [31]: Expression `1` is not a valid type. 5 | directives_cast.py:17:7 Too many arguments [19]: Call `cast` expects 2 positional arguments, 3 were provided. 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_deprecated.toml: -------------------------------------------------------------------------------- 1 | conformant = "Unsupported" 2 | notes = """ 3 | Does not support @deprecated. 4 | """ 5 | conformance_automated = "Fail" 6 | errors_diff = """ 7 | Line 18: Expected 1 errors 8 | Line 24: Expected 1 errors 9 | Line 25: Expected 1 errors 10 | Line 30: Expected 1 errors 11 | Line 41: Expected 1 errors 12 | Line 42: Expected 1 errors 13 | Line 44: Expected 1 errors 14 | Line 47: Expected 1 errors 15 | Line 48: Expected 1 errors 16 | Line 58: Expected 1 errors 17 | Line 69: Expected 1 errors 18 | Line 98: Expected 1 errors 19 | """ 20 | output = """ 21 | """ 22 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_no_type_check.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not honor @no_type_check decorator. 4 | """ 5 | output = """ 6 | directives_no_type_check.py:15:4 Incompatible attribute type [8]: Attribute `x` declared in class `ClassA` has type `int` but is used as type `str`. 7 | directives_no_type_check.py:25:12 Unsupported operand [58]: `+` is not supported for operand types `int` and `str`. 8 | directives_no_type_check.py:26:4 Incompatible return type [7]: Expected `None` but got `int`. 9 | directives_no_type_check.py:29:6 Incompatible parameter type [6]: In call `func1`, for 1st positional argument, expected `int` but got `bytes`. 10 | directives_no_type_check.py:29:18 Incompatible parameter type [6]: In call `func1`, for 2nd positional argument, expected `str` but got `bytes`. 11 | directives_no_type_check.py:32:0 Missing argument [20]: Call `func1` expects argument `a`. 12 | """ 13 | conformance_automated = "Pass" 14 | errors_diff = """ 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_reveal_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | directives_reveal_type.py:14:4 Revealed type [-1]: Revealed type for `a` is `typing.Union[int, str]`. 6 | directives_reveal_type.py:15:4 Revealed type [-1]: Revealed type for `b` is `typing.List[int]`. 7 | directives_reveal_type.py:16:4 Revealed type [-1]: Revealed type for `c` is `typing.Any`. 8 | directives_reveal_type.py:17:4 Revealed type [-1]: Revealed type for `d` is `ForwardReference`. 9 | directives_reveal_type.py:19:4 Missing argument [20]: Call `reveal_type` expects argument in position 0. 10 | directives_reveal_type.py:20:4 Too many arguments [19]: Call `reveal_type` expects 1 positional argument, 2 were provided. 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_type_checking.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_type_ignore.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_type_ignore_file1.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_type_ignore_file2.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_type_ignore_file2.py:14:0 Incompatible variable type [9]: x is declared to have type `int` but is used as type `str`. 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyre/directives_version_platform.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | directives_version_platform.py:40:4 Incompatible variable type [9]: val7 is declared to have type `int` but is used as type `str`. 6 | directives_version_platform.py:45:4 Incompatible variable type [9]: val8 is declared to have type `int` but is used as type `str`. 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/enums_behaviors.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | output = """ 8 | enums_behaviors.py:39:0 Invalid inheritance [39]: Cannot inherit from final enum `Shape`. Enums with defined members cannot be extended. 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyre/enums_definition.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | output = """ 8 | enums_definition.py:24:9 Too many arguments [19]: Call `Enum.__new__` expects 1 positional argument, 4 were provided. 9 | enums_definition.py:27:9 Too many arguments [19]: Call `Enum.__new__` expects 1 positional argument, 2 were provided. 10 | enums_definition.py:28:9 Too many arguments [19]: Call `Enum.__new__` expects 1 positional argument, 2 were provided. 11 | enums_definition.py:31:9 Too many arguments [19]: Call `Enum.__new__` expects 1 positional argument, 2 were provided. 12 | enums_definition.py:33:12 Undefined attribute [16]: `Enum` has no attribute `RED`. 13 | enums_definition.py:38:0 Assert type [70]: Expected `typing_extensions.Literal[Color7.RED]` but got `unknown`. 14 | enums_definition.py:38:12 Undefined attribute [16]: `Color7` has no attribute `RED`. 15 | enums_definition.py:39:0 Assert type [70]: Expected `typing_extensions.Literal[Color8.RED]` but got `unknown`. 16 | enums_definition.py:39:12 Undefined attribute [16]: `Color8` has no attribute `RED`. 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/pyre/enums_expansion.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | output = """ 8 | enums_expansion.py:25:8 Assert type [70]: Expected `typing_extensions.Literal[Color.GREEN]` but got `Color`. 9 | enums_expansion.py:35:12 Assert type [70]: Expected `Never` but got `Color`. 10 | enums_expansion.py:53:8 Assert type [70]: Expected `typing_extensions.Literal[CustomFlags.FLAG3]` but got `CustomFlags`. 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/enums_member_names.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not support special-cased handling of member name literal types (optional). 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | output = """ 9 | enums_member_names.py:21:0 Assert type [70]: Expected `typing_extensions.Literal['RED']` but got `str`. 10 | enums_member_names.py:22:0 Assert type [70]: Expected `typing_extensions.Literal['RED']` but got `str`. 11 | enums_member_names.py:26:4 Assert type [70]: Expected `Union[typing_extensions.Literal['BLUE'], typing_extensions.Literal['RED']]` but got `str`. 12 | enums_member_names.py:30:4 Assert type [70]: Expected `Union[typing_extensions.Literal['BLUE'], typing_extensions.Literal['GREEN'], typing_extensions.Literal['RED']]` but got `str`. 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyre/exceptions_context_managers.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | assert_type causes failures. 4 | """ 5 | conformance_automated = "Fail" 6 | errors_diff = """ 7 | Line 50: Unexpected errors ['exceptions_context_managers.py:50:4 Assert type [70]: Expected `Union[int, str]` but got `str`.'] 8 | Line 57: Unexpected errors ['exceptions_context_managers.py:57:4 Assert type [70]: Expected `Union[int, str]` but got `str`.'] 9 | """ 10 | output = """ 11 | exceptions_context_managers.py:50:4 Assert type [70]: Expected `Union[int, str]` but got `str`. 12 | exceptions_context_managers.py:57:4 Assert type [70]: Expected `Union[int, str]` but got `str`. 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_base_class.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject illegal use of Generic. 4 | Does not allow using generic in assert_type expression. 5 | Does not detect inconsistent type variable ordering. 6 | """ 7 | output = """ 8 | generics_base_class.py:26:25 Incompatible parameter type [6]: In call `takes_dict_incorrect`, for 1st positional argument, expected `Dict[str, List[object]]` but got `SymbolTable`. 9 | generics_base_class.py:49:21 Invalid type parameters [24]: Generic type `LinkedList` expects 1 type parameter, received 2. 10 | generics_base_class.py:61:17 Invalid type parameters [24]: Generic type `MyDict` expects 1 type parameter, received 2. 11 | generics_base_class.py:68:0 Duplicate type variables [59]: Duplicate type variable `T` in Generic[...]. 12 | """ 13 | conformance_automated = "Fail" 14 | errors_diff = """ 15 | Line 29: Expected 1 errors 16 | Line 30: Expected 1 errors 17 | Line 98: Expected 1 errors 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_self_attributes.toml: -------------------------------------------------------------------------------- 1 | conformant = "Unsupported" 2 | notes = """ 3 | Does not understand `Self` type. 4 | """ 5 | output = """ 6 | generics_self_attributes.py:16:10 Undefined or invalid type [11]: Annotation `Self` is not defined as a type. 7 | generics_self_attributes.py:26:5 Unexpected keyword [28]: Unexpected keyword argument `next` to call `OrdinalLinkedList.__init__`. 8 | generics_self_attributes.py:29:14 Unexpected keyword [28]: Unexpected keyword argument `next` to call `OrdinalLinkedList.__init__`. 9 | generics_self_attributes.py:32:14 Unexpected keyword [28]: Unexpected keyword argument `next` to call `LinkedList.__init__`. 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 16: Unexpected errors ['generics_self_attributes.py:16:10 Undefined or invalid type [11]: Annotation `Self` is not defined as a type.'] 14 | Line 29: Unexpected errors ['generics_self_attributes.py:29:14 Unexpected keyword [28]: Unexpected keyword argument `next` to call `OrdinalLinkedList.__init__`.'] 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_self_protocols.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject protocol compatibility due to method `Self` return type. 4 | """ 5 | output = """ 6 | generics_self_protocols.py:61:18 Incompatible parameter type [6]: In call `accepts_shape`, for 1st positional argument, expected `ShapeProtocol` but got `BadReturnType`. 7 | """ 8 | conformance_automated = "Fail" 9 | errors_diff = """ 10 | Line 64: Expected 1 errors 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_syntax_compatibility.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | False negative on mixing legacy and PEP695 syntax. 4 | Does not detect mixing legacy and PEP695 syntax in methods. 5 | """ 6 | output = """ 7 | generics_syntax_compatibility.py:14:16 Invalid type variable [34]: The current class isn't generic with respect to the type variable `Variable[K]`. To reference the type variable, you can modify the class to inherit from `typing.Generic[K]`. 8 | generics_syntax_compatibility.py:18:19 Invalid type variable [34]: The current class isn't generic with respect to the type variable `Variable[K]`. To reference the type variable, you can modify the class to inherit from `typing.Generic[K]`. 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 26: Expected 1 errors 13 | Line 18: Unexpected errors ["generics_syntax_compatibility.py:18:19 Invalid type variable [34]: The current class isn't generic with respect to the type variable `Variable[K]`. To reference the type variable, you can modify the class to inherit from `typing.Generic[K]`."] 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_syntax_declarations.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not detect incorrect use of legacy style syntax mixed with PEP695 syntax. 4 | False negatives due to assert_type use. 5 | """ 6 | output = """ 7 | generics_syntax_declarations.py:32:8 Undefined attribute [16]: `Variable[T (bound to str)]` has no attribute `is_integer`. 8 | generics_syntax_declarations.py:44:20 Invalid bound [75]: `dict[(str, V)]` is not valid bound. 9 | generics_syntax_declarations.py:48:16 Invalid bound [75]: `[str, int]` is not valid bound. 10 | generics_syntax_declarations.py:60:16 Invalid bound [75]: `()` is not valid bound. 11 | generics_syntax_declarations.py:64:16 Invalid bound [75]: `(str)` is not valid bound. 12 | generics_syntax_declarations.py:71:16 Invalid bound [75]: `$local_generics_syntax_declarations$t1` is not valid bound. 13 | generics_syntax_declarations.py:75:16 Invalid bound [75]: `(3, bytes)` is not valid bound. 14 | generics_syntax_declarations.py:79:16 Invalid bound [75]: `(list[S], str)` is not valid bound. 15 | """ 16 | conformance_automated = "Fail" 17 | errors_diff = """ 18 | Line 17: Expected 1 errors 19 | Line 25: Expected 1 errors 20 | """ 21 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_typevartuple_callable.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | False negatives due to assert_type. 4 | """ 5 | output = """ 6 | generics_typevartuple_callable.py:26:8 Incompatible parameter type [6]: In call `Process.__init__`, for argument `target`, expected `typing.Callable[[Variable(*generics_typevartuple_callable.Ts)], None]` but got `typing.Callable(func1)[[Named(arg1, int), Named(arg2, str)], None]`. 7 | generics_typevartuple_callable.py:49:0 Assert type [70]: Expected `Tuple[float, str, complex]` but got `Tuple[float, typing_extensions.Literal[''], complex]`. 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 49: Unexpected errors ["generics_typevartuple_callable.py:49:0 Assert type [70]: Expected `Tuple[float, str, complex]` but got `Tuple[float, typing_extensions.Literal[''], complex]`."] 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_typevartuple_concat.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | False negatives due to assert_type. 4 | False compatability error message. 5 | """ 6 | output = """ 7 | generics_typevartuple_concat.py:52:0 Assert type [70]: Expected `Tuple[int, bool, str]` but got `Tuple[typing_extensions.Literal[0], typing_extensions.Literal[True], typing_extensions.Literal['a']]`. 8 | generics_typevartuple_concat.py:56:4 Incompatible return type [7]: Expected `typing.Tuple[*generics_typevartuple_concat.Ts, Variable[T]]` but got `typing.Tuple[*Tuple[object, ...], object]`. 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 52: Unexpected errors ["generics_typevartuple_concat.py:52:0 Assert type [70]: Expected `Tuple[int, bool, str]` but got `Tuple[typing_extensions.Literal[0], typing_extensions.Literal[True], typing_extensions.Literal['a']]`."] 13 | Line 56: Unexpected errors ['generics_typevartuple_concat.py:56:4 Incompatible return type [7]: Expected `typing.Tuple[*generics_typevartuple_concat.Ts, Variable[T]]` but got `typing.Tuple[*Tuple[object, ...], object]`.'] 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_typevartuple_overloads.toml: -------------------------------------------------------------------------------- 1 | conformant = "Unsupported" 2 | notes = """ 3 | Does not support star expressions for `Unpack`. 4 | """ 5 | output = """ 6 | generics_typevartuple_overloads.py:18:4 Incompatible overload [43]: The implementation of `Array.transpose` does not accept all possible arguments of overload defined on line `18`. 7 | generics_typevartuple_overloads.py:22:4 Incompatible overload [43]: The implementation of `Array.transpose` does not accept all possible arguments of overload defined on line `22`. 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 18: Unexpected errors ['generics_typevartuple_overloads.py:18:4 Incompatible overload [43]: The implementation of `Array.transpose` does not accept all possible arguments of overload defined on line `18`.'] 12 | Line 22: Unexpected errors ['generics_typevartuple_overloads.py:22:4 Incompatible overload [43]: The implementation of `Array.transpose` does not accept all possible arguments of overload defined on line `22`.'] 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_typevartuple_unpack.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | generics_typevartuple_unpack.py:30:27 Incompatible parameter type [6]: In call `process_batch_channels`, for 1st positional argument, expected `Array[Batch, *Tuple[typing.Any, ...], Channels]` but got `Array[Batch]`. 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyre/generics_upper_bound.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | False positives on valid type expression (`list[T]`) in `bound`. 4 | Does not complain when bound is used alongside type constraints. 5 | """ 6 | output = """ 7 | generics_upper_bound.py:51:7 Incompatible parameter type [6]: In call `longer`, for 1st positional argument, expected `Variable[ST (bound to Sized)]` but got `int`. 8 | generics_upper_bound.py:51:10 Incompatible parameter type [6]: In call `longer`, for 2nd positional argument, expected `Variable[ST (bound to Sized)]` but got `int`. 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 24: Expected 1 errors 13 | Line 56: Expected 1 errors 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/historical_positional.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | historical_positional.py:18:0 Unexpected keyword [28]: Unexpected keyword argument `__x` to call `f1`. 6 | historical_positional.py:26:15 Invalid positional-only parameter [69]: Positional-only parameters cannot appear after parameters that accept keyword arguments. 7 | historical_positional.py:38:25 Invalid positional-only parameter [69]: Positional-only parameters cannot appear after parameters that accept keyword arguments. 8 | historical_positional.py:43:0 Unexpected keyword [28]: Unexpected keyword argument `__x` to call `A.m1`. 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyre/literals_interactions.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not detect out-of-bound tuple literal index. 4 | Does not perform exhaustiveness checks on enums. 5 | Does not narrow type of `x` with `x in Literal` type guard pattern. 6 | Does not narrow type of `x` with `x == Literal` type guard pattern. 7 | """ 8 | output = """ 9 | literals_interactions.py:15:4 Invalid tuple index [73]: Index 5 is out of bounds for concrete tuple with 3 members. 10 | literals_interactions.py:16:4 Invalid tuple index [73]: Index -5 is out of bounds for concrete tuple with 3 members. 11 | literals_interactions.py:17:4 Invalid tuple index [73]: Index 4 is out of bounds for concrete tuple with 3 members. 12 | literals_interactions.py:18:4 Invalid tuple index [73]: Index -4 is out of bounds for concrete tuple with 3 members. 13 | literals_interactions.py:93:8 Assert type [70]: Expected `str` but got `Union[Status, str]`. 14 | """ 15 | conformance_automated = "Fail" 16 | errors_diff = """ 17 | Line 93: Unexpected errors ['literals_interactions.py:93:8 Assert type [70]: Expected `str` but got `Union[Status, str]`.'] 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyre/literals_semantics.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | literals_semantics.py:10:0 Incompatible variable type [9]: v2 is declared to have type `typing_extensions.Literal[3]` but is used as type `typing_extensions.Literal[4]`. 4 | literals_semantics.py:24:4 Incompatible variable type [9]: x1 is declared to have type `typing_extensions.Literal[False]` but is used as type `typing_extensions.Literal[0]`. 5 | literals_semantics.py:25:4 Incompatible variable type [9]: x2 is declared to have type `typing_extensions.Literal[0]` but is used as type `typing_extensions.Literal[False]`. 6 | literals_semantics.py:33:4 Incompatible variable type [9]: a is declared to have type `Union[typing_extensions.Literal[3], typing_extensions.Literal[4], typing_extensions.Literal[5]]` but is used as type `int`. 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/namedtuples_type_compat.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | namedtuples_type_compat.py:22:0 Incompatible variable type [9]: Unable to unpack `Point`, expected a tuple. 6 | namedtuples_type_compat.py:23:0 Incompatible variable type [9]: Unable to unpack `Point`, expected a tuple. 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/namedtuples_usage.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | """ 4 | output = """ 5 | namedtuples_usage.py:34:6 Invalid tuple index [73]: Index 3 is out of bounds for concrete tuple with 3 members. 6 | namedtuples_usage.py:35:6 Invalid tuple index [73]: Index -4 is out of bounds for concrete tuple with 3 members. 7 | namedtuples_usage.py:40:0 Invalid assignment [41]: Cannot reassign final attribute `p.x`. 8 | namedtuples_usage.py:41:0 Undefined attribute [16]: `Point` has no attribute `__setitem__`. 9 | namedtuples_usage.py:42:0 Unable to delete tuple member [72]: Tuples are immutable, so their members may not be deleted. 10 | namedtuples_usage.py:43:0 Unable to delete tuple member [72]: Tuples are immutable, so their members may not be deleted. 11 | namedtuples_usage.py:52:0 Unable to unpack [23]: Unable to unpack 3 values, 2 were expected. 12 | namedtuples_usage.py:53:0 Unable to unpack [23]: Unable to unpack 3 values, 4 were expected. 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/pyre/narrowing_typeguard.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | narrowing_typeguard.py:102:22 Invalid type guard [68]: User-defined type guard functions or methods must have at least one input parameter. 6 | narrowing_typeguard.py:107:21 Invalid type guard [68]: User-defined type guard functions or methods must have at least one input parameter. 7 | narrowing_typeguard.py:128:19 Incompatible parameter type [6]: In call `takes_callable_str`, for 1st positional argument, expected `typing.Callable[[object], str]` but got `typing.Callable(simple_typeguard)[[Named(val, object)], TypeGuard[int]]`. 8 | narrowing_typeguard.py:148:25 Incompatible parameter type [6]: In call `takes_callable_str_proto`, for 1st positional argument, expected `CallableStrProto` but got `typing.Callable(simple_typeguard)[[Named(val, object)], TypeGuard[int]]`. 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyre/overloads_basic.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | overloads_basic.py:39:2 Incompatible parameter type [6]: In call `Bytes.__getitem__`, for 1st positional argument, expected `int` but got `str`. 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_class_objects.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject protocol class assigned to type[Proto]. 4 | Incorrectly reports some class objects as incompatible with a protocol. 5 | Fails to report some class objects as incompatible with a protocol. 6 | """ 7 | output = """ 8 | protocols_class_objects.py:26:11 Invalid class instantiation [45]: Cannot instantiate abstract class `Proto` with abstract method `meth`. 9 | protocols_class_objects.py:58:0 Incompatible variable type [9]: pa1 is declared to have type `ProtoA1` but is used as type `Type[ConcreteA]`. 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 29: Expected 1 errors 14 | Line 34: Expected 1 errors 15 | Line 74: Expected 1 errors 16 | Line 104: Expected 1 errors 17 | Line 106: Expected 1 errors 18 | Line 107: Expected 1 errors 19 | Line 108: Expected 1 errors 20 | Line 26: Unexpected errors ['protocols_class_objects.py:26:11 Invalid class instantiation [45]: Cannot instantiate abstract class `Proto` with abstract method `meth`.'] 21 | """ 22 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_explicit.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report error when calling unimplemented protocol method from derived class. 4 | Does not report error when method is not implemented in derived class. 5 | """ 6 | output = """ 7 | protocols_explicit.py:60:4 Invalid class instantiation [45]: Cannot instantiate abstract class `Point` with abstract method `intensity`. 8 | protocols_explicit.py:165:6 Invalid class instantiation [45]: Cannot instantiate abstract class `Concrete7A` with abstract method `method1`. 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 27: Expected 1 errors 13 | Line 56: Expected 1 errors 14 | Line 90: Expected 1 errors 15 | Line 110: Expected 1 errors 16 | Line 135: Expected 1 errors 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_merging.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | protocols_merging.py:52:0 Incompatible variable type [9]: s6 is declared to have type `SizedAndClosable1` but is used as type `SCConcrete2`. 6 | protocols_merging.py:53:0 Incompatible variable type [9]: s7 is declared to have type `SizedAndClosable2` but is used as type `SCConcrete2`. 7 | protocols_merging.py:54:0 Incompatible variable type [9]: s8 is declared to have type `SizedAndClosable3` but is used as type `SCConcrete2`. 8 | protocols_merging.py:67:15 Invalid inheritance [39]: If Protocol is included as a base class, all other base classes must be protocols or Generic. 9 | protocols_merging.py:82:4 Invalid class instantiation [45]: Cannot instantiate abstract class `SizedAndClosable4` with abstract method `close`. 10 | protocols_merging.py:83:0 Incompatible variable type [9]: y is declared to have type `SizedAndClosable4` but is used as type `SCConcrete1`. 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_modules.toml: -------------------------------------------------------------------------------- 1 | conformant = "Unsupported" 2 | notes = """ 3 | Does not perform protocol checks for modules. 4 | """ 5 | output = """ 6 | """ 7 | conformance_automated = "Fail" 8 | errors_diff = """ 9 | Line 26: Expected 1 errors 10 | Line 48: Expected 1 errors 11 | Line 49: Expected 1 errors 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_recursive.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_runtime_checkable.toml: -------------------------------------------------------------------------------- 1 | conformant = "Unsupported" 2 | notes = """ 3 | Does not reject isinstance or issubclass call for protocol that is not runtime_checkable. 4 | Does not reject issubclass call for data protocol. 5 | Does not report unsafe overlap for runtime_checkable protocol. 6 | """ 7 | output = """ 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 23: Expected 1 errors 12 | Line 55: Expected 1 errors 13 | Line 61: Expected 1 errors 14 | Line 88: Expected 1 errors 15 | Line 92: Expected 1 errors 16 | Line 96: Expected 1 errors 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_self.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_subtyping.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | protocols_subtyping.py:16:5 Invalid class instantiation [45]: Cannot instantiate protocol `Proto1`. 4 | protocols_subtyping.py:38:4 Incompatible variable type [9]: v2 is declared to have type `Concrete2` but is used as type `Proto2`. 5 | protocols_subtyping.py:55:4 Incompatible variable type [9]: v2 is declared to have type `Proto3` but is used as type `Proto2`. 6 | protocols_subtyping.py:79:4 Incompatible variable type [9]: v3 is declared to have type `Proto4[int, float]` but is used as type `Proto5[int]`. 7 | protocols_subtyping.py:80:4 Incompatible variable type [9]: v4 is declared to have type `Proto5[float]` but is used as type `Proto4[int, int]`. 8 | protocols_subtyping.py:102:4 Incompatible variable type [9]: v4 is declared to have type `Proto7[int, float]` but is used as type `Proto6[float, float]`. 9 | protocols_subtyping.py:103:4 Incompatible variable type [9]: v5 is declared to have type `Proto7[float, object]` but is used as type `Proto6[float, float]`. 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyre/protocols_variance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Unsupported" 2 | notes = """ 3 | Does not detect incorrect TypeVar variance within generic protocols. 4 | """ 5 | output = """ 6 | protocols_variance.py:62:17 Invalid type variance [46]: The type variable `Variable[T1_co](covariant)` is covariant and cannot be a parameter type. 7 | protocols_variance.py:72:4 Invalid type variance [46]: The type variable `Variable[T1_contra](contravariant)` is contravariant and cannot be a return type. 8 | """ 9 | conformance_automated = "Fail" 10 | errors_diff = """ 11 | Line 21: Expected 1 errors 12 | Line 40: Expected 1 errors 13 | Line 56: Expected 1 errors 14 | Line 61: Expected 1 errors 15 | Line 66: Expected 1 errors 16 | Line 71: Expected 1 errors 17 | Line 104: Expected 1 errors 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyre/specialtypes_any.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyre/specialtypes_none.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_none.py:21:6 Incompatible parameter type [6]: In call `func1`, for 1st positional argument, expected `None` but got `Type[None]`. 4 | specialtypes_none.py:27:0 Incompatible variable type [9]: none2 is declared to have type `Iterable[typing.Any]` but is used as type `None`. 5 | specialtypes_none.py:41:6 Incompatible parameter type [6]: In call `func2`, for 1st positional argument, expected `Type[None]` but got `None`. 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyre/specialtypes_promotions.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject use of attribute that is compatible only with float. 4 | """ 5 | output = """ 6 | """ 7 | conformance_automated = "Fail" 8 | errors_diff = """ 9 | Line 13: Expected 1 errors 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyre/tuples_unpacked.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | tuples_unpacked.py:40:4 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], *tuple[(int, ...)])]` is not a valid type. 6 | tuples_unpacked.py:41:4 Invalid type [31]: Expression `tuple[(*tuple[(str, *tuple[(str, ...)])], *tuple[(int, ...)])]` is not a valid type. 7 | tuples_unpacked.py:51:8 Invalid type [31]: Expression `tuple[(*tuple[(str, ...)], *Ts)]` is not a valid type. 8 | tuples_unpacked.py:59:5 Invalid type [31]: Expression `tuple[(typing.Unpack[tuple[(str, ...)]], typing.Unpack[tuple[(int, ...)]])]` is not a valid type. 9 | tuples_unpacked.py:60:5 Invalid type [31]: Expression `tuple[(typing.Unpack[tuple[(str, typing.Unpack[tuple[(str, ...)]])]], typing.Unpack[tuple[(int, ...)]])]` is not a valid type. 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_alt_syntax.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not report when name of TypedDict doesn't match assigned identifier name. 4 | Does not support keyword-argument form of alternative syntax (deprecated in 3.11). 5 | """ 6 | output = """ 7 | typeddicts_alt_syntax.py:23:16 Call error [29]: `object` is not a function. 8 | typeddicts_alt_syntax.py:41:9 Call error [29]: `object` is not a function. 9 | typeddicts_alt_syntax.py:43:8 Undefined or invalid type [11]: Annotation `Movie2` is not defined as a type. 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 27: Expected 1 errors 14 | Line 31: Expected 1 errors 15 | Line 35: Expected 1 errors 16 | Line 45: Expected 1 errors 17 | Line 43: Unexpected errors ['typeddicts_alt_syntax.py:43:8 Undefined or invalid type [11]: Annotation `Movie2` is not defined as a type.'] 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_class_syntax.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject methods within TypedDict class. 4 | Does not report when metaclass is provided. 5 | Does not report when other keyword argument is provided. 6 | Does not support generic TypedDict class. 7 | """ 8 | output = """ 9 | typeddicts_class_syntax.py:49:0 Unexpected keyword [28]: Unexpected keyword argument `other` to call `object.__init_subclass__`. 10 | """ 11 | conformance_automated = "Fail" 12 | errors_diff = """ 13 | Line 29: Expected 1 errors 14 | Line 44: Expected 1 errors 15 | Lines 33, 34: Expected error (tag 'method2') 16 | Lines 38, 39: Expected error (tag 'method3') 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_final.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not handle value with literal type as index to TypedDict object. 4 | """ 5 | output = """ 6 | typeddicts_final.py:26:17 Incompatible parameter type [6]: In call `TypedDictionary.__getitem__`, for 1st positional argument, expected `typing_extensions.Literal['name']` but got `Union[typing_extensions.Literal['name'], typing_extensions.Literal['year']]`. 7 | """ 8 | conformance_automated = "Fail" 9 | errors_diff = """ 10 | Line 26: Unexpected errors ["typeddicts_final.py:26:17 Incompatible parameter type [6]: In call `TypedDictionary.__getitem__`, for 1st positional argument, expected `typing_extensions.Literal['name']` but got `Union[typing_extensions.Literal['name'], typing_extensions.Literal['year']]`."] 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_inheritance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | typeddicts_inheritance.py:44:30 Invalid inheritance [39]: `NonTypedDict` is not a valid parent class for a typed dictionary. Expected a typed dictionary or typing.Generic. 6 | typeddicts_inheritance.py:54:0 Inconsistent override [15]: `x` overrides attribute defined in `X1` inconsistently. Type `int` is not a subtype of the overridden attribute `str`. 7 | typeddicts_inheritance.py:65:0 Invalid inheritance [39]: Field `x` has type `int` in base class `X2` and type `str` in base class `Y2`. 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_readonly.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly.py:24:16 Invalid TypedDict operation [54]: Cannot write to `Band` read-only field `members`. 4 | typeddicts_readonly.py:36:16 Invalid TypedDict operation [54]: Cannot write to `Band2` read-only field `members`. 5 | typeddicts_readonly.py:50:14 Invalid TypedDict operation [54]: Cannot write to `Movie1` read-only field `title`. 6 | typeddicts_readonly.py:51:13 Invalid TypedDict operation [54]: Cannot write to `Movie1` read-only field `year`. 7 | typeddicts_readonly.py:60:14 Invalid TypedDict operation [54]: Cannot write to `Movie2` read-only field `title`. 8 | typeddicts_readonly.py:61:13 Invalid TypedDict operation [54]: Cannot write to `Movie2` read-only field `year`. 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_readonly_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_consistency.py:37:4 Incompatible variable type [9]: v3 is declared to have type `B1` but is used as type `A1`. 4 | typeddicts_readonly_consistency.py:38:4 Incompatible variable type [9]: v4 is declared to have type `B1` but is used as type `C1`. 5 | typeddicts_readonly_consistency.py:40:4 Incompatible variable type [9]: v5 is declared to have type `C1` but is used as type `A1`. 6 | typeddicts_readonly_consistency.py:81:4 Incompatible variable type [9]: v3 is declared to have type `B2` but is used as type `A2`. 7 | typeddicts_readonly_consistency.py:82:4 Incompatible variable type [9]: v4 is declared to have type `B2` but is used as type `C2`. 8 | typeddicts_readonly_consistency.py:84:4 Incompatible variable type [9]: v5 is declared to have type `C2` but is used as type `A2`. 9 | typeddicts_readonly_consistency.py:85:4 Incompatible variable type [9]: v6 is declared to have type `C2` but is used as type `B2`. 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_readonly_kwargs.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_kwargs.py:33:21 Invalid TypedDict operation [54]: Cannot write to `ReadOnlyArgs` read-only field `key1`. 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_readonly_update.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_update.py:23:10 Incompatible parameter type [6]: In call `TypedDictionary.update`, for 1st positional argument, cannot update read-only fields of `A`. 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_required.toml: -------------------------------------------------------------------------------- 1 | conformant = "Partial" 2 | notes = """ 3 | Does not reject use of `Required` in function parameter annotation. 4 | Does not reject nested use of `Required` in type annotation. 5 | Does not support recursive TypedDict definitions. 6 | Incorrectly complains about uninitialized attributes on TypedDict definitions. 7 | Incorrectly generates "attribute not initialized" errors for TypedDict fields. 8 | """ 9 | output = """ 10 | typeddicts_required.py:15:8 Incompatible attribute type [8]: Attribute `x` declared in class `NotTypedDict` has type `Required[int]` but is used as type `int`. 11 | """ 12 | conformance_automated = "Fail" 13 | errors_diff = """ 14 | Line 12: Expected 1 errors 15 | Line 19: Expected 1 errors 16 | Line 62: Expected 1 errors 17 | Line 63: Expected 1 errors 18 | Line 15: Unexpected errors ['typeddicts_required.py:15:8 Incompatible attribute type [8]: Attribute `x` declared in class `NotTypedDict` has type `Required[int]` but is used as type `int`.'] 19 | """ 20 | -------------------------------------------------------------------------------- /conformance/results/pyre/typeddicts_usage.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not report errant use of TypedDict in `isinstance` call. 4 | Does not reject use of TypedDict as TypeVar bound. 5 | """ 6 | output = """ 7 | typeddicts_usage.py:23:6 TypedDict accessed with a missing key [27]: TypedDict `Movie` has no key `director`. 8 | typeddicts_usage.py:24:16 Invalid TypedDict operation [54]: Expected `int` to be assigned to `Movie` field `year` but got `str`. 9 | typeddicts_usage.py:28:16 TypedDict initialization error [55]: Missing required field `name` for TypedDict `Movie`. 10 | typeddicts_usage.py:35:21 TypedDict used in isinstance [71]: TypedDict classes may not be used for instance checks. 11 | typeddicts_usage.py:40:0 Undefined or invalid type [11]: Annotation `TypedDict` is not defined as a type. 12 | """ 13 | conformance_automated = "Pass" 14 | errors_diff = """ 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/pyre/version.toml: -------------------------------------------------------------------------------- 1 | version = "pyre 0.9.23" 2 | test_duration = 10.7 3 | -------------------------------------------------------------------------------- /conformance/results/pyright/aliases_variance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | aliases_variance.py:24:23 - error: Type "T_co@ClassA_1" cannot be assigned to type variable "T@ClassA" 4 |   Variance of type argument "T_co@ClassA_1" is incompatible with base class "ClassA" (reportInvalidTypeArguments) 5 | aliases_variance.py:28:26 - error: Could not specialize type "A_Alias_1[T_co@A_Alias_1]" 6 |   Variance of type argument "T_co@ClassA_2" is incompatible with "T_co@A_Alias_1" (reportInvalidTypeForm) 7 | aliases_variance.py:32:26 - error: Could not specialize type "A_Alias_2[T_co@A_Alias_2]" 8 |   Variance of type argument "T_co@ClassA_3" is incompatible with "T_co@A_Alias_2" (reportInvalidTypeForm) 9 | aliases_variance.py:44:26 - error: Could not specialize type "B_Alias_1[T_co@B_Alias_1, T_contra@B_Alias_1]" 10 |   Variance of type argument "T_contra@ClassB_1" is incompatible with "T_co@B_Alias_1" (reportInvalidTypeForm) 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/annotations_coroutines.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/annotations_methods.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Type evaluation differs from other type checkers because of ambiguity in the spec related to method bindings. 4 | """ 5 | output = """ 6 | annotations_methods.py:46:8 - error: Argument of type "A" cannot be assigned to parameter "self" of type "B" in function "copy" 7 |   "A" is not assignable to "B" (reportArgumentType) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/classes_override.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | classes_override.py:53:9 - error: Method "method3" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) 4 | classes_override.py:65:9 - error: Method "method4" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) 5 | classes_override.py:79:9 - error: Method "static_method1" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) 6 | classes_override.py:84:9 - error: Method "class_method1" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) 7 | classes_override.py:89:9 - error: Method "property1" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/constructors_call_init.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | constructors_call_init.py:21:13 - error: Argument of type "float" cannot be assigned to parameter "x" of type "int" in function "__init__" 7 |   "float" is not assignable to "int" (reportArgumentType) 8 | constructors_call_init.py:42:8 - error: Argument of type "Class2[Unknown]" cannot be assigned to parameter "x" of type "Class3 | None" in function "__init__" 9 |   Type "Class2[Unknown]" is not assignable to type "Class3 | None" 10 |     "Class2[Unknown]" is not assignable to "Class3" 11 |     "Class2[Unknown]" is not assignable to "None" (reportArgumentType) 12 | constructors_call_init.py:56:1 - error: 13 |   Could not bind method "__init__" because "Class4[str]" is not assignable to parameter "self" 14 |     "Class4[str]" is not assignable to "Class4[int]" 15 |       Type parameter "T@Class4" is invariant, but "str" is not the same as "int" (reportGeneralTypeIssues) 16 | constructors_call_init.py:107:24 - warning: Type annotation for "self" parameter of "__init__" method cannot contain class-scoped type variables (reportInvalidTypeVarUse) 17 | constructors_call_init.py:130:9 - error: Expected 0 positional arguments (reportCallIssue) 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyright/constructors_call_metaclass.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | constructors_call_metaclass.py:51:1 - error: Argument missing for parameter "x" (reportCallIssue) 6 | constructors_call_metaclass.py:65:1 - error: Argument missing for parameter "x" (reportCallIssue) 7 | """ 8 | conformance_automated = "Pass" 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/constructors_call_new.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | constructors_call_new.py:21:13 - error: Argument of type "float" cannot be assigned to parameter "x" of type "int" in function "__new__" 6 |   "float" is not assignable to "int" (reportArgumentType) 7 | constructors_call_new.py:145:1 - error: 8 |   Could not bind method "__new__" because "type[Class11[str]]" is not assignable to parameter "cls" 9 |     "type[Class11[str]]" is not assignable to "type[Class11[int]]" 10 |     Type "type[Class11[str]]" is not assignable to type "type[Class11[int]]" 11 |       Type parameter "T@Class11" is invariant, but "str" is not the same as "int" (reportGeneralTypeIssues) 12 | """ 13 | conformance_automated = "Pass" 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/constructors_call_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | constructors_call_type.py:30:5 - error: Arguments missing for parameters "x", "y" (reportCallIssue) 6 | constructors_call_type.py:40:5 - error: Arguments missing for parameters "x", "y" (reportCallIssue) 7 | constructors_call_type.py:50:5 - error: Arguments missing for parameters "x", "y" (reportCallIssue) 8 | constructors_call_type.py:59:9 - error: Expected 0 positional arguments (reportCallIssue) 9 | constructors_call_type.py:64:9 - error: Expected 0 positional arguments (reportCallIssue) 10 | constructors_call_type.py:72:5 - error: Arguments missing for parameters "x", "y" (reportCallIssue) 11 | constructors_call_type.py:81:5 - error: Argument missing for parameter "y" (reportCallIssue) 12 | constructors_call_type.py:82:12 - error: Argument of type "Literal[2]" cannot be assigned to parameter "y" of type "str" in function "__new__" 13 |   "Literal[2]" is not assignable to "str" (reportArgumentType) 14 | """ 15 | conformance_automated = "Pass" 16 | -------------------------------------------------------------------------------- /conformance/results/pyright/constructors_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | constructors_consistency.py:25:9 - error: Mismatch between signature of __new__ and __init__ in class "Class1" 6 |   Signature of __init__ is "(x: str) -> None" 7 |   Signature of __new__ is "() -> Class1" (reportInconsistentConstructor) 8 | """ 9 | conformance_automated = "Pass" 10 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_descriptors.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_final.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | dataclasses_final.py:27:3 - error: Cannot assign to attribute "final_classvar" for class "type[D]" 7 |   "final_classvar" is declared as Final and cannot be reassigned (reportAttributeAccessIssue) 8 | dataclasses_final.py:35:3 - error: Cannot assign to attribute "final_no_default" for class "D" 9 |   "final_no_default" is declared as Final and cannot be reassigned (reportAttributeAccessIssue) 10 | dataclasses_final.py:36:3 - error: Cannot assign to attribute "final_with_default" for class "D" 11 |   "final_with_default" is declared as Final and cannot be reassigned (reportAttributeAccessIssue) 12 | dataclasses_final.py:37:3 - error: Cannot assign to attribute "final_no_default" for class "type[D]" 13 |   "final_no_default" is declared as Final and cannot be reassigned (reportAttributeAccessIssue) 14 | dataclasses_final.py:38:3 - error: Cannot assign to attribute "final_with_default" for class "type[D]" 15 |   "final_with_default" is declared as Final and cannot be reassigned (reportAttributeAccessIssue) 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_frozen.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_frozen.py:16:5 - error: Cannot assign to attribute "a" for class "DC1" 4 |   Attribute "a" is read-only (reportAttributeAccessIssue) 5 | dataclasses_frozen.py:17:5 - error: Cannot assign to attribute "b" for class "DC1" 6 |   Attribute "b" is read-only (reportAttributeAccessIssue) 7 | dataclasses_frozen.py:22:1 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues) 8 | dataclasses_frozen.py:32:12 - error: A frozen class cannot inherit from a class that is not frozen (reportGeneralTypeIssues) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_hash.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_hash.py:15:16 - error: Type "DC1" is not assignable to declared type "Hashable" 4 |   "DC1" is incompatible with protocol "Hashable" 5 |     "__hash__" is an incompatible type 6 |       Type "None" is not assignable to type "() -> int" (reportAssignmentType) 7 | dataclasses_hash.py:32:16 - error: Type "DC3" is not assignable to declared type "Hashable" 8 |   "DC3" is incompatible with protocol "Hashable" 9 |     "__hash__" is an incompatible type 10 |       Type "None" is not assignable to type "() -> int" (reportAssignmentType) 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_inheritance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_inheritance.py:60:5 - error: Class variable "x" overrides instance variable of same name in class "DC6" (reportIncompatibleVariableOverride) 4 | dataclasses_inheritance.py:64:5 - error: Instance variable "y" overrides class variable of same name in class "DC6" (reportIncompatibleVariableOverride) 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_kwonly.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_kwonly.py:23:11 - error: Expected 1 positional argument (reportCallIssue) 4 | dataclasses_kwonly.py:38:11 - error: Expected 1 positional argument (reportCallIssue) 5 | dataclasses_kwonly.py:53:11 - error: Expected 1 positional argument (reportCallIssue) 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_order.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_order.py:50:4 - error: Operator "<" not supported for types "DC1" and "DC2" (reportOperatorIssue) 4 | """ 5 | conformance_automated = "Pass" 6 | errors_diff = """ 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_postinit.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_postinit.py:19:40 - error: Dataclass __post_init__ method parameter type mismatch for field "y" 4 |   "str" is not assignable to "int" (reportGeneralTypeIssues) 5 | dataclasses_postinit.py:28:11 - error: Cannot access attribute "x" for class "DC1" 6 |   "x" is an init-only field (reportAttributeAccessIssue) 7 | dataclasses_postinit.py:29:11 - error: Cannot access attribute "y" for class "DC1" 8 |   "y" is an init-only field (reportAttributeAccessIssue) 9 | dataclasses_postinit.py:36:9 - error: Dataclass __post_init__ incorrect parameter count; number of InitVar fields is 2 (reportGeneralTypeIssues) 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_slots.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_slots.py:10:12 - error: __slots__ is already defined in class (reportGeneralTypeIssues) 4 | dataclasses_slots.py:25:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues) 5 | dataclasses_slots.py:38:14 - error: "y" is not specified in __slots__ (reportGeneralTypeIssues) 6 | dataclasses_slots.py:66:5 - error: Cannot access attribute "__slots__" for class "type[DC6]" 7 |   Attribute "__slots__" is unknown (reportAttributeAccessIssue) 8 | dataclasses_slots.py:69:8 - error: Cannot access attribute "__slots__" for class "DC6" 9 |   Attribute "__slots__" is unknown (reportAttributeAccessIssue) 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_transform_class.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_transform_class.py:51:7 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues) 4 | dataclasses_transform_class.py:63:6 - error: Cannot assign to attribute "id" for class "Customer1" 5 |   Attribute "id" is read-only (reportAttributeAccessIssue) 6 | dataclasses_transform_class.py:66:18 - error: Expected 0 positional arguments (reportCallIssue) 7 | dataclasses_transform_class.py:72:6 - error: Operator "<" not supported for types "Customer1" and "Customer1" (reportOperatorIssue) 8 | dataclasses_transform_class.py:82:18 - error: Expected 0 positional arguments (reportCallIssue) 9 | dataclasses_transform_class.py:122:6 - error: Cannot assign to attribute "id" for class "Customer3" 10 |   Attribute "id" is read-only (reportAttributeAccessIssue) 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_transform_field.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_transform_field.py:64:16 - error: No parameter named "id" (reportCallIssue) 4 | dataclasses_transform_field.py:75:16 - error: Expected 0 positional arguments (reportCallIssue) 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_transform_func.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_transform_func.py:57:13 - error: Cannot assign to attribute "name" for class "Customer1" 4 |   "Literal[3]" is not assignable to "str" (reportAttributeAccessIssue) 5 | dataclasses_transform_func.py:61:6 - error: Operator "<" not supported for types "Customer1" and "Customer1" (reportOperatorIssue) 6 | dataclasses_transform_func.py:65:36 - error: No parameter named "salary" (reportCallIssue) 7 | dataclasses_transform_func.py:71:18 - error: Expected 0 positional arguments (reportCallIssue) 8 | dataclasses_transform_func.py:89:1 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues) 9 | dataclasses_transform_func.py:97:6 - error: Cannot assign to attribute "id" for class "Customer3" 10 |   Attribute "id" is read-only (reportAttributeAccessIssue) 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/dataclasses_transform_meta.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | dataclasses_transform_meta.py:51:36 - error: A non-frozen class cannot inherit from a class that is frozen (reportGeneralTypeIssues) 4 | dataclasses_transform_meta.py:63:6 - error: Cannot assign to attribute "id" for class "Customer1" 5 |   Attribute "id" is read-only (reportAttributeAccessIssue) 6 | dataclasses_transform_meta.py:66:18 - error: Expected 0 positional arguments (reportCallIssue) 7 | dataclasses_transform_meta.py:73:6 - error: Operator "<" not supported for types "Customer1" and "Customer1" (reportOperatorIssue) 8 | dataclasses_transform_meta.py:83:18 - error: Expected 0 positional arguments (reportCallIssue) 9 | dataclasses_transform_meta.py:103:6 - error: Cannot assign to attribute "id" for class "Customer3" 10 |   Attribute "id" is read-only (reportAttributeAccessIssue) 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_assert_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_assert_type.py:27:17 - error: "assert_type" mismatch: expected "int" but received "int | str" (reportAssertTypeFailure) 4 | directives_assert_type.py:28:17 - error: "assert_type" mismatch: expected "int" but received "Any" (reportAssertTypeFailure) 5 | directives_assert_type.py:29:17 - error: "assert_type" mismatch: expected "int" but received "Literal[4]" (reportAssertTypeFailure) 6 | directives_assert_type.py:31:5 - error: "assert_type" expects two positional arguments (reportCallIssue) 7 | directives_assert_type.py:32:17 - error: "assert_type" mismatch: expected "int" but received "Literal['']" (reportAssertTypeFailure) 8 | directives_assert_type.py:33:5 - error: "assert_type" expects two positional arguments (reportCallIssue) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_cast.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_cast.py:15:8 - error: No overloads for "cast" match the provided arguments 4 |   Argument types: () (reportCallIssue) 5 | directives_cast.py:16:13 - error: Expected class but received "Literal[1]" (reportGeneralTypeIssues) 6 | directives_cast.py:17:8 - error: No overloads for "cast" match the provided arguments 7 |   Argument types: (type[int], Literal[''], Literal['']) (reportCallIssue) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_no_type_check.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | Does not honor `@no_type_check` class decorator (allowed). 4 | """ 5 | output = """ 6 | directives_no_type_check.py:15:14 - error: Type "Literal['']" is not assignable to declared type "int" 7 |   "Literal['']" is not assignable to "int" (reportAssignmentType) 8 | directives_no_type_check.py:32:1 - error: Arguments missing for parameters "a", "b" (reportCallIssue) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_reveal_type.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_reveal_type.py:14:17 - information: Type of "a" is "int | str" 4 | directives_reveal_type.py:15:17 - information: Type of "b" is "list[int]" 5 | directives_reveal_type.py:16:17 - information: Type of "c" is "Any" 6 | directives_reveal_type.py:17:17 - information: Type of "d" is "ForwardReference" 7 | directives_reveal_type.py:19:5 - error: Expected a single positional argument for "reveal_type" call (reportCallIssue) 8 | directives_reveal_type.py:20:5 - error: Expected a single positional argument for "reveal_type" call (reportCallIssue) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_type_checking.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_type_ignore.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_type_ignore_file1.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_type_ignore_file2.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | directives_type_ignore_file2.py:14:10 - error: Type "Literal['']" is not assignable to declared type "int" 4 |   "Literal['']" is not assignable to "int" (reportAssignmentType) 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/directives_version_platform.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/enums_behaviors.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | enums_behaviors.py:39:21 - error: Enum class "Shape" is final and cannot be subclassed (reportGeneralTypeIssues) 6 | """ 7 | conformance_automated = "Pass" 8 | -------------------------------------------------------------------------------- /conformance/results/pyright/enums_definition.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | """ 6 | conformance_automated = "Pass" 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/enums_expansion.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | enums_expansion.py:53:21 - error: "assert_type" mismatch: expected "Literal[CustomFlags.FLAG3]" but received "CustomFlags" (reportAssertTypeFailure) 7 | """ 8 | -------------------------------------------------------------------------------- /conformance/results/pyright/enums_member_names.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/enums_member_values.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | enums_member_values.py:50:12 - error: Argument missing for parameter "radius" (reportCallIssue) 7 | enums_member_values.py:51:15 - error: Arguments missing for parameters "mass", "radius" (reportCallIssue) 8 | enums_member_values.py:54:13 - error: "assert_type" mismatch: expected "Literal[1]" but received "Any" (reportAssertTypeFailure) 9 | enums_member_values.py:68:13 - error: "assert_type" mismatch: expected "Literal[1]" but received "int" (reportAssertTypeFailure) 10 | enums_member_values.py:78:13 - error: Type "Literal['green']" is not assignable to declared type "int" 11 |   "Literal['green']" is not assignable to "int" (reportAssignmentType) 12 | enums_member_values.py:85:24 - error: Cannot assign to attribute "_value_" for class "Planet2*" 13 |   "int" is not assignable to "str" (reportAttributeAccessIssue) 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/exceptions_context_managers.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | errors_diff = """ 3 | """ 4 | output = """ 5 | """ 6 | conformance_automated = "Pass" 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_defaults.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_defaults.py:24:7 - error: "T" cannot appear after "DefaultStrT" in type parameter list because it has no default type (reportGeneralTypeIssues) 4 | generics_defaults.py:50:16 - error: Too few type arguments provided for "AllTheDefaults"; expected 2 but received 1 (reportInvalidTypeArguments) 5 | generics_defaults.py:107:51 - error: TypeVar default type must be a subtype of the bound type (reportGeneralTypeIssues) 6 | generics_defaults.py:114:52 - error: TypeVar default type must be one of the constrained types (reportGeneralTypeIssues) 7 | generics_defaults.py:141:7 - error: TypeVar "T5" has a default value and cannot follow TypeVarTuple "Ts" (reportGeneralTypeIssues) 8 | generics_defaults.py:170:18 - error: Access to generic instance variable through class is ambiguous (reportGeneralTypeIssues) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | ignore_errors = ["Access to generic instance variable through class is ambiguous"] 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_defaults_specialization.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_defaults_specialization.py:30:15 - error: Too many type arguments provided for "MyAlias[DefaultStrT@MyAlias]"; expected 1 but received 2 (reportInvalidTypeForm) 4 | generics_defaults_specialization.py:55:5 - error: Expected no type arguments for class "Foo" (reportInvalidTypeArguments) 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_paramspec_basic.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_paramspec_basic.py:10:1 - error: ParamSpec must be assigned to a variable named "NotIt" (reportGeneralTypeIssues) 4 | generics_paramspec_basic.py:15:18 - error: ParamSpec is not allowed in this context (reportInvalidTypeForm) 5 | generics_paramspec_basic.py:23:14 - error: ParamSpec is not allowed in this context (reportInvalidTypeForm) 6 | generics_paramspec_basic.py:23:20 - error: ParamSpec is not allowed in this context (reportInvalidTypeForm) 7 | generics_paramspec_basic.py:27:14 - error: "Concatenate" is not allowed in this context (reportInvalidTypeForm) 8 | generics_paramspec_basic.py:31:19 - error: Type "P@func3" cannot be assigned to type variable "_T@list" 9 |   ParamSpec is not allowed in this context (reportInvalidTypeArguments) 10 | generics_paramspec_basic.py:35:35 - error: ParamSpec is not allowed in this context (reportInvalidTypeForm) 11 | generics_paramspec_basic.py:39:18 - error: ParamSpec is not allowed in this context (reportInvalidTypeForm) 12 | generics_paramspec_basic.py:39:31 - error: ParamSpec is not allowed in this context (reportInvalidTypeForm) 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_paramspec_specialization.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_paramspec_specialization.py:44:27 - error: Type "int" cannot be assigned to type variable "P1@ClassA" 4 |   Type "int" is incompatible with ParamSpec "P1@ClassA" (reportInvalidTypeArguments) 5 | generics_paramspec_specialization.py:54:9 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "int" 6 |   "Literal['']" is not assignable to "int" (reportArgumentType) 7 | generics_paramspec_specialization.py:55:16 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "bool" 8 |   "Literal['']" is not assignable to "bool" (reportArgumentType) 9 | generics_paramspec_specialization.py:60:9 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "int" 10 |   "Literal['']" is not assignable to "int" (reportArgumentType) 11 | generics_paramspec_specialization.py:61:16 - error: Argument of type "Literal['']" cannot be assigned to parameter of type "bool" 12 |   "Literal['']" is not assignable to "bool" (reportArgumentType) 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_self_advanced.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_self_attributes.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_self_attributes.py:26:38 - error: Argument of type "LinkedList[int]" cannot be assigned to parameter "next" of type "OrdinalLinkedList | None" in function "__init__" 4 |   Type "LinkedList[int]" is not assignable to type "OrdinalLinkedList | None" 5 |     "LinkedList[int]" is not assignable to "OrdinalLinkedList" 6 |     "LinkedList[int]" is not assignable to "None" (reportArgumentType) 7 | generics_self_attributes.py:32:8 - error: Cannot assign to attribute "next" for class "OrdinalLinkedList" 8 |   Expression of type "LinkedList[int]" cannot be assigned to attribute "next" of class "OrdinalLinkedList" 9 |     Type "LinkedList[int]" is not assignable to type "OrdinalLinkedList | None" 10 |       "LinkedList[int]" is not assignable to "OrdinalLinkedList" 11 |       "LinkedList[int]" is not assignable to "None" (reportAttributeAccessIssue) 12 | """ 13 | conformance_automated = "Pass" 14 | errors_diff = """ 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_self_basic.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_self_basic.py:20:16 - error: Type "Shape" is not assignable to return type "Self@Shape" 4 |   Type "Shape" is not assignable to type "Self@Shape" (reportReturnType) 5 | generics_self_basic.py:33:16 - error: Type "Shape" is not assignable to return type "Self@Shape" 6 |   Type "Shape" is not assignable to type "Self@Shape" (reportReturnType) 7 | generics_self_basic.py:67:31 - error: Expected no type arguments for class "Self" (reportInvalidTypeArguments) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_syntax_compatibility.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_syntax_compatibility.py:14:22 - error: Type parameter "K" is not included in the type parameter list for "ClassA" (reportGeneralTypeIssues) 4 | generics_syntax_compatibility.py:26:35 - error: Type parameter "K" is not included in the type parameter list for "method2" (reportGeneralTypeIssues) 5 | generics_syntax_compatibility.py:26:45 - error: Type parameter "K" is not included in the type parameter list for "method2" (reportGeneralTypeIssues) 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_syntax_scoping.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_syntax_scoping.py:14:20 - error: TypeVar constraint type cannot be generic (reportGeneralTypeIssues) 4 | generics_syntax_scoping.py:18:17 - error: TypeVar constraint type cannot be generic (reportGeneralTypeIssues) 5 | generics_syntax_scoping.py:35:7 - error: "T" is not defined (reportUndefinedVariable) 6 | generics_syntax_scoping.py:44:17 - error: "T" is not defined (reportUndefinedVariable) 7 | generics_syntax_scoping.py:92:17 - error: TypeVar "T" is already in use by an outer scope (reportGeneralTypeIssues) 8 | generics_syntax_scoping.py:95:17 - error: TypeVar "T" is already in use by an outer scope (reportGeneralTypeIssues) 9 | generics_syntax_scoping.py:98:17 - error: TypeVar "T" is already in use by an outer scope (reportGeneralTypeIssues) 10 | generics_syntax_scoping.py:98:29 - warning: TypeVar "T" appears only once in generic function signature 11 |   Use "object" instead (reportInvalidTypeVarUse) 12 | """ 13 | conformance_automated = "Pass" 14 | errors_diff = """ 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_typevartuple_callable.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_typevartuple_callable.py:26:28 - error: Argument of type "tuple[Literal[''], Literal[0]]" cannot be assigned to parameter "args" of type "tuple[*Ts@__init__]" in function "__init__" 4 |   "Literal['']" is not assignable to "int" 5 |   "Literal[0]" is not assignable to "str" (reportArgumentType) 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_typevartuple_concat.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_typevartuple_overloads.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_typevartuple_unpack.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_typevartuple_unpack.py:30:28 - error: Argument of type "Array[Batch]" cannot be assigned to parameter "x" of type "Array[Batch, *tuple[Any, ...], Channels]" in function "process_batch_channels" 4 |   "Array[Batch]" is not assignable to "Array[Batch, *tuple[Any, ...], Channels]" 5 |     Type parameter "Ts@Array" is invariant, but "*tuple[Batch]" is not the same as "*tuple[Batch, *tuple[Any, ...], Channels]" (reportArgumentType) 6 | """ 7 | conformance_automated = "Pass" 8 | errors_diff = """ 9 | """ 10 | -------------------------------------------------------------------------------- /conformance/results/pyright/generics_upper_bound.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | generics_upper_bound.py:24:38 - error: TypeVar bound type cannot be generic (reportGeneralTypeIssues) 4 | generics_upper_bound.py:51:8 - error: Argument of type "Literal[3]" cannot be assigned to parameter "x" of type "ST@longer" in function "longer" 5 |   Type "Literal[3]" is not assignable to type "Sized" 6 |     "Literal[3]" is incompatible with protocol "Sized" 7 |       "__len__" is not present (reportArgumentType) 8 | generics_upper_bound.py:51:11 - error: Argument of type "Literal[3]" cannot be assigned to parameter "y" of type "ST@longer" in function "longer" 9 |   Type "Literal[3]" is not assignable to type "Sized" 10 |     "Literal[3]" is incompatible with protocol "Sized" 11 |       "__len__" is not present (reportArgumentType) 12 | generics_upper_bound.py:56:44 - error: TypeVar cannot be both bound and constrained (reportGeneralTypeIssues) 13 | """ 14 | conformance_automated = "Pass" 15 | errors_diff = """ 16 | """ 17 | -------------------------------------------------------------------------------- /conformance/results/pyright/historical_positional.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | historical_positional.py:18:8 - error: Expected 1 more positional argument (reportCallIssue) 4 | historical_positional.py:26:16 - error: Position-only parameter not allowed after parameter that is not position-only (reportGeneralTypeIssues) 5 | historical_positional.py:38:26 - error: Position-only parameter not allowed after parameter that is not position-only (reportGeneralTypeIssues) 6 | historical_positional.py:43:10 - error: Expected 1 more positional argument (reportCallIssue) 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyright/literals_interactions.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | literals_interactions.py:15:5 - error: Index 5 is out of range for type tuple[int, str, list[bool]] (reportGeneralTypeIssues) 4 | literals_interactions.py:16:5 - error: Index -5 is out of range for type tuple[int, str, list[bool]] (reportGeneralTypeIssues) 5 | literals_interactions.py:17:5 - error: Index 4 is out of range for type tuple[int, str, list[bool]] (reportGeneralTypeIssues) 6 | literals_interactions.py:18:5 - error: Index -4 is out of range for type tuple[int, str, list[bool]] (reportGeneralTypeIssues) 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyright/literals_semantics.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | literals_semantics.py:10:18 - error: Type "Literal[4]" is not assignable to declared type "Literal[3]" 4 |   "Literal[4]" is not assignable to type "Literal[3]" (reportAssignmentType) 5 | literals_semantics.py:24:26 - error: Type "Literal[0]" is not assignable to declared type "Literal[False]" 6 |   "Literal[0]" is not assignable to "Literal[False]" (reportAssignmentType) 7 | literals_semantics.py:25:22 - error: Type "Literal[False]" is not assignable to declared type "Literal[0]" 8 |   "Literal[False]" is not assignable to "Literal[0]" (reportAssignmentType) 9 | literals_semantics.py:33:10 - error: Type "Literal[6, 7, 8]" is not assignable to declared type "Literal[3, 4, 5]" 10 |   Type "Literal[6, 7, 8]" is not assignable to type "Literal[3, 4, 5]" 11 |     Type "Literal[6]" is not assignable to type "Literal[3, 4, 5]" 12 |       "Literal[6]" is not assignable to type "Literal[3]" 13 |       "Literal[6]" is not assignable to type "Literal[4]" 14 |       "Literal[6]" is not assignable to type "Literal[5]" (reportAssignmentType) 15 | """ 16 | conformance_automated = "Pass" 17 | errors_diff = """ 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyright/namedtuples_type_compat.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | namedtuples_type_compat.py:22:23 - error: Type "Point" is not assignable to declared type "tuple[int, int]" 4 |   "Point" is not assignable to "tuple[int, int]" 5 |     Tuple size mismatch; expected 2 but received 3 (reportAssignmentType) 6 | namedtuples_type_compat.py:23:28 - error: Type "Point" is not assignable to declared type "tuple[int, str, str]" 7 |   "Point" is not assignable to "tuple[int, str, str]" 8 |     Tuple entry 2 is incorrect type 9 |       "int" is not assignable to "str" (reportAssignmentType) 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/overloads_basic.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | notes = """ 3 | """ 4 | output = """ 5 | overloads_basic.py:39:1 - error: No overloads for "__getitem__" match the provided arguments (reportCallIssue) 6 | overloads_basic.py:39:1 - error: Argument of type "Literal['']" cannot be assigned to parameter "__s" of type "slice[Any, Any, Any]" in function "__getitem__" 7 |   "Literal['']" is not assignable to "slice[Any, Any, Any]" (reportArgumentType) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/overloads_consistency.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | overloads_consistency.py:28:5 - error: Overloaded implementation is not consistent with signature of overload 2 7 |   Function return type "str" is incompatible with type "int" 8 |     "str" is not assignable to "int" (reportInconsistentOverload) 9 | overloads_consistency.py:44:5 - error: Overloaded implementation is not consistent with signature of overload 2 10 |   Type "(x: int) -> (int | str)" is not assignable to type "(x: str) -> str" 11 |     Parameter 1: type "str" is incompatible with type "int" 12 |       "str" is not assignable to "int" (reportInconsistentOverload) 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/overloads_definitions_stub.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | conformance_automated = "Pass" 3 | errors_diff = """ 4 | """ 5 | output = """ 6 | overloads_definitions_stub.pyi:14:5 - error: "func1" is marked as overload, but additional overloads are missing (reportInconsistentOverload) 7 | overloads_definitions_stub.pyi:33:9 - error: Overloads for "func5" use @staticmethod inconsistently (reportInconsistentOverload) 8 | overloads_definitions_stub.pyi:41:9 - error: Overloads for "func6" use @classmethod inconsistently (reportInconsistentOverload) 9 | overloads_definitions_stub.pyi:73:9 - error: Only the first overload should be marked @final (reportInconsistentOverload) 10 | overloads_definitions_stub.pyi:86:9 - error: Only the first overload should be marked @final (reportInconsistentOverload) 11 | overloads_definitions_stub.pyi:111:9 - error: Method "final_method" cannot override final method defined in class "Base" (reportIncompatibleMethodOverride) 12 | overloads_definitions_stub.pyi:122:9 - error: Method "bad_override" is marked as override, but no base method of same name is present (reportGeneralTypeIssues) 13 | overloads_definitions_stub.pyi:147:9 - error: Only the first overload should be marked @override (reportInconsistentOverload) 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/protocols_modules.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | protocols_modules.py:26:17 - error: Type "Module("_protocols_modules1")" is not assignable to declared type "Options2" 4 |   "timeout" is invariant because it is mutable 5 |   "timeout" is an incompatible type 6 |     "int" is not assignable to "str" (reportAssignmentType) 7 | protocols_modules.py:48:18 - error: Type "Module("_protocols_modules2")" is not assignable to declared type "Reporter2" 8 |   "on_error" is an incompatible type 9 |     Type "(x: int) -> None" is not assignable to type "(x: int) -> int" 10 |       Function return type "None" is incompatible with type "int" 11 |         "None" is not assignable to "int" (reportAssignmentType) 12 | protocols_modules.py:49:18 - error: Type "Module("_protocols_modules2")" is not assignable to declared type "Reporter3" 13 |   "not_implemented" is not present (reportAssignmentType) 14 | """ 15 | conformance_automated = "Pass" 16 | errors_diff = """ 17 | """ 18 | -------------------------------------------------------------------------------- /conformance/results/pyright/protocols_recursive.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/protocols_self.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/specialtypes_any.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/specialtypes_never.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_never.py:19:22 - error: Function with declared return type "NoReturn" cannot return "None" (reportReturnType) 4 | specialtypes_never.py:86:21 - error: Type "list[Never]" is not assignable to declared type "list[int]" 5 |   "list[Never]" is not assignable to "list[int]" 6 |     Type parameter "_T@list" is invariant, but "Never" is not the same as "int" 7 |     Consider switching from "list" to "Sequence" which is covariant (reportAssignmentType) 8 | specialtypes_never.py:105:12 - error: Type "ClassC[Never]" is not assignable to return type "ClassC[U@func10]" 9 |   "ClassC[Never]" is not assignable to "ClassC[U@func10]" 10 |     Type parameter "T@ClassC" is invariant, but "Never" is not the same as "U@func10" (reportReturnType) 11 | """ 12 | conformance_automated = "Pass" 13 | errors_diff = """ 14 | """ 15 | -------------------------------------------------------------------------------- /conformance/results/pyright/specialtypes_none.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_none.py:21:7 - error: Argument of type "type[None]" cannot be assigned to parameter "val1" of type "None" in function "func1" 4 |   Type is not assignable to "None" (reportArgumentType) 5 | specialtypes_none.py:27:19 - error: Type "None" is not assignable to declared type "Iterable[Unknown]" 6 |   "None" is incompatible with protocol "Iterable[Unknown]" 7 |     "__iter__" is not present (reportAssignmentType) 8 | specialtypes_none.py:41:7 - error: Argument of type "None" cannot be assigned to parameter "val1" of type "type[None]" in function "func2" 9 |   Type "None" is not assignable to type "type[None]" (reportArgumentType) 10 | """ 11 | conformance_automated = "Pass" 12 | errors_diff = """ 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/specialtypes_promotions.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | specialtypes_promotions.py:13:7 - error: Cannot access attribute "numerator" for class "float" 4 |   Attribute "numerator" is unknown (reportAttributeAccessIssue) 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/tuples_unpacked.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | tuples_unpacked.py:40:30 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) 4 | tuples_unpacked.py:41:43 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) 5 | tuples_unpacked.py:51:34 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) 6 | tuples_unpacked.py:59:37 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) 7 | tuples_unpacked.py:61:50 - error: Type argument list can have at most one unpacked TypeVarTuple or tuple (reportInvalidTypeForm) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_alt_syntax.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_alt_syntax.py:23:17 - error: Expected dict or keyword parameter as second parameter (reportArgumentType) 4 | typeddicts_alt_syntax.py:27:45 - error: Expected string literal for dictionary entry name (reportGeneralTypeIssues) 5 | typeddicts_alt_syntax.py:31:1 - error: TypedDict must be assigned to a variable named "WrongName" (reportGeneralTypeIssues) 6 | typeddicts_alt_syntax.py:35:78 - error: Extra TypedDict arguments not supported (reportCallIssue) 7 | typeddicts_alt_syntax.py:45:43 - error: Type "dict[str, str]" is not assignable to declared type "Movie2" 8 |   "Literal['']" is not assignable to "int" (reportAssignmentType) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_class_syntax.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_class_syntax.py:29:5 - error: TypedDict classes can contain only type annotations (reportGeneralTypeIssues) 4 | typeddicts_class_syntax.py:33:5 - error: TypedDict classes can contain only type annotations (reportGeneralTypeIssues) 5 | typeddicts_class_syntax.py:38:5 - error: TypedDict classes can contain only type annotations (reportGeneralTypeIssues) 6 | typeddicts_class_syntax.py:44:32 - error: TypedDict does not support __init_subclass__ parameter "metaclass" (reportGeneralTypeIssues) 7 | typeddicts_class_syntax.py:49:32 - error: TypedDict does not support __init_subclass__ parameter "other" (reportGeneralTypeIssues) 8 | """ 9 | conformance_automated = "Pass" 10 | errors_diff = """ 11 | """ 12 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_final.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | """ 4 | conformance_automated = "Pass" 5 | errors_diff = """ 6 | """ 7 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_inheritance.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_inheritance.py:44:7 - error: All base classes for TypedDict classes must also be TypedDict classes 4 |   Class "NonTypedDict" is not a TypedDict (reportGeneralTypeIssues) 5 | typeddicts_inheritance.py:55:4 - error: "x" overrides symbol of same name in class "X1" 6 |   Variable is mutable so its type is invariant 7 |     Override type "int" is not the same as base type "str" (reportIncompatibleVariableOverride) 8 | typeddicts_inheritance.py:65:7 - error: Base classes for class "XYZ2" define variable "x" in incompatible way (reportIncompatibleVariableOverride) 9 | """ 10 | conformance_automated = "Pass" 11 | errors_diff = """ 12 | """ 13 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_readonly.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly.py:24:1 - error: Could not assign item in TypedDict 4 |   "members" is a read-only key in "Band" (reportTypedDictNotRequiredAccess) 5 | typeddicts_readonly.py:36:1 - error: Could not assign item in TypedDict 6 |   "members" is a read-only key in "Band2" (reportTypedDictNotRequiredAccess) 7 | typeddicts_readonly.py:50:1 - error: Could not assign item in TypedDict 8 |   "title" is a read-only key in "Movie1" (reportTypedDictNotRequiredAccess) 9 | typeddicts_readonly.py:51:1 - error: Could not assign item in TypedDict 10 |   "year" is a read-only key in "Movie1" (reportTypedDictNotRequiredAccess) 11 | typeddicts_readonly.py:60:1 - error: Could not assign item in TypedDict 12 |   "title" is a read-only key in "Movie2" (reportTypedDictNotRequiredAccess) 13 | typeddicts_readonly.py:61:1 - error: Could not assign item in TypedDict 14 |   "year" is a read-only key in "Movie2" (reportTypedDictNotRequiredAccess) 15 | """ 16 | conformance_automated = "Pass" 17 | errors_diff = """ 18 | """ 19 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_readonly_kwargs.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_kwargs.py:33:5 - error: Could not assign item in TypedDict 4 |   "key1" is a read-only key in "ReadOnlyArgs" (reportTypedDictNotRequiredAccess) 5 | """ 6 | conformance_automated = "Pass" 7 | errors_diff = """ 8 | """ 9 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_readonly_update.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_readonly_update.py:23:1 - error: No overloads for "update" match the provided arguments (reportCallIssue) 4 | typeddicts_readonly_update.py:23:11 - error: Argument of type "A" cannot be assigned to parameter "__m" of type "Partial[A]" in function "update" 5 |   "x" is an incompatible type 6 |     Type "int" is not assignable to type "Never" (reportArgumentType) 7 | """ 8 | conformance_automated = "Pass" 9 | errors_diff = """ 10 | """ 11 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_required.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_required.py:12:8 - error: "Required" is not allowed in this context (reportInvalidTypeForm) 4 | typeddicts_required.py:15:18 - error: Cannot assign to attribute "x" for class "NotTypedDict*" 5 |   "int" is not assignable to "Required" (reportAttributeAccessIssue) 6 | typeddicts_required.py:19:8 - error: "NotRequired" is not allowed in this context (reportInvalidTypeForm) 7 | typeddicts_required.py:62:8 - error: "Required" is not allowed in this context (reportInvalidTypeForm) 8 | typeddicts_required.py:63:8 - error: "Required" is not allowed in this context (reportInvalidTypeForm) 9 | """ 10 | conformance_automated = "Fail" 11 | errors_diff = """ 12 | Line 15: Unexpected errors ['typeddicts_required.py:15:18 - error: Cannot assign to attribute "x" for class "NotTypedDict*"'] 13 | """ 14 | -------------------------------------------------------------------------------- /conformance/results/pyright/typeddicts_usage.toml: -------------------------------------------------------------------------------- 1 | conformant = "Pass" 2 | output = """ 3 | typeddicts_usage.py:23:1 - error: Could not assign item in TypedDict 4 |   "director" is not a defined key in "Movie" (reportGeneralTypeIssues) 5 | typeddicts_usage.py:24:1 - error: Could not assign item in TypedDict 6 |   "Literal['1982']" is not assignable to "int" (reportGeneralTypeIssues) 7 | typeddicts_usage.py:28:18 - error: Type "dict[str, str | int]" is not assignable to declared type "Movie" 8 |   "title" is an undefined item in type "Movie" (reportAssignmentType) 9 | typeddicts_usage.py:35:22 - error: Second argument to "isinstance" must be a class or tuple of classes 10 |   TypedDict class not allowed for instance or class checks (reportArgumentType) 11 | typeddicts_usage.py:40:24 - error: "TypedDict" cannot be used in this context (reportInvalidTypeForm) 12 | """ 13 | conformance_automated = "Pass" 14 | errors_diff = """ 15 | """ 16 | -------------------------------------------------------------------------------- /conformance/results/pyright/version.toml: -------------------------------------------------------------------------------- 1 | version = "pyright 1.1.400" 2 | test_duration = 1.1 3 | -------------------------------------------------------------------------------- /conformance/src/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/python/typing/d4263de581da5c7bf750951f1f07c230f773051d/conformance/src/__init__.py -------------------------------------------------------------------------------- /conformance/src/options.py: -------------------------------------------------------------------------------- 1 | """ 2 | Command-line options for the test tool. 3 | """ 4 | 5 | import argparse 6 | from dataclasses import dataclass 7 | 8 | 9 | @dataclass 10 | class _Options: 11 | report_only: bool | None 12 | skip_timing: bool 13 | 14 | 15 | def parse_options(argv: list[str]) -> _Options: 16 | parser = argparse.ArgumentParser() 17 | reporting_group = parser.add_argument_group("reporting") 18 | reporting_group.add_argument( 19 | "--report-only", 20 | action="store_true", 21 | help="regenerates the test suite report from past results", 22 | ) 23 | reporting_group.add_argument( 24 | "--skip-timing", 25 | action="store_true", 26 | help="do not update timing information in the output files", 27 | ) 28 | ret = _Options(**vars(parser.parse_args(argv))) 29 | return ret 30 | -------------------------------------------------------------------------------- /conformance/src/unexpected_fails.py: -------------------------------------------------------------------------------- 1 | """ 2 | 3 | Helper script to find test cases where the automated and manual 4 | conformance results differ. 5 | 6 | """ 7 | 8 | from pathlib import Path 9 | import tomllib 10 | 11 | results_dir = Path(__file__).resolve().parent.parent / "results" 12 | 13 | for type_checker_dir in sorted(results_dir.iterdir()): 14 | if type_checker_dir.is_dir(): 15 | for file in sorted(type_checker_dir.iterdir()): 16 | if file.name == "version.toml": 17 | continue 18 | with file.open("rb") as f: 19 | try: 20 | info = tomllib.load(f) 21 | except Exception as e: 22 | raise Exception(f"Error decoding {file}") from e 23 | try: 24 | previous_pass = info["conformant"] == "Pass" 25 | new_pass = info["conformance_automated"] == "Pass" 26 | except KeyError as e: 27 | raise Exception(f"Missing key in {file}") from e 28 | if previous_pass != new_pass: 29 | print(f"{file.relative_to(results_dir)}: {info['conformant']} vs. {info['conformance_automated']}") 30 | -------------------------------------------------------------------------------- /conformance/tests/_directives_deprecated_library.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support module for directive_deprecated. 3 | """ 4 | 5 | from typing import Self, overload 6 | from typing_extensions import deprecated 7 | 8 | 9 | @deprecated("Use Spam instead") 10 | class Ham: 11 | ... 12 | 13 | 14 | @deprecated("It is pining for the fjords") 15 | def norwegian_blue(x: int) -> int: 16 | ... 17 | 18 | 19 | @overload 20 | @deprecated("Only str will be allowed") 21 | def foo(x: int) -> str: 22 | ... 23 | 24 | 25 | @overload 26 | def foo(x: str) -> str: 27 | ... 28 | 29 | 30 | def foo(x: int | str) -> str: 31 | ... 32 | 33 | 34 | class Spam: 35 | @deprecated("There is enough spam in the world") 36 | def __add__(self, other: object) -> Self: 37 | ... 38 | 39 | @property 40 | @deprecated("All spam will be equally greasy") 41 | def greasy(self) -> float: 42 | ... 43 | 44 | @property 45 | def shape(self) -> str: 46 | ... 47 | 48 | @shape.setter 49 | @deprecated("Shapes are becoming immutable") 50 | def shape(self, value: str) -> None: 51 | ... 52 | -------------------------------------------------------------------------------- /conformance/tests/_enums_member_values.py: -------------------------------------------------------------------------------- 1 | """ 2 | Dummy implementation _enums_member_values stub. 3 | """ 4 | -------------------------------------------------------------------------------- /conformance/tests/_enums_member_values.pyi: -------------------------------------------------------------------------------- 1 | """ 2 | Support stub file for enums_member_values test. 3 | """ 4 | 5 | from enum import Enum 6 | 7 | # > If the literal values for enum members are not supplied, as they sometimes 8 | # > are not within a type stub file, a type checker can use the type of the 9 | # > _value_ attribute. 10 | 11 | class ColumnType(Enum): 12 | _value_: int 13 | DORIC = ... 14 | IONIC = ... 15 | CORINTHIAN = ... 16 | -------------------------------------------------------------------------------- /conformance/tests/_enums_members.py: -------------------------------------------------------------------------------- 1 | """ 2 | Dummy implementation for stub file for enums_members test. 3 | """ 4 | -------------------------------------------------------------------------------- /conformance/tests/_enums_members.pyi: -------------------------------------------------------------------------------- 1 | """ 2 | Support stub file for enums_members test. 3 | """ 4 | 5 | from enum import Enum 6 | 7 | # > Within a type stub, members can be defined using the actual runtime values, 8 | # > or a placeholder of ... can be used 9 | 10 | class Pet2(Enum): 11 | genus: str # Non-member attribute 12 | species: str # Non-member attribute 13 | 14 | CAT = ... # Member attribute 15 | DOG = ... # Member attribute 16 | -------------------------------------------------------------------------------- /conformance/tests/_protocols_modules1.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support file for protocols_modules.py test. 3 | """ 4 | 5 | timeout = 100 6 | one_flag = True 7 | other_flag = False 8 | -------------------------------------------------------------------------------- /conformance/tests/_protocols_modules2.py: -------------------------------------------------------------------------------- 1 | """ 2 | Support file for protocols_modules.py test. 3 | """ 4 | 5 | 6 | def on_error(x: int) -> None: 7 | ... 8 | 9 | 10 | def on_success() -> None: 11 | ... 12 | -------------------------------------------------------------------------------- /conformance/tests/_qualifiers_final_annotation_1.py: -------------------------------------------------------------------------------- 1 | """ 2 | Used as part of the test for the typing.Final special form. 3 | """ 4 | 5 | from typing import Final 6 | 7 | TEN: Final[int] = 10 8 | -------------------------------------------------------------------------------- /conformance/tests/_qualifiers_final_annotation_2.py: -------------------------------------------------------------------------------- 1 | """ 2 | Used as part of the test for the typing.Final special form. 3 | """ 4 | 5 | from typing import Final 6 | 7 | PI: Final = 3.14 8 | -------------------------------------------------------------------------------- /conformance/tests/_qualifiers_final_decorator.pyi: -------------------------------------------------------------------------------- 1 | """ 2 | Support stub file for @final tests. 3 | """ 4 | 5 | from typing import final, overload 6 | 7 | 8 | class Base3: 9 | # > For overloaded methods, @final should be placed on the implementation 10 | # > (or on the first overload, for stubs): 11 | @final 12 | @overload 13 | def method(self, x: int) -> int: 14 | ... 15 | 16 | @overload 17 | def method(self, x: str) -> str: 18 | ... 19 | 20 | class Base4: 21 | # (Swap the order of overload and final decorators.) 22 | @overload 23 | @final 24 | def method(self, x: int) -> int: 25 | ... 26 | 27 | @overload 28 | def method(self, x: str) -> str: 29 | ... 30 | -------------------------------------------------------------------------------- /conformance/tests/aliases_variance.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests generic type aliases used in class declarations for 3 | variance incompatibility. 4 | """ 5 | 6 | from typing import Generic, TypeVar, TypeAlias 7 | 8 | T = TypeVar("T") 9 | T_co = TypeVar("T_co", covariant=True) 10 | T_contra = TypeVar("T_contra", contravariant=True) 11 | 12 | 13 | class ClassA(Generic[T]): 14 | pass 15 | 16 | 17 | A_Alias_1: TypeAlias = ClassA[T_co] 18 | A_Alias_2: TypeAlias = A_Alias_1[T_co] 19 | 20 | # Specialized type aliases used within a class declaration should 21 | # result in the same variance incompatibility errors as their 22 | # non-aliased counterparts. 23 | 24 | class ClassA_1(ClassA[T_co]): # E: incompatible variance 25 | ... 26 | 27 | 28 | class ClassA_2(A_Alias_1[T_co]): # E: incompatible variance 29 | ... 30 | 31 | 32 | class ClassA_3(A_Alias_2[T_co]): # E: incompatible variance 33 | ... 34 | 35 | 36 | 37 | class ClassB(Generic[T, T_co]): 38 | pass 39 | 40 | 41 | B_Alias_1 = ClassB[T_co, T_contra] 42 | 43 | 44 | class ClassB_1(B_Alias_1[T_contra, T_co]): # E: incompatible variance 45 | ... 46 | -------------------------------------------------------------------------------- /conformance/tests/annotations_coroutines.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests for annotating coroutines. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/annotations.html#annotating-generator-functions-and-coroutines 6 | 7 | # > Coroutines introduced in PEP 492 are annotated with the same syntax as 8 | # > ordinary functions. However, the return type annotation corresponds to 9 | # > the type of await expression, not to the coroutine type. 10 | 11 | 12 | from typing import Any, Callable, Coroutine, assert_type 13 | 14 | 15 | async def func1(ignored: int, /) -> str: 16 | return "spam" 17 | 18 | 19 | # Don't use assert_type here because some type checkers infer 20 | # the narrower type types.CoroutineType rather than typing.Coroutine 21 | # in this case. 22 | v1: Callable[[int], Coroutine[Any, Any, str]] = func1 23 | 24 | 25 | async def func2() -> None: 26 | x = await func1(42) 27 | assert_type(x, str) 28 | -------------------------------------------------------------------------------- /conformance/tests/constructors_consistency.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests consistency checks between __new__ and __init__ methods. 3 | """ 4 | 5 | # pyright: reportInconsistentConstructor=true 6 | 7 | # Specification: https://typing.readthedocs.io/en/latest/spec/constructors.html#consistency-of-new-and-init 8 | 9 | # Note: This functionality is optional in the typing spec, and conformant 10 | # type checkers are not required to implement it. 11 | 12 | 13 | # > Type checkers may optionally validate that the __new__ and __init__ 14 | # > methods for a class have consistent signatures. 15 | 16 | 17 | from typing import Self 18 | 19 | 20 | class Class1: 21 | def __new__(cls) -> Self: 22 | return super().__new__(cls) 23 | 24 | # Type error: __new__ and __init__ have inconsistent signatures 25 | def __init__(self, x: str) -> None: # E? 26 | pass 27 | -------------------------------------------------------------------------------- /conformance/tests/dataclasses_frozen.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests validation of frozen dataclass instances. 3 | """ 4 | 5 | # Specification: https://peps.python.org/pep-0557/#frozen-instances 6 | 7 | from dataclasses import dataclass 8 | 9 | @dataclass(frozen=True) 10 | class DC1: 11 | a: float 12 | b: str 13 | 14 | dc1 = DC1(1, "") 15 | 16 | dc1.a = 1 # E: dataclass is frozen 17 | dc1.b = "" # E: dataclass is frozen 18 | 19 | 20 | # This should generate an error because a non-frozen dataclass 21 | # cannot inherit from a frozen dataclass. 22 | @dataclass # E[DC2] 23 | class DC2(DC1): # E[DC2] 24 | pass 25 | 26 | @dataclass 27 | class DC3: 28 | a: int 29 | 30 | # This should generate an error because a frozen dataclass 31 | # cannot inherit from a non-frozen dataclass. 32 | @dataclass(frozen=True) # E[DC4] 33 | class DC4(DC3): # E[DC4] 34 | pass 35 | 36 | 37 | @dataclass(frozen=True) 38 | class DC1Child(DC1): 39 | # This should be allowed because attributes within a frozen 40 | # dataclass are covariant rather than invariant. 41 | a: int 42 | -------------------------------------------------------------------------------- /conformance/tests/dataclasses_hash.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the synthesis of the __hash__ method in a dataclass. 3 | """ 4 | 5 | from dataclasses import dataclass 6 | from typing import Hashable 7 | 8 | 9 | @dataclass 10 | class DC1: 11 | a: int 12 | 13 | 14 | # This should generate an error because DC1 isn't hashable. 15 | v1: Hashable = DC1(0) # E 16 | 17 | 18 | @dataclass(eq=True, frozen=True) 19 | class DC2: 20 | a: int 21 | 22 | 23 | v2: Hashable = DC2(0) 24 | 25 | 26 | @dataclass(eq=True) 27 | class DC3: 28 | a: int 29 | 30 | 31 | # This should generate an error because DC3 isn't hashable. 32 | v3: Hashable = DC3(0) # E 33 | 34 | 35 | @dataclass(frozen=True) 36 | class DC4: 37 | a: int 38 | 39 | 40 | v4: Hashable = DC4(0) 41 | 42 | 43 | @dataclass(eq=True, unsafe_hash=True) 44 | class DC5: 45 | a: int 46 | 47 | 48 | v5: Hashable = DC5(0) 49 | 50 | 51 | @dataclass(eq=True) 52 | class DC6: 53 | a: int 54 | 55 | def __hash__(self) -> int: 56 | return 0 57 | 58 | 59 | v6: Hashable = DC6(0) 60 | 61 | 62 | @dataclass(frozen=True) 63 | class DC7: 64 | a: int 65 | 66 | def __eq__(self, other) -> bool: 67 | return self.a == other.a 68 | 69 | 70 | v7: Hashable = DC7(0) 71 | -------------------------------------------------------------------------------- /conformance/tests/dataclasses_kwonly.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the keyword-only feature of dataclass added in Python 3.10. 3 | """ 4 | 5 | # Specification: https://docs.python.org/3/library/dataclasses.html#module-contents 6 | 7 | from dataclasses import dataclass, KW_ONLY, field 8 | 9 | 10 | @dataclass 11 | class DC1: 12 | a: str 13 | _: KW_ONLY 14 | b: int = 0 15 | 16 | 17 | DC1("hi") 18 | DC1(a="hi") 19 | DC1(a="hi", b=1) 20 | DC1("hi", b=1) 21 | 22 | # This should generate an error because "b" is keyword-only. 23 | DC1("hi", 1) # E 24 | 25 | 26 | @dataclass 27 | class DC2: 28 | b: int = field(kw_only=True, default=3) 29 | a: str 30 | 31 | 32 | DC2("hi") 33 | DC2(a="hi") 34 | DC2(a="hi", b=1) 35 | DC2("hi", b=1) 36 | 37 | # This should generate an error because "b" is keyword-only. 38 | DC2("hi", 1) # E 39 | 40 | 41 | @dataclass(kw_only=True) 42 | class DC3: 43 | a: str = field(kw_only=False) 44 | b: int = 0 45 | 46 | 47 | DC3("hi") 48 | DC3(a="hi") 49 | DC3(a="hi", b=1) 50 | DC3("hi", b=1) 51 | 52 | # This should generate an error because "b" is keyword-only. 53 | DC3("hi", 1) # E 54 | 55 | 56 | @dataclass 57 | class DC4(DC3): 58 | c: float 59 | 60 | 61 | DC4("", 0.2, b=3) 62 | DC4(a="", b=3, c=0.2) 63 | -------------------------------------------------------------------------------- /conformance/tests/dataclasses_order.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the synthesized comparison methods for dataclasses. 3 | """ 4 | 5 | from dataclasses import dataclass 6 | 7 | @dataclass(order=True) 8 | class DC1: 9 | a: str 10 | b: int 11 | 12 | 13 | @dataclass(order=True) 14 | class DC2: 15 | a: str 16 | b: int 17 | 18 | 19 | dc1_1 = DC1("", 0) 20 | dc1_2 = DC1("", 0) 21 | 22 | if dc1_1 < dc1_2: 23 | pass 24 | 25 | if dc1_1 <= dc1_2: 26 | pass 27 | 28 | if dc1_1 > dc1_2: 29 | pass 30 | 31 | if dc1_1 >= dc1_2: 32 | pass 33 | 34 | if dc1_1 == dc1_2: 35 | pass 36 | 37 | if dc1_1 != dc1_2: 38 | pass 39 | 40 | if dc1_1 == None: 41 | pass 42 | 43 | if dc1_1 != None: 44 | pass 45 | 46 | dc2_1 = DC2("hi", 2) 47 | 48 | # This should generate an error because the types are 49 | # incompatible. 50 | if dc1_1 < dc2_1: # E: 51 | pass 52 | 53 | if dc1_1 != dc2_1: 54 | pass 55 | -------------------------------------------------------------------------------- /conformance/tests/directives_assert_type.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the typing.assert_type function. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#assert-type 6 | 7 | from typing import Annotated, Any, Literal, assert_type 8 | 9 | 10 | # > When a type checker encounters a call to assert_type(), it should 11 | # > emit an error if the value is not of the specified type. 12 | 13 | 14 | def func1( 15 | a: int | str, 16 | b: list[int], 17 | c: Any, 18 | d: "ForwardReference", 19 | e: Annotated[Literal[4], ""], 20 | ): 21 | assert_type(a, int | str) # OK 22 | assert_type(b, list[int]) # OK 23 | assert_type(c, Any) # OK 24 | assert_type(d, "ForwardReference") # OK 25 | assert_type(e, Literal[4]) # OK 26 | 27 | assert_type(a, int) # E: Type mismatch 28 | assert_type(c, int) # E: Type mismatch 29 | assert_type(e, int) # E: Type mismatch 30 | 31 | assert_type() # E: not enough arguments 32 | assert_type("", int) # E: wrong argument type 33 | assert_type(a, int | str, a) # E: too many arguments 34 | 35 | 36 | class ForwardReference: 37 | pass 38 | -------------------------------------------------------------------------------- /conformance/tests/directives_cast.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the typing.cast call. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#cast 6 | 7 | from typing import cast 8 | 9 | def find_first_str(a: list[object]) -> str: 10 | index = next(i for i, x in enumerate(a) if isinstance(x, str)) 11 | return cast(str, a[index]) 12 | 13 | x: int = cast(int, "not an int") # No type error 14 | 15 | bad1 = cast() # E: Too few arguments 16 | bad2 = cast(1, "") # E: Bad first argument type 17 | bad3 = cast(int, "", "") # E: Too many arguments 18 | -------------------------------------------------------------------------------- /conformance/tests/directives_reveal_type.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the typing.reveal_type function. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#reveal-type 6 | 7 | from typing import Any, reveal_type 8 | 9 | # > When a static type checker encounters a call to this function, it should 10 | # > emit a diagnostic with the type of the argument. 11 | 12 | 13 | def func1(a: int | str, b: list[int], c: Any, d: "ForwardReference"): 14 | reveal_type(a) # Revealed type is "int | str" 15 | reveal_type(b) # Revealed type is "list[int]" 16 | reveal_type(c) # Revealed type is "Any" 17 | reveal_type(d) # Revealed type is "ForwardReference" 18 | 19 | reveal_type() # E: not enough arguments 20 | reveal_type(a, a) # E: Too many arguments 21 | 22 | 23 | class ForwardReference: 24 | pass 25 | -------------------------------------------------------------------------------- /conformance/tests/directives_type_checking.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the typing.TYPE_CHECKING constant. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#type-checking 6 | 7 | from typing import TYPE_CHECKING, assert_type 8 | 9 | 10 | if not TYPE_CHECKING: 11 | a: int = "" # This should not generate an error 12 | 13 | if TYPE_CHECKING: 14 | b: list[int] = [1, 2, 3] 15 | else: 16 | b: list[str] = ["a", "b", "c"] 17 | 18 | assert_type(b, list[int]) 19 | -------------------------------------------------------------------------------- /conformance/tests/directives_type_ignore.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests "# type: ignore" comments. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#type-ignore-comments 6 | 7 | # The following type violation should be suppressed. 8 | x: int = "" # type: ignore 9 | 10 | # The following type violation should be suppressed. 11 | y: int = "" # type: ignore - additional stuff 12 | 13 | # The following type violation should be suppressed. 14 | z: int = "" # type: ignore[additional_stuff] 15 | 16 | # > In some cases, linting tools or other comments may be needed on the same 17 | # > line as a type comment. In these cases, the type comment should be before 18 | # > other comments and linting markers. 19 | 20 | a: int = "" # type: ignore # other comment 21 | -------------------------------------------------------------------------------- /conformance/tests/directives_type_ignore_file1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # type: ignore 4 | 5 | """ 6 | Tests a file-level type ignore comment. 7 | """ 8 | 9 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#type-ignore-comments 10 | 11 | # > A # type: ignore comment on a line by itself at the top of a file, before any 12 | # > docstrings, imports, or other executable code, silences all errors in the file. 13 | # > Blank lines and other comments, such as shebang lines and coding cookies, may 14 | # > precede the # type: ignore comment. 15 | 16 | x: int = "" # No error should be reported 17 | -------------------------------------------------------------------------------- /conformance/tests/directives_type_ignore_file2.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests a file-level type ignore comment. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/directives.html#type-ignore-comments 6 | 7 | # type: ignore 8 | 9 | # > A # type: ignore comment on a line by itself at the top of a file, before any 10 | # > docstrings, imports, or other executable code, silences all errors in the file. 11 | # > Blank lines and other comments, such as shebang lines and coding cookies, may 12 | # > precede the # type: ignore comment. 13 | 14 | x: int = "" # E: should still error because comment is not at top of file. 15 | -------------------------------------------------------------------------------- /conformance/tests/enums_behaviors.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests basic behaviors of of Enum classes. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/enums.html#enum-definition 6 | 7 | from enum import Enum 8 | from typing import assert_type 9 | 10 | # > Enum classes are iterable and indexable, and they can be called with a 11 | # > value to look up the enum member with that value. Type checkers should 12 | # > support these behaviors 13 | 14 | class Color(Enum): 15 | RED = 1 16 | GREEN = 2 17 | BLUE = 3 18 | 19 | for color in Color: 20 | assert_type(color, Color) 21 | 22 | # > Unlike most Python classes, Calling an enum class does not invoke its 23 | # > constructor. Instead, the call performs a value-based lookup of an 24 | # > enum member. 25 | 26 | assert_type(Color["RED"], Color) # 'Literal[Color.RED]' is also acceptable 27 | assert_type(Color(3), Color) # 'Literal[Color.BLUE]' is also acceptable 28 | 29 | 30 | # > An Enum class with one or more defined members cannot be subclassed. 31 | 32 | class EnumWithNoMembers(Enum): 33 | pass 34 | 35 | class Shape(EnumWithNoMembers): # OK (because no members are defined) 36 | SQUARE = 1 37 | CIRCLE = 2 38 | 39 | class ExtendedShape(Shape): # E: Shape is implicitly final 40 | TRIANGLE = 3 41 | -------------------------------------------------------------------------------- /conformance/tests/enums_member_names.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests that the type checker handles the `_name_` and `name` attributes correctly. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/enums.html#member-names 6 | 7 | from enum import Enum 8 | from typing import Literal, assert_type 9 | 10 | # > All enum member objects have an attribute _name_ that contains the member’s 11 | # > name. They also have a property name that returns the same name. Type 12 | # > checkers may infer a literal type for the name of a member 13 | 14 | 15 | class Color(Enum): 16 | RED = 1 17 | GREEN = 2 18 | BLUE = 3 19 | 20 | 21 | assert_type(Color.RED._name_, Literal["RED"]) # E? 22 | assert_type(Color.RED.name, Literal["RED"]) # E? 23 | 24 | 25 | def func1(red_or_blue: Literal[Color.RED, Color.BLUE]): 26 | assert_type(red_or_blue.name, Literal["RED", "BLUE"]) # E? 27 | 28 | 29 | def func2(any_color: Color): 30 | assert_type(any_color.name, Literal["RED", "BLUE", "GREEN"]) # E? 31 | -------------------------------------------------------------------------------- /conformance/tests/generics_paramspec_basic.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests basic usage of ParamSpec. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#paramspec-variables 6 | 7 | from typing import Any, Callable, Concatenate, ParamSpec, TypeAlias 8 | 9 | P = ParamSpec("P") # OK 10 | WrongName = ParamSpec("NotIt") # E: name inconsistency 11 | 12 | 13 | # > Valid use locations 14 | 15 | TA1: TypeAlias = P # E 16 | 17 | TA2: TypeAlias = Callable[P, None] # OK 18 | TA3: TypeAlias = Callable[Concatenate[int, P], None] # OK 19 | TA4: TypeAlias = Callable[..., None] # OK 20 | TA5: TypeAlias = Callable[..., None] # OK 21 | 22 | 23 | def func1(x: P) -> P: # E 24 | ... 25 | 26 | 27 | def func2(x: Concatenate[int, P]) -> int: # E 28 | ... 29 | 30 | 31 | def func3(x: list[P]) -> None: # E 32 | ... 33 | 34 | 35 | def func4(x: Callable[[int, str], P]) -> None: # E 36 | ... 37 | 38 | 39 | def func5(*args: P, **kwargs: P) -> None: # E 40 | ... 41 | -------------------------------------------------------------------------------- /conformance/tests/generics_self_advanced.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests for advanced or special-case usage of the typing.Self type. 3 | """ 4 | 5 | from typing import assert_type, Self 6 | 7 | 8 | class ParentA: 9 | # Test for property that returns Self. 10 | @property 11 | def prop1(self) -> Self: 12 | ... 13 | 14 | class ChildA(ParentA): 15 | ... 16 | 17 | 18 | assert_type(ParentA().prop1, ParentA) 19 | assert_type(ChildA().prop1, ChildA) 20 | 21 | 22 | # Test for a child that accesses an attribute within a parent 23 | # whose type is annotated using Self. 24 | class ParentB: 25 | a: list[Self] 26 | 27 | @classmethod 28 | def method1(cls) -> Self: 29 | ... 30 | 31 | class ChildB(ParentB): 32 | b: int = 0 33 | 34 | def method2(self) -> None: 35 | assert_type(self, Self) 36 | assert_type(self.a, list[Self]) 37 | assert_type(self.a[0], Self) 38 | assert_type(self.method1(), Self) 39 | 40 | @classmethod 41 | def method3(cls) -> None: 42 | assert_type(cls, type[Self]) 43 | assert_type(cls.a, list[Self]) 44 | assert_type(cls.a[0], Self) 45 | assert_type(cls.method1(), Self) 46 | -------------------------------------------------------------------------------- /conformance/tests/generics_self_attributes.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests for usage of the typing.Self type with attributes. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#use-in-attribute-annotations 6 | 7 | from typing import TypeVar, Generic, Self 8 | from dataclasses import dataclass 9 | 10 | 11 | T = TypeVar("T") 12 | 13 | @dataclass 14 | class LinkedList(Generic[T]): 15 | value: T 16 | next: Self | None = None 17 | 18 | 19 | @dataclass 20 | class OrdinalLinkedList(LinkedList[int]): 21 | def ordinal_value(self) -> str: 22 | return str(self.value) 23 | 24 | 25 | # This should result in a type error. 26 | xs = OrdinalLinkedList(value=1, next=LinkedList[int](value=2)) # E 27 | 28 | if xs.next is not None: 29 | xs.next = OrdinalLinkedList(value=3, next=None) # OK 30 | 31 | # This should result in a type error. 32 | xs.next = LinkedList[int](value=3, next=None) # E 33 | -------------------------------------------------------------------------------- /conformance/tests/generics_syntax_compatibility.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the compatibility rules between type parameter syntax (introduced in PEP 695) 3 | and traditional TypeVars. 4 | """ 5 | 6 | # Specification: https://peps.python.org/pep-0695/#compatibility-with-traditional-typevars 7 | 8 | from typing import TypeVar 9 | 10 | 11 | K = TypeVar("K") 12 | 13 | 14 | class ClassA[V](dict[K, V]): # E: traditional TypeVar not allowed here 15 | ... 16 | 17 | 18 | class ClassB[K, V](dict[K, V]): # OK 19 | ... 20 | 21 | 22 | class ClassC[V]: 23 | def method1(self, a: V, b: K) -> V | K: # OK 24 | ... 25 | 26 | def method2[M](self, a: M, b: K) -> M | K: # E 27 | ... 28 | -------------------------------------------------------------------------------- /conformance/tests/generics_typevartuple_overloads.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the use of TypeVarTuple in function overloads. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#overloads-for-accessing-individual-types 6 | 7 | from typing import Any, Generic, TypeVar, TypeVarTuple, assert_type, overload 8 | 9 | 10 | Shape = TypeVarTuple("Shape") 11 | Axis1 = TypeVar("Axis1") 12 | Axis2 = TypeVar("Axis2") 13 | Axis3 = TypeVar("Axis3") 14 | 15 | 16 | class Array(Generic[*Shape]): 17 | @overload 18 | def transpose(self: "Array[Axis1, Axis2]") -> "Array[Axis2, Axis1]": 19 | ... 20 | 21 | @overload 22 | def transpose(self: "Array[Axis1, Axis2, Axis3]") -> "Array[Axis3, Axis2, Axis1]": 23 | ... 24 | 25 | def transpose(self) -> Any: 26 | pass 27 | 28 | 29 | def func1(a: Array[Axis1, Axis2], b: Array[Axis1, Axis2, Axis3]): 30 | assert_type(a.transpose(), Array[Axis2, Axis1]) 31 | assert_type(b.transpose(), Array[Axis3, Axis2, Axis1]) 32 | -------------------------------------------------------------------------------- /conformance/tests/generics_typevartuple_unpack.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests unpack operations for TypeVarTuple. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/generics.html#unpacking-tuple-types 6 | 7 | from typing import Any, Generic, NewType, TypeVarTuple 8 | 9 | Height = NewType("Height", int) 10 | Width = NewType("Width", int) 11 | Batch = NewType("Batch", int) 12 | Channels = NewType("Channels", int) 13 | 14 | Ts = TypeVarTuple("Ts") 15 | 16 | 17 | class Array(Generic[*Ts]): 18 | ... 19 | 20 | 21 | def process_batch_channels(x: Array[Batch, *tuple[Any, ...], Channels]) -> None: 22 | ... 23 | 24 | 25 | def func3( 26 | x: Array[Batch, Height, Width, Channels], y: Array[Batch, Channels], z: Array[Batch] 27 | ): 28 | process_batch_channels(x) # OK 29 | process_batch_channels(y) # OK 30 | process_batch_channels(z) # E 31 | 32 | 33 | Shape = TypeVarTuple("Shape") 34 | 35 | 36 | def expect_variadic_array(x: Array[Batch, *Shape]) -> None: 37 | ... 38 | 39 | 40 | def expect_precise_array(x: Array[Batch, Height, Width, Channels]) -> None: 41 | ... 42 | 43 | 44 | def func4(y: Array[*tuple[Any, ...]]): 45 | expect_variadic_array(y) # OK 46 | expect_precise_array(y) # OK 47 | -------------------------------------------------------------------------------- /conformance/tests/literals_semantics.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the semantics of the Literal special form. 3 | """ 4 | 5 | from typing import Literal 6 | from typing import Literal as L 7 | 8 | 9 | v1: Literal[3] = 3 10 | v2: Literal[3] = 4 # E 11 | 12 | v3: L[-3] = -3 13 | 14 | 15 | # > Literal[20] and Literal[0x14] are equivalent 16 | def func1(a: Literal[20], b: Literal[0x14], c: Literal[0b10100]): 17 | x1: Literal[0x14] = a 18 | x2: Literal[0x14] = b 19 | x3: Literal[0x14] = c 20 | 21 | 22 | # > Literal[0] and Literal[False] are not equivalent 23 | def func2(a: Literal[0], b: Literal[False]): 24 | x1: Literal[False] = a # E 25 | x2: Literal[0] = b # E 26 | 27 | 28 | # > Given some value v that is a member of type T, the type Literal[v] shall 29 | # > be treated as a subtype of T. For example, Literal[3] is a subtype of int. 30 | def func3(a: L[3, 4, 5]): 31 | b = a.__add__(3) 32 | c = a + 3 33 | a += 3 # E 34 | 35 | 36 | # > When a Literal is parameterized with more than one value, it’s treated 37 | # > as exactly equivalent to the union of those types. 38 | def func4(a: L[None, 3] | L[3, "foo", b"bar", True]): 39 | x1: Literal[3, b"bar", True, "foo", None] = a 40 | a = x1 41 | -------------------------------------------------------------------------------- /conformance/tests/namedtuples_type_compat.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests NamedTuple type compatibility rules. 3 | """ 4 | 5 | from typing import Any, NamedTuple 6 | 7 | # Specification: https://typing.readthedocs.io/en/latest/spec/namedtuples.html#type-compatibility-rules 8 | 9 | 10 | class Point(NamedTuple): 11 | x: int 12 | y: int 13 | units: str = "meters" 14 | 15 | 16 | # > A named tuple is a subtype of a ``tuple`` with a known length and parameterized 17 | # > by types corresponding to the named tuple's individual field types. 18 | 19 | p = Point(x=1, y=2, units="inches") 20 | v1: tuple[int, int, str] = p # OK 21 | v2: tuple[Any, ...] = p # OK 22 | v3: tuple[int, int] = p # E: too few elements 23 | v4: tuple[int, str, str] = p # E: incompatible element type 24 | 25 | # > As with normal tuples, named tuples are covariant in their type parameters. 26 | 27 | v5: tuple[float, float, str] = p # OK 28 | -------------------------------------------------------------------------------- /conformance/tests/protocols_modules.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the handling of modules as the implementation of a protocol. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/protocol.html#modules-as-implementations-of-protocols 6 | 7 | # > A module object is accepted where a protocol is expected if the public 8 | # > interface of the given module is compatible with the expected protocol. 9 | 10 | import _protocols_modules1 11 | import _protocols_modules2 12 | from typing import Protocol 13 | 14 | 15 | class Options1(Protocol): 16 | timeout: int 17 | one_flag: bool 18 | other_flag: bool 19 | 20 | 21 | class Options2(Protocol): 22 | timeout: str 23 | 24 | 25 | op1: Options1 = _protocols_modules1 # OK 26 | op2: Options2 = _protocols_modules1 # E 27 | 28 | 29 | class Reporter1(Protocol): 30 | def on_error(self, x: int) -> None: 31 | ... 32 | 33 | def on_success(self) -> None: 34 | ... 35 | 36 | 37 | class Reporter2(Protocol): 38 | def on_error(self, x: int) -> int: 39 | ... 40 | 41 | 42 | class Reporter3(Protocol): 43 | def not_implemented(self, x: int) -> int: 44 | ... 45 | 46 | 47 | rp1: Reporter1 = _protocols_modules2 # OK 48 | rp2: Reporter2 = _protocols_modules2 # E 49 | rp3: Reporter3 = _protocols_modules2 # E 50 | -------------------------------------------------------------------------------- /conformance/tests/specialtypes_none.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the handling of builtins.None in a type annotation. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/special-types.html#none 6 | 7 | from types import NoneType 8 | from typing import Hashable, Iterable, assert_type 9 | 10 | 11 | # > When used in a type hint, the expression None is considered equivalent to type(None). 12 | 13 | 14 | def func1(val1: None) -> None: 15 | assert_type(val1, None) 16 | t1: None = None 17 | return None # OK 18 | 19 | 20 | func1(None) # OK 21 | func1(type(None)) # E 22 | 23 | # None is hashable 24 | none1: Hashable = None # OK 25 | 26 | # None is not iterable 27 | none2: Iterable = None # E: not iterable 28 | 29 | 30 | None.__class__ # OK 31 | None.__doc__ # OK 32 | None.__eq__(0) # OK 33 | 34 | 35 | def func2(val1: type[None]): 36 | assert_type(val1, type[None]) 37 | 38 | 39 | func2(None.__class__) # OK 40 | func2(type(None)) # OK 41 | func2(None) # E: not compatible 42 | -------------------------------------------------------------------------------- /conformance/tests/specialtypes_promotions.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests "type promotions" for float and complex when they appear in annotations. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/special-types.html#special-cases-for-float-and-complex 6 | 7 | v1: float = 1 8 | v2: complex = 1.2 9 | v2 = 1 10 | 11 | 12 | def func1(f: float): 13 | f.numerator # E 14 | 15 | if not isinstance(f, float): 16 | f.numerator # OK 17 | -------------------------------------------------------------------------------- /conformance/tests/tuples_type_form.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the handling of builtins.tuple. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/tuples.html#tuple-type-form 6 | 7 | # > The type of a tuple can be expressed by listing the element types. 8 | from typing import Literal 9 | 10 | 11 | t1: tuple[int] = (1,) # OK 12 | t1 = (1, 2) # E 13 | t2: tuple[int, int] = (1, 2) # OK 14 | t2 = (1,) # E 15 | t2 = (1, "") # E 16 | 17 | 18 | def func1() -> tuple[Literal[1], Literal[2]]: 19 | return (1, 2) 20 | 21 | 22 | # > The empty tuple can be typed as tuple[()]. 23 | 24 | t10: tuple[()] = () # OK 25 | t10 = (1,) # E 26 | 27 | 28 | def func2() -> list[tuple[()]]: 29 | return [(), (), ()] 30 | 31 | 32 | # > Arbitrary-length homogeneous tuples can be expressed using one type and ellipsis. 33 | t20: tuple[int, ...] = () # OK 34 | t20 = (1,) # OK 35 | t20 = (1, 2, 3, 4) # OK 36 | t20 = (1, 2, 3, "") # E 37 | 38 | 39 | t30: tuple[int, ...] # OK 40 | t31: tuple[int, int, ...] # E 41 | t32: tuple[...] # E 42 | t33: tuple[..., int] # E 43 | t34: tuple[int, ..., int] # E 44 | t35: tuple[*tuple[str], ...] # E 45 | t36: tuple[*tuple[str, ...], ...] # E 46 | -------------------------------------------------------------------------------- /conformance/tests/typeddicts_final.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the use of Final values when used with TypedDicts. 3 | """ 4 | 5 | # Specification: https://typing.readthedocs.io/en/latest/spec/typeddict.html#use-of-final-values-and-literal-types 6 | 7 | from typing import Final, Literal, TypedDict 8 | 9 | 10 | class Movie(TypedDict): 11 | name: str 12 | year: int 13 | 14 | 15 | # > Type checkers should allow final names (PEP 591) with string values to be 16 | # > used instead of string literals in operations on TypedDict objects. 17 | YEAR: Final = "year" 18 | 19 | m: Movie = {"name": "Alien", "year": 1979} 20 | years_since_epoch = m[YEAR] - 1970 21 | 22 | 23 | # > An expression with a suitable literal type (PEP 586) can be used instead of 24 | # > a literal value. 25 | def get_value(movie: Movie, key: Literal["year", "name"]) -> int | str: 26 | return movie[key] 27 | -------------------------------------------------------------------------------- /conformance/tests/typeddicts_readonly_kwargs.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests the use of unpacked TypedDicts with read-only items when used to annotate 3 | a **kwargs parameter. 4 | """ 5 | 6 | # Specification: https://typing.readthedocs.io/en/latest/spec/typeddict.html#read-only-items 7 | 8 | from typing import Protocol, TypedDict, Unpack 9 | from typing_extensions import ReadOnly 10 | 11 | # > :pep:`692` introduced ``Unpack`` to annotate ``**kwargs`` with a 12 | # > ``TypedDict``. Marking one or more of the items of a ``TypedDict`` used 13 | # > in this way as read-only will have no effect on the type signature of 14 | # > the method. However, it *will* prevent the item from being modified in 15 | # > the body of the function. 16 | 17 | 18 | class Args(TypedDict): 19 | key1: int 20 | key2: str 21 | 22 | 23 | class ReadOnlyArgs(TypedDict): 24 | key1: ReadOnly[int] 25 | key2: ReadOnly[str] 26 | 27 | 28 | class Function(Protocol): 29 | def __call__(self, **kwargs: Unpack[Args]) -> None: ... 30 | 31 | 32 | def impl(**kwargs: Unpack[ReadOnlyArgs]) -> None: 33 | kwargs["key1"] = 3 # E 34 | 35 | 36 | fn: Function = impl # OK 37 | -------------------------------------------------------------------------------- /conformance/tests/typeddicts_readonly_update.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests inheritance rules involving the update method for TypedDicts 3 | that contain read-only items. 4 | """ 5 | 6 | # Specification: https://typing.readthedocs.io/en/latest/spec/typeddict.html#read-only-items 7 | 8 | from typing import Never, NotRequired, TypedDict 9 | from typing_extensions import ReadOnly 10 | 11 | # > In addition to existing type checking rules, type checkers should error if 12 | # > a TypedDict with a read-only item is updated with another TypedDict that 13 | # > declares that key. 14 | 15 | 16 | class A(TypedDict): 17 | x: ReadOnly[int] 18 | y: int 19 | 20 | 21 | a1: A = {"x": 1, "y": 2} 22 | a2: A = {"x": 3, "y": 4} 23 | a1.update(a2) # E 24 | 25 | # > Unless the declared value is of bottom type (:data:`~typing.Never`). 26 | 27 | 28 | class B(TypedDict): 29 | x: NotRequired[Never] 30 | y: ReadOnly[int] 31 | 32 | 33 | def update_a(a: A, b: B) -> None: 34 | a.update(b) # OK 35 | -------------------------------------------------------------------------------- /conformance/tests/typeddicts_usage.py: -------------------------------------------------------------------------------- 1 | """ 2 | Tests for basic usage of TypedDict. 3 | """ 4 | 5 | from typing import TypeVar, TypedDict 6 | 7 | 8 | class Movie(TypedDict): 9 | name: str 10 | year: int 11 | 12 | 13 | movie: Movie = {"name": "Blade Runner", "year": 1982} 14 | 15 | 16 | def record_movie(movie: Movie) -> None: 17 | ... 18 | 19 | 20 | record_movie({"name": "Blade Runner", "year": 1982}) 21 | 22 | 23 | movie["director"] = "Ridley Scott" # E: invalid key 'director' 24 | movie["year"] = "1982" # E: invalid value type ("int" expected) 25 | 26 | # The code below should be rejected, since 'title' is not a valid key, 27 | # and the 'name' key is missing: 28 | movie2: Movie = {"title": "Blade Runner", "year": 1982} # E 29 | 30 | m = Movie(name='Blade Runner', year=1982) 31 | 32 | 33 | # > TypedDict type objects cannot be used in isinstance() tests such as 34 | # > isinstance(d, Movie). 35 | if isinstance(movie, Movie): # E 36 | pass 37 | 38 | 39 | # TypedDict should not be allowed as a bound for a TypeVar. 40 | T = TypeVar("T", bound=TypedDict) # E 41 | -------------------------------------------------------------------------------- /docs/guides/index.rst: -------------------------------------------------------------------------------- 1 | ****************** 2 | Type System Guides 3 | ****************** 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | :caption: Contents: 8 | 9 | libraries 10 | writing_stubs 11 | modernizing 12 | unreachable 13 | type_narrowing 14 | typing_anti_pitch 15 | -------------------------------------------------------------------------------- /docs/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=. 11 | set BUILDDIR=_build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -W -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /docs/reference/index.rst: -------------------------------------------------------------------------------- 1 | ********************* 2 | Type System Reference 3 | ********************* 4 | 5 | .. toctree:: 6 | :maxdepth: 2 7 | :caption: Contents: 8 | 9 | generics 10 | protocols 11 | best_practices 12 | quality 13 | typing Module Documentation 14 | -------------------------------------------------------------------------------- /docs/reference/stubs.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ********** 4 | Type Stubs 5 | ********** 6 | 7 | The contents of this document have been moved to :ref:`stub-files` and 8 | :ref:`writing_stubs`. 9 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | # Requirements to build the Python documentation 2 | 3 | # Sphinx version is pinned so that new versions that introduce new warnings 4 | # won't suddenly cause build failures. Updating the version is fine as long 5 | # as no warnings are raised by doing so. 6 | sphinx==7.2.6 7 | 8 | # The theme used by the documentation is stored separately, so we need 9 | # to install that as well. 10 | python-docs-theme 11 | -------------------------------------------------------------------------------- /docs/spec/index.rst: -------------------------------------------------------------------------------- 1 | Specification for the Python type system 2 | ======================================== 3 | 4 | .. toctree:: 5 | :maxdepth: 2 6 | :caption: Contents: 7 | 8 | type-system 9 | meta 10 | concepts 11 | annotations 12 | special-types 13 | generics 14 | qualifiers 15 | class-compat 16 | aliases 17 | literal 18 | protocol 19 | callables 20 | constructors 21 | overload 22 | exceptions 23 | dataclasses 24 | typeddict 25 | tuples 26 | namedtuples 27 | enums 28 | narrowing 29 | directives 30 | distributing 31 | historical 32 | glossary 33 | -------------------------------------------------------------------------------- /test-requirements.txt: -------------------------------------------------------------------------------- 1 | flake8 2 | flake8-bugbear 3 | flake8-pyi 4 | --------------------------------------------------------------------------------