python-poetry / python-poetry/tomlkit

function with argument of type`Item` should be compatible with `Table`

Open
#135 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
850
Forks
162
Avg merge
13m
Merged PRs (30d)
2

Description

Error:

Argument 2 to "add" of "Container" has incompatible type "Table"; expected "Optional[Item]"

However, in the source code of Item, it indicates it can be a Table.

https://github.com/sdispater/tomlkit/blob/627fb1ae496a2531ec738e00c1abf6339472c1a4/tomlkit/items.py#L303-L304

It should allow me to pass a Table to .add().

Version 0.7.2
Python 3.7.2
mypy: 0.790

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in items.py around the linked Item definition and inspect the Container.add entry point and its type annotations. Reproduce the reported mypy error with Python 3.7.2 and mypy 0.790; done means mypy accepts passing a Table to add without the incompatible-type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.