-
Notifications
You must be signed in to change notification settings - Fork 33
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
Handling for #base and #include #9
Comments
I hadn't seen that you had already created this issue, but I implemented something similar in my fork. I am dealing with theater files for Insurgency, which are KeyValues files that leverage #base extensively. I am also a very new Python programmer, so I am nearly certain that my merge function is inefficient, but it does produce correct output as far as the theater is concerned. Take a peek at my fork, and the theater.py file specifically. I don't know if merging all the theater specific things I will need (ordered list overrides, "include" directive within key types, distance-based lists and vector data types) will be useful to the wider project, but I'd be glad to help port over the useful stuff to the mainline code. |
Hi @jaredballou, the problem is that this module is supposed to (de)serialize to/from vdf/kv1. When we add #include and #base, how do you specify the location of the included files? Then it has to deal with encoding. What if the files are loaded from strings? It seem much more simpler to keep it as it is and let the application add that functionality for its' case, like you did. One thing I think I could do is provide a method to merge VDFDicts. |
Yes, that'd be good. The way I do it is with wrapping the vdf functions in the theater class, and then I send the filename to the class, rather than a file handle. But seeing that these directives (and "[conditional]" statements) are part of the KeyValues standard, it does seem like it should be included. I still don't like how it works in my fork, probably because I am a very new Python coder, but if you wanted to work together to draw up a plan, I'd be happy to help. |
Apparently the VDF format supports definitions for merging files.
#base
will merge KVs from the specified file with the ones from the current#include
will appendI don't see how that could be implemented in the module reliably. It should be fairly simple to implement at application level for the specific use case.
That leaves allowing.#
symbol to be used as unquoted key or value, which is currently not supportedThe text was updated successfully, but these errors were encountered: