Skip to content

Commit

Permalink
to_json/to_proto methods on structs are deprecated and will be removed
Browse files Browse the repository at this point in the history
Fixes #294
  • Loading branch information
tetromino committed Apr 29, 2021
1 parent 398f312 commit dd4e713
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/structs.bzl
Expand Up @@ -25,10 +25,11 @@ def _to_dict(s):
transformation is only applied to the struct's fields and not to any
nested values.
"""
attributes = dir(s)
attributes.remove("to_json")
attributes.remove("to_proto")
return {key: getattr(s, key) for key in attributes}
return {
key: getattr(s, key)
for key in dir(s)
if key != "to_json" and key != "to_proto"
}

structs = struct(
to_dict = _to_dict,
Expand Down

0 comments on commit dd4e713

Please sign in to comment.