5 |
5 |
6 """ |
6 """ |
7 Module implementing classes and functions to dump variable contents. |
7 Module implementing classes and functions to dump variable contents. |
8 """ |
8 """ |
9 |
9 |
10 import sys |
|
11 |
|
12 from DebugConfig import ConfigQtNames, ConfigKnownQtTypes, BatchSize |
10 from DebugConfig import ConfigQtNames, ConfigKnownQtTypes, BatchSize |
13 |
11 |
14 # |
12 # |
15 # This code was inspired by pydevd. |
13 # This code was inspired by pydevd. |
16 # |
14 # |
17 |
|
18 if sys.version_info[0] > 2: |
|
19 basestring = str |
|
20 |
15 |
21 ############################################################ |
16 ############################################################ |
22 ## Classes implementing resolvers for various compund types |
17 ## Classes implementing resolvers for various compund types |
23 ############################################################ |
18 ############################################################ |
24 |
19 |
139 @param key key to be converted |
134 @param key key to be converted |
140 @type any |
135 @type any |
141 @return string representation of the given key |
136 @return string representation of the given key |
142 @rtype str |
137 @rtype str |
143 """ |
138 """ |
144 if isinstance(key, basestring): |
139 if isinstance(key, str): |
145 key = repr(key) |
140 key = repr(key) |
146 # Special handling for Python2 unicode strings and bytes object |
141 # Special handling for Python2 unicode strings and bytes object |
147 # Raw and f-Strings are always converted to (unicode) str |
142 # Raw and f-Strings are always converted to (unicode) str |
148 if key[0] in 'ub': |
143 if key[0] in 'ub': |
149 key = key[1:] |
144 key = key[1:] |
651 (frozenset, setResolver), |
646 (frozenset, setResolver), |
652 ] |
647 ] |
653 |
648 |
654 try: |
649 try: |
655 _TypeMap.append((long, None)) # __IGNORE_WARNING__ |
650 _TypeMap.append((long, None)) # __IGNORE_WARNING__ |
656 except Exception: |
651 except Exception: # secok |
657 pass # not available on all Python versions |
652 pass # not available on all Python versions |
658 |
653 |
659 try: |
654 try: |
660 _TypeMap.append((unicode, None)) # __IGNORE_WARNING__ |
655 _TypeMap.append((unicode, None)) # __IGNORE_WARNING__ |
661 except Exception: |
656 except Exception: # secok |
662 pass # not available on all Python versions |
657 pass # not available on all Python versions |
663 |
658 |
664 try: |
659 try: |
665 import array |
660 import array |
666 _TypeMap.append((array.array, arrayResolver)) |
661 _TypeMap.append((array.array, arrayResolver)) |