8000 Fixing type reference to self by wflohry · Pull Request #64 · robotpy/robotpy-cppheaderparser · GitHub
[go: up one dir, main page]

Skip to content

Fixing type reference to self #64

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

Merged
merged 2 commits into from
Feb 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion CppHeaderParser/CppHeaderParser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3709,11 +3709,28 @@ def toJSON(self, indent=4, separators=None):
import json

self._strip_parent_keys()

def clean_dict(markers, keys=[]):
if id(markers) in keys:
return None
elif isinstance(markers, dict):
keys_ = keys + [id(markers)]
return {
key: clean_dict(markers[key], keys_)
for key, value in markers.items()
}
elif type(markers) in [list, set, tuple]:
return type(markers)(clean_dict(m, keys) for m in markers)
return markers

try:
del self.__dict__["classes_order"]
except:
pass
return json.dumps(self.__dict__, indent=indent, separators=separators)

d = self.__dict__
d["classes"] = clean_dict(d["classes"])
return json.dumps(d, indent=indent, separators=separators, default="")

def __repr__(self):
rtn = {
Expand Down
0