-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
make core.config self-contained #25613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
b0080f1
41ac323
0b2b751
f11168a
edb758d
600da0b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,8 +53,10 @@ | |
import re | ||
import warnings | ||
|
||
import pandas.compat as compat | ||
from pandas.compat import lmap, map, u | ||
try: | ||
unicode | ||
except NameError: | ||
unicode = str | ||
|
||
DeprecatedOption = namedtuple('DeprecatedOption', 'key msg rkey removal_ver') | ||
RegisteredOption = namedtuple('RegisteredOption', | ||
|
@@ -140,7 +142,7 @@ def _describe_option(pat='', _print_desc=True): | |
if len(keys) == 0: | ||
raise OptionError('No such keys(s)') | ||
|
||
s = u('') | ||
s = u'' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can get rid of the u prefix now, no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are we "full speed ahead" on ripping out py2? If not, let's hold off. I'd like to get this and #25757 merged since there are nice follow-ups. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, you can remove PY2 things There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, just pushed. |
||
for k in keys: # filter by pat | ||
s += _build_option_description(k) | ||
|
||
|
@@ -634,22 +636,22 @@ def _build_option_description(k): | |
o = _get_registered_option(k) | ||
d = _get_deprecated_option(k) | ||
|
||
s = u('{k} ').format(k=k) | ||
s = u'{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 += (u'\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 += u'\n (Deprecated' | ||
s += (u', use `{rkey}` instead.' | ||
.format(rkey=d.rkey if d.rkey else '')) | ||
s += u(')') | ||
s += u')' | ||
|
||
s += '\n\n' | ||
return s | ||
|
@@ -777,8 +779,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) | ||
|
||
|
@@ -796,11 +797,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" | ||
|
@@ -815,7 +816,7 @@ 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_unicode = is_type_factory(unicode) | ||
is_text = is_instance_factory((str, bytes)) | ||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming this is targeted for 0.25 do we even need to bother with this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figure until we actually start ripping out compat code (any day now I hope) its easier to leave this in and keep the ball rolling on these
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could just wait until
0.24.2
comes out before merging this.