unicode(e) with various fallbacks. Used for exceptions, which may not be safe to call unicode() on.
(e)
| 60 | return wrapper |
| 61 | |
| 62 | def safe_unicode(e): |
| 63 | """unicode(e) with various fallbacks. Used for exceptions, which may not be |
| 64 | safe to call unicode() on. |
| 65 | """ |
| 66 | try: |
| 67 | return str(e) |
| 68 | except UnicodeError: |
| 69 | pass |
| 70 | |
| 71 | try: |
| 72 | return repr(e) |
| 73 | except UnicodeError: |
| 74 | pass |
| 75 | |
| 76 | return u'Unrecoverably corrupt evalue' |
| 77 | |
| 78 | # shutil.which from Python 3.4 |
| 79 | def _shutil_which(cmd, mode=os.F_OK | os.X_OK, path=None): |
nothing calls this directly
no outgoing calls
no test coverage detected