Skip to content

Commit

Permalink
Use ARG_TYPE error code
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra committed May 18, 2024
1 parent 180f419 commit 365433c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mypy/semanal_namedtuple.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from contextlib import contextmanager
from typing import Container, Final, Iterator, List, Mapping, cast

from mypy.errorcodes import ARG_TYPE, ErrorCode
from mypy.exprtotype import TypeTranslationError, expr_to_unanalyzed_type
from mypy.messages import MessageBuilder
from mypy.nodes import (
Expand Down Expand Up @@ -381,6 +382,7 @@ def parse_namedtuple_args(
'Boolean literal expected as the "rename" argument to '
f"{type_name}()",
arg,
code=ARG_TYPE,
)
if call.arg_kinds[:2] != [ARG_POS, ARG_POS]:
self.fail(f'Unexpected arguments to "{type_name}()"', call)
Expand Down Expand Up @@ -700,5 +702,5 @@ def check_namedtuple_field_name(self, field: str, seen_names: Container[str]) ->
return f'field name "{field}" is a keyword'
return None

def fail(self, msg: str, ctx: Context) -> None:
self.api.fail(msg, ctx)
def fail(self, msg: str, ctx: Context, code: ErrorCode | None = None) -> None:
self.api.fail(msg, ctx, code=code)

0 comments on commit 365433c

Please sign in to comment.