Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #1633

Merged
merged 2 commits into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion mypy_django_plugin/django/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions mypy_django_plugin/transformers/querysets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
8 changes: 3 additions & 5 deletions tests/test_error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down