Running mypy on the main Flagsmith code repo I'm hitting an error that I can't escape from even if I add the offending file to the exclude list or if I mark the offending line of code that causes the error as # type: ignore.
Traceback
Traceback (most recent call last):
File "mypy/checkexpr.py", line 5848, in accept
File "mypy/nodes.py", line 1969, in accept
File "mypy/checkexpr.py", line 480, in visit_call_expr
File "mypy/checkexpr.py", line 614, in visit_call_expr_inner
File "mypy/checkexpr.py", line 1471, in check_call_expr_with_callee_type
File "mypy/checkexpr.py", line 1565, in check_call
File "mypy/checkexpr.py", line 1811, in check_callable_call
File "mypy/checkexpr.py", line 1262, in apply_function_plugin
File "/home/zach/.cache/pypoetry/virtualenvs/flagsmith-api-rl5v6uhh-py3.12/lib/python3.12/site-packages/mypy_django_plugin/transformers/querysets.py", line 311, in extract_proper_type_queryset_values
row_type = helpers.make_typeddict(ctx.api, column_types, set(column_types.keys()))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zach/.cache/pypoetry/virtualenvs/flagsmith-api-rl5v6uhh-py3.12/lib/python3.12/site-packages/mypy_django_plugin/lib/helpers.py", line 355, in make_typeddict
typed_dict_type = TypedDictType(fields, required_keys=required_keys, fallback=fallback_type)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: __init__() missing required argument 'readonly_keys' (pos 3)
To Reproduce
Failure is on the type: ignore line below. The full code for the file is found here
def restrict_use_due_to_api_limit_grace_period_over() -> None:
"""
Restrict API use once a grace period has ended.
Since free plans don't have predefined subscription periods, we
use a rolling thirty day period to filter them.
"""
now = timezone.now()
grace_period = now - timedelta(days=API_USAGE_GRACE_PERIOD)
month_start = now - timedelta(30)
queryset = (
OrganisationAPIUsageNotification.objects.filter( # type: ignore
Q(
notified_at__gte=month_start,
notified_at__lte=grace_period,
percent_usage__gte=100,
)
| Q(
notified_at__gte=month_start,
notified_at__lte=now,
percent_usage__gte=100,
organisation__breached_grace_period__isnull=False,
)
)
.values("organisation")
.annotate(max_value=Max("percent_usage"))
)
Your Environment
Mypy version used: mypy 1.13.0 (compiled: yes)
Mypy command-line flags: poetry run mypy --config-file mypy.ini .
Mypy configuration options from mypy.ini (and other config files):
Note that organisations/tasks.py is the file that is causing an issue, but even adding it to exclude doesn't help.
Crash Report
Running mypy on the main Flagsmith code repo I'm hitting an error that I can't escape from even if I add the offending file to the exclude list or if I mark the offending line of code that causes the error as
# type: ignore
.Traceback
To Reproduce Failure is on the type: ignore line below. The full code for the file is found here
Your Environment
mypy 1.13.0 (compiled: yes)
poetry run mypy --config-file mypy.ini .
Mypy configuration options from
mypy.ini
(and other config files): Note thatorganisations/tasks.py
is the file that is causing an issue, but even adding it to exclude doesn't help.Python 3.12.3