Safe version of getattr. Same as getattr, but will return ``default`` on any Exception, rather than raising.
(obj, attr, default=None)
| 125 | _re_pattern_type = type(re.compile('')) |
| 126 | |
| 127 | def _safe_getattr(obj, attr, default=None): |
| 128 | """Safe version of getattr. |
| 129 | |
| 130 | Same as getattr, but will return ``default`` on any Exception, |
| 131 | rather than raising. |
| 132 | """ |
| 133 | try: |
| 134 | return getattr(obj, attr, default) |
| 135 | except Exception: |
| 136 | return default |
| 137 | |
| 138 | def _sorted_for_pprint(items): |
| 139 | """ |
no outgoing calls
no test coverage detected
searching dependent graphs…