Skip to content

Commit 15a6534

Browse files
jbrockmendeljreback
authored andcommitted
make core.config self-contained (#25613)
1 parent 8e54e55 commit 15a6534

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

pandas/core/config.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,6 @@
5353
import re
5454
import warnings
5555

56-
import pandas.compat as compat
57-
from pandas.compat import lmap, map, u
58-
5956
DeprecatedOption = namedtuple('DeprecatedOption', 'key msg rkey removal_ver')
6057
RegisteredOption = namedtuple('RegisteredOption',
6158
'key defval doc validator cb')
@@ -140,7 +137,7 @@ def _describe_option(pat='', _print_desc=True):
140137
if len(keys) == 0:
141138
raise OptionError('No such keys(s)')
142139

143-
s = u('')
140+
s = ''
144141
for k in keys: # filter by pat
145142
s += _build_option_description(k)
146143

@@ -634,22 +631,22 @@ def _build_option_description(k):
634631
o = _get_registered_option(k)
635632
d = _get_deprecated_option(k)
636633

637-
s = u('{k} ').format(k=k)
634+
s = '{k} '.format(k=k)
638635

639636
if o.doc:
640637
s += '\n'.join(o.doc.strip().split('\n'))
641638
else:
642639
s += 'No description available.'
643640

644641
if o:
645-
s += (u('\n [default: {default}] [currently: {current}]')
642+
s += ('\n [default: {default}] [currently: {current}]'
646643
.format(default=o.defval, current=_get_option(k, True)))
647644

648645
if d:
649-
s += u('\n (Deprecated')
650-
s += (u(', use `{rkey}` instead.')
646+
s += '\n (Deprecated'
647+
s += (', use `{rkey}` instead.'
651648
.format(rkey=d.rkey if d.rkey else ''))
652-
s += u(')')
649+
s += ')'
653650

654651
return s
655652

@@ -776,8 +773,7 @@ def is_instance_factory(_type):
776773
"""
777774
if isinstance(_type, (tuple, list)):
778775
_type = tuple(_type)
779-
from pandas.io.formats.printing import pprint_thing
780-
type_repr = "|".join(map(pprint_thing, _type))
776+
type_repr = "|".join(map(str, _type))
781777
else:
782778
type_repr = "'{typ}'".format(typ=_type)
783779

@@ -795,11 +791,11 @@ def is_one_of_factory(legal_values):
795791
legal_values = [c for c in legal_values if not callable(c)]
796792

797793
def inner(x):
798-
from pandas.io.formats.printing import pprint_thing as pp
799794
if x not in legal_values:
800795

801796
if not any(c(x) for c in callables):
802-
pp_values = pp("|".join(lmap(pp, legal_values)))
797+
uvals = [str(lval) for lval in legal_values]
798+
pp_values = "|".join(uvals)
803799
msg = "Value must be one of {pp_values}"
804800
if len(callables):
805801
msg += " or a callable"
@@ -814,7 +810,6 @@ def inner(x):
814810
is_bool = is_type_factory(bool)
815811
is_float = is_type_factory(float)
816812
is_str = is_type_factory(str)
817-
is_unicode = is_type_factory(compat.text_type)
818813
is_text = is_instance_factory((str, bytes))
819814

820815

0 commit comments

Comments
 (0)