diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 79892cd22..d13ffc3e2 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -13,7 +13,7 @@ repos: - id: check-merge-conflict - id: end-of-file-fixer - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.0.278 + rev: v0.0.280 hooks: - id: ruff args: ["--fix", "--exit-non-zero-on-fix"] diff --git a/mypy_django_plugin/django/context.py b/mypy_django_plugin/django/context.py index cf98067bf..79b60053d 100644 --- a/mypy_django_plugin/django/context.py +++ b/mypy_django_plugin/django/context.py @@ -363,7 +363,7 @@ def _resolve_field_from_parts( self, field_parts: Iterable[str], model_cls: Type[Model] ) -> Union["Field[Any, Any]", ForeignObjectRel]: currently_observed_model = model_cls - field: Union["Field[Any, Any]", ForeignObjectRel, GenericForeignKey, None] = None + field: Union[Field[Any, Any], ForeignObjectRel, GenericForeignKey, None] = None for field_part in field_parts: if field_part == "pk": field = self.get_primary_key_field(currently_observed_model) diff --git a/mypy_django_plugin/transformers/querysets.py b/mypy_django_plugin/transformers/querysets.py index 5ba3c6810..bca760e90 100644 --- a/mypy_django_plugin/transformers/querysets.py +++ b/mypy_django_plugin/transformers/querysets.py @@ -92,7 +92,7 @@ def get_values_list_row_type( assert lookup_type is not None return lookup_type elif named: - column_types: "OrderedDict[str, MypyType]" = OrderedDict() + column_types: OrderedDict[str, MypyType] = OrderedDict() for field in django_context.get_model_fields(model_cls): column_type = django_context.get_field_get_type(typechecker_api, field, method="values_list") column_types[field.attname] = column_type @@ -292,7 +292,7 @@ def extract_proper_type_queryset_values(ctx: MethodContext, django_context: Djan for field in django_context.get_model_fields(model_cls): field_lookups.append(field.attname) - column_types: "OrderedDict[str, MypyType]" = OrderedDict() + column_types: OrderedDict[str, MypyType] = OrderedDict() for field_lookup in field_lookups: field_lookup_type = get_field_type_from_lookup( ctx, django_context, model_cls, lookup=field_lookup, method="values" diff --git a/tests/test_error_handling.py b/tests/test_error_handling.py index b25f07b48..2a40beb4c 100644 --- a/tests/test_error_handling.py +++ b/tests/test_error_handling.py @@ -142,14 +142,12 @@ def test_toml_misconfiguration_handling(capsys: Any, config_file_contents, messa @pytest.mark.parametrize("boolean_value", ["true", "false"]) def test_correct_toml_configuration(boolean_value: str) -> None: - config_file_contents = """ + config_file_contents = f""" [tool.django-stubs] some_other_setting = "setting" django_settings_module = "my.module" - strict_settings = {} - """.format( - boolean_value - ) + strict_settings = {boolean_value} + """ with write_to_file(config_file_contents, suffix=".toml") as filename: config = DjangoPluginConfig(filename)