Unexpected arguments type error
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
Below code provides example:
MergeStrategy = NamedTuple(
typename="MergeStrategy",
fields=[("left", str), ("right", str), ("how", str), ("on", List[str])],
)
Generates error
{
"resource": <>,
"owner": "python",
"code": "error",
"severity": 8,
"message": "Unexpected arguments to namedtuple()",
"source": "mypy",
"startLineNumber": 53,
"startColumn": 18,
"endLineNumber": 53,
"endColumn": 18
}
whereas this does not:
MergeStrategy = NamedTuple(
"MergeStrategy", [("left", str), ("right", str), ("how", str), ("on", List[str])],
)
Same thing for regular namedtuple.
get same error with this:
MergeStrategy = namedtuple(typename="MergeStrategy", field_names=["left", "right", "how", "on"])
but this is fine:
MergeStrategy = namedtuple("MergeStrategy", ["left", "right", "how", "on"])
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by reproducing the reported mypy errors for NamedTuple and namedtuple calls with keyword arguments, then trace the argument handling for these constructors. Done means the keyword and positional forms are checked consistently, with regression coverage for the examples.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100