samuelcolvin / rtoml

A fast TOML library for python implemented in rust.

Home Page:https://pypi.org/project/rtoml/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does `load` return a dict ?

GilShoshan94 opened this issue · comments

Hi,

Thank you for rtoml, rust is sure fast !

The type hint of the return values are well defined for dumps(obj: Any, *, pretty: bool = False) -> str and dump(obj: Any, file: Union[Path, TextIO], *, pretty: bool = False) -> int.

But not for loads(toml: str) -> Any and load(toml: Union[str, Path, TextIO]) -> Any.

Why Any and not dict ?

I thought that a TOML would always load into a dict in Python.
Am I missing something ?

You might be right, I haven't used toml much recently.

Are you sure there's no way the root type can be a list or string?

Humm, looks like you're right.

Happy to accept a PR to change it.

Hi @samuelcolvin

I did the pull request #21.

I let you close this issue once you merge it.

just a side note, if you include close #?? in your pull request, or similar the issue will be automatically closed by merging the PR.

otherwise looking good.

if you include close #?? in your pull request, or similar the issue will be automatically closed by merging the PR.

I didn't know, thank you for the tip.