| 7 | # SafeRepr based on the pydevd implementation |
| 8 | # https://github.com/microsoft/ptvsd/blob/master/src/ptvsd/_vendored/pydevd/_pydevd_bundle/pydevd_safe_repr.py |
| 9 | class VC_SafeRepr(object): |
| 10 | # Py3 compat - alias unicode to str, and xrange to range |
| 11 | try: |
| 12 | unicode # noqa |
| 13 | except NameError: |
| 14 | unicode = str |
| 15 | try: |
| 16 | xrange # noqa |
| 17 | except NameError: |
| 18 | xrange = range |
| 19 | |
| 20 | # Can be used to override the encoding from locale.getpreferredencoding() |
| 21 | locale_preferred_encoding = None |
| 22 | |
| 23 | # Can be used to override the encoding used for sys.stdout.encoding |
| 24 | sys_stdout_encoding = None |
| 25 | |
| 26 | # String types are truncated to maxstring_outer when at the outer- |
| 27 | # most level, and truncated to maxstring_inner characters inside |
| 28 | # collections. |
| 29 | maxstring_outer = 2**16 |
| 30 | maxstring_inner = 30 |
| 31 | if not VC_IS_PY2: |
| 32 | string_types = (str, bytes) |
| 33 | set_info = (set, "{", "}", False) |
| 34 | frozenset_info = (frozenset, "frozenset({", "})", False) |
| 35 | int_types = (int,) |
| 36 | long_iter_types = (list, tuple, bytearray, range, dict, set, frozenset) |
| 37 | else: |
| 38 | string_types = (str, unicode) |
| 39 | set_info = (set, "set([", "])", False) |
| 40 | frozenset_info = (frozenset, "frozenset([", "])", False) |
| 41 | int_types = (int, long) # noqa |
| 42 | long_iter_types = ( |
| 43 | list, |
| 44 | tuple, |
| 45 | bytearray, |
| 46 | xrange, |
| 47 | dict, |
| 48 | set, |
| 49 | frozenset, |
| 50 | buffer, |
| 51 | ) # noqa |
| 52 | |
| 53 | # Collection types are recursively iterated for each limit in |
| 54 | # maxcollection. |
| 55 | maxcollection = (15, 10) |
| 56 | |
| 57 | # Specifies type, prefix string, suffix string, and whether to include a |
| 58 | # comma if there is only one element. (Using a sequence rather than a |
| 59 | # mapping because we use isinstance() to determine the matching type.) |
| 60 | collection_types = [ |
| 61 | (tuple, "(", ")", True), |
| 62 | (list, "[", "]", False), |
| 63 | frozenset_info, |
| 64 | set_info, |
| 65 | ] |
| 66 | try: |
no test coverage detected