New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
REQ: Create equivalent to box.from_file for strings (box.from_str ?) #195
Comments
The main issue with this is that
|
How about this: determine the format from a mandatory parameter, but detect whether is a BoxList or a Box from the content? That was my main goal anyway. |
Thinking about it a bit more, I think it would be safe to assume json standard (as that is the only converter in standard library), and have a parameter for changing type.
Thoughs? |
Seems reasonable. |
* Adding Python 3.11 support * Adding #195 box_from_string function (thanks to Marcelo Huerta) * Changing the deprecated ``toml`` package with modern ``tomllib``, ``tomli`` and ``tomli-w`` usage (thanks to Michał Górny) * Fixing mypy __ior__ type (thanks to Jacob Hayes) * Fixing line endings with a pre-commit update * Fixing BoxList was using old style of `super` in internal code usage Co-authored-by: Jacob Hayes <jacob.r.hayes@gmail.com> Co-authored-by: Michał Górny <mgorny@gentoo.org>
Added in 6.10.0 https://github.com/cdgriffith/Box/releases/tag/6.10.0 |
Sometimes it's not known beforehand if the value of a string will contain a list or a dict.
It would be useful to have a function to autodetect the required type (
Box
orBoxList
) as it is done forbox.from_file
.Alternatively, enhance
box.from_file
to accept a file-like (but in that case if you have astr
, you have to resort toio.StringIO
; a separate function, possible calledbox.from_str
, would be preferable).The text was updated successfully, but these errors were encountered: