Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 9 additions & 14 deletions pandas/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@
import re
import warnings

import pandas.compat as compat
from pandas.compat import lmap, map, u

DeprecatedOption = namedtuple('DeprecatedOption', 'key msg rkey removal_ver')
RegisteredOption = namedtuple('RegisteredOption',
'key defval doc validator cb')
Expand Down Expand Up @@ -140,7 +137,7 @@ def _describe_option(pat='', _print_desc=True):
if len(keys) == 0:
raise OptionError('No such keys(s)')

s = u('')
s = ''
for k in keys: # filter by pat
s += _build_option_description(k)

Expand Down Expand Up @@ -634,22 +631,22 @@ def _build_option_description(k):
o = _get_registered_option(k)
d = _get_deprecated_option(k)

s = u('{k} ').format(k=k)
s = '{k} '.format(k=k)

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

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

if d:
s += u('\n (Deprecated')
s += (u(', use `{rkey}` instead.')
s += '\n (Deprecated'
s += (', use `{rkey}` instead.'
.format(rkey=d.rkey if d.rkey else ''))
s += u(')')
s += ')'

return s

Expand Down Expand Up @@ -776,8 +773,7 @@ def is_instance_factory(_type):
"""
if isinstance(_type, (tuple, list)):
_type = tuple(_type)
from pandas.io.formats.printing import pprint_thing
type_repr = "|".join(map(pprint_thing, _type))
type_repr = "|".join(map(str, _type))
else:
type_repr = "'{typ}'".format(typ=_type)

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

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

if not any(c(x) for c in callables):
pp_values = pp("|".join(lmap(pp, legal_values)))
uvals = [str(lval) for lval in legal_values]
pp_values = "|".join(uvals)
msg = "Value must be one of {pp_values}"
if len(callables):
msg += " or a callable"
Expand All @@ -814,7 +810,6 @@ def inner(x):
is_bool = is_type_factory(bool)
is_float = is_type_factory(float)
is_str = is_type_factory(str)
is_unicode = is_type_factory(compat.text_type)
is_text = is_instance_factory((str, bytes))


Expand Down