Skip to content

Commit c9813ef

Browse files
authored
Merge pull request robotpy#64 from wflohry/sameid
Fixing type reference to self
2 parents 0e011f8 + f3b9108 commit c9813ef

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

CppHeaderParser/CppHeaderParser.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3709,11 +3709,28 @@ def toJSON(self, indent=4, separators=None):
37093709
import json
37103710

37113711
self._strip_parent_keys()
3712+
3713+
def clean_dict(markers, keys=[]):
3714+
if id(markers) in keys:
3715+
return None
3716+
elif isinstance(markers, dict):
3717+
keys_ = keys + [id(markers)]
3718+
return {
3719+
key: clean_dict(markers[key], keys_)
3720+
for key, value in markers.items()
3721+
}
3722+
elif type(markers) in [list, set, tuple]:
3723+
return type(markers)(clean_dict(m, keys) for m in markers)
3724+
return markers
3725+
37123726
try:
37133727
del self.__dict__["classes_order"]
37143728
except:
37153729
pass
3716-
return json.dumps(self.__dict__, indent=indent, separators=separators)
3730+
3731+
d = self.__dict__
3732+
d["classes"] = clean_dict(d["classes"])
3733+
return json.dumps(d, indent=indent, separators=separators, default="")
37173734

37183735
def __repr__(self):
37193736
rtn = {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy