Skip to content

Commit e025e94

Browse files
committed
Fixing type reference to self
1 parent 0e011f8 commit e025e94

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

CppHeaderParser/CppHeaderParser.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3707,13 +3707,25 @@ def _strip_parent_keys(self):
37073707
def toJSON(self, indent=4, separators=None):
37083708
"""Converts a parsed structure to JSON"""
37093709
import json
3710-
37113710
self._strip_parent_keys()
3711+
def clean_dict(markers, keys = []):
3712+
if (id(markers) in keys):
3713+
return None
3714+
elif isinstance(markers, dict):
3715+
keys_ = keys + [id(markers)]
3716+
return {key: clean_dict(markers[key], keys_) for
3717+
key, value in markers.items()}
3718+
elif type(markers) in [list, set, tuple]:
3719+
return type(markers)(clean_dict(m, keys) for m in markers)
3720+
return markers
37123721
try:
37133722
del self.__dict__["classes_order"]
37143723
except:
37153724
pass
3716-
return json.dumps(self.__dict__, indent=indent, separators=separators)
3725+
3726+
d = self.__dict__
3727+
d["classes"] = clean_dict(d["classes"])
3728+
return json.dumps(d, indent=indent, separators=separators, default = "")
37173729

37183730
def __repr__(self):
37193731
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