You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, ukvsconvert.py has some duplicate code in various serialization functions, which can benefit from some DRYing (Don't Repeat Yourself).
More importantly, it parses UKVS files with a very specific order and spacing in mind, which makes the parser brittle and defeats the purpose of JSON block. After splitting the first two columns out the remaining JSON part of the line can simply be parsed using standard json.loads() function.
Moreover, a template system can be used to serialize the output in various formats. This is not necessary, but will make the code more maintainable in the long run. In fact, JSON serialization does not even need a custom template, it can simply be done using json.dumps() function (the output can be customized to have certain indentation, spacing, line breaks, or sorting of keys).
The text was updated successfully, but these errors were encountered:
Currently,
ukvsconvert.py
has some duplicate code in various serialization functions, which can benefit from some DRYing (Don't Repeat Yourself).More importantly, it parses UKVS files with a very specific order and spacing in mind, which makes the parser brittle and defeats the purpose of JSON block. After splitting the first two columns out the remaining JSON part of the line can simply be parsed using standard
json.loads()
function.Moreover, a template system can be used to serialize the output in various formats. This is not necessary, but will make the code more maintainable in the long run. In fact, JSON serialization does not even need a custom template, it can simply be done using
json.dumps()
function (the output can be customized to have certain indentation, spacing, line breaks, or sorting of keys).The text was updated successfully, but these errors were encountered: