Skip to content

Commit

Permalink
Merge pull request #4 from reallistic/ignore_zope_interfaces_attrs
Browse files Browse the repository at this point in the history
ignore zope.interface.ro.C3 attributes which can continually add the ORIG_ prefix
  • Loading branch information
reallistic committed Jun 10, 2020
2 parents 439ec00 + 8675c1b commit c89dd10
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyloot/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ def _safe_repr(obj: object) -> str:


def _safe_getattr(obj: object, k: str, default: Any = Exception):
try:
from zope.interface.ro import C3

if isinstance(obj, C3) or issubclass(obj, C3):
if k.startswith("ORIG_"):
return "__ignored_zope_interface_C3_{}__".format(k)
except (ImportError, TypeError):
pass

try:
return getattr(obj, k)
except Exception as e:
Expand Down

0 comments on commit c89dd10

Please sign in to comment.