Skip to content

Commit

Permalink
Fix some type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri committed Nov 9, 2021
1 parent 510e970 commit 02e62a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 2 additions & 4 deletions src/ini2toml/drivers/full_toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,9 @@ def _collapse_irepr(obj: IntermediateRepr, root=False):
v and isinstance(v, (list, Mapping, UserList)) or isinstance(k, CommentKey)
for k, v in obj.items()
):
out = table()
return _convert_irepr_to_toml(obj, table())
else:
out = inline_table()

return _convert_irepr_to_toml(obj, out)
return _convert_irepr_to_toml(obj, inline_table())


@collapse.register(dict)
Expand Down
4 changes: 3 additions & 1 deletion src/ini2toml/plugins/setuptools_pep621.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
Type,
TypeVar,
Union,
cast,
)

from packaging.requirements import Requirement
Expand Down Expand Up @@ -299,7 +300,7 @@ def merge_and_rename_long_description_and_content_type(self, doc: R) -> R:
if len(list(readme.keys())) == 1 and "file" in readme:
metadata["long-description"] = readme["file"]
else:
metadata["long-description"] = IR(readme)
metadata["long-description"] = IR(readme) # type: ignore[arg-type]
metadata.rename("long-description", "readme")
return doc

Expand All @@ -325,6 +326,7 @@ def merge_license_and_files(self, doc: R) -> R:
return doc

if files_as_list:
files = cast(CommentedList[str], files)
license = IR(file=Commented(files_as_list[0], files[0].comment))
elif "license" in metadata:
license = IR(text=metadata["license"])
Expand Down

0 comments on commit 02e62a9

Please sign in to comment.