|
19 | 19 |
|
20 | 20 | from pandas.util.py3compat import StringIO, BytesIO
|
21 | 21 |
|
| 22 | +from pandas.core.config import get_option |
| 23 | + |
22 | 24 | # XXX: HACK for NumPy 1.5.1 to suppress warnings
|
23 | 25 | try:
|
24 | 26 | np.seterr(all='ignore')
|
@@ -1113,7 +1115,7 @@ def in_interactive_session():
|
1113 | 1115 | # 2) If you need to send something to the console, use console_encode().
|
1114 | 1116 | #
|
1115 | 1117 | # console_encode() should (hopefully) choose the right encoding for you
|
1116 |
| -# based on the encoding set in fmt.print_config.encoding. |
| 1118 | +# based on the encoding set in option "print_config.encoding" |
1117 | 1119 | #
|
1118 | 1120 | # 3) if you need to write something out to file, use
|
1119 | 1121 | # pprint_thing_encoded(encoding).
|
@@ -1165,16 +1167,17 @@ def pprint_thing(thing, _nest_lvl=0):
|
1165 | 1167 | result - unicode object on py2, str on py3. Always Unicode.
|
1166 | 1168 |
|
1167 | 1169 | """
|
1168 |
| - from pandas.core.format import print_config |
| 1170 | + |
1169 | 1171 | if thing is None:
|
1170 | 1172 | result = ''
|
1171 | 1173 | elif (py3compat.PY3 and hasattr(thing,'__next__')) or \
|
1172 | 1174 | hasattr(thing,'next'):
|
1173 | 1175 | return unicode(thing)
|
1174 | 1176 | elif (isinstance(thing, dict) and
|
1175 |
| - _nest_lvl < print_config.pprint_nest_depth): |
| 1177 | + _nest_lvl < get_option("print_config.pprint_nest_depth")): |
1176 | 1178 | result = _pprint_dict(thing, _nest_lvl)
|
1177 |
| - elif _is_sequence(thing) and _nest_lvl < print_config.pprint_nest_depth: |
| 1179 | + elif _is_sequence(thing) and _nest_lvl < \ |
| 1180 | + get_option("print_config.pprint_nest_depth"): |
1178 | 1181 | result = _pprint_seq(thing, _nest_lvl)
|
1179 | 1182 | else:
|
1180 | 1183 | # when used internally in the package, everything
|
@@ -1202,12 +1205,12 @@ def pprint_thing_encoded(object, encoding='utf-8', errors='replace'):
|
1202 | 1205 |
|
1203 | 1206 |
|
1204 | 1207 | def console_encode(object):
|
1205 |
| - from pandas.core.format import print_config |
1206 | 1208 | """
|
1207 | 1209 | this is the sanctioned way to prepare something for
|
1208 | 1210 | sending *to the console*, it delegates to pprint_thing() to get
|
1209 | 1211 | a unicode representation of the object relies on the global encoding
|
1210 | 1212 | set in print_config.encoding. Use this everywhere
|
1211 | 1213 | where you output to the console.
|
1212 | 1214 | """
|
1213 |
| - return pprint_thing_encoded(object, print_config.encoding) |
| 1215 | + return pprint_thing_encoded(object, |
| 1216 | + get_option("print_config.encoding")) |
0 commit comments