-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: Removing Python 3.6 or higher references that are always true #29492
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 2 commits
7ce9c79
fcb1297
3aaa37e
473ea21
2f0501f
47949ac
a62e8b0
cac049b
ef1940c
acf18fc
555626f
7011793
85ee6ac
2a175f3
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 |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
|
||
from pandas._libs import algos, lib | ||
from pandas._libs.tslibs import conversion | ||
from pandas.compat import PY36 | ||
|
||
from pandas.core.dtypes.dtypes import ( | ||
CategoricalDtype, | ||
|
@@ -1278,11 +1277,7 @@ def _is_unorderable_exception(e: TypeError) -> bool: | |
boolean | ||
Whether or not the exception raised is an unorderable exception. | ||
""" | ||
|
||
if PY36: | ||
return "'>' not supported between instances of" in str(e) | ||
|
||
return "unorderable" in str(e) | ||
return "'>' not supported between instances of" in str(e) | ||
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. and update docstring here |
||
|
||
|
||
def is_numeric_v_string_like(a, b): | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -192,10 +192,7 @@ class NDFrame(PandasObject, SelectionMixin): | |
_data = None # type: BlockManager | ||
|
||
if TYPE_CHECKING: | ||
# TODO(PY36): replace with _attrs : Dict[Hashable, Any] | ||
# We need the TYPE_CHECKING, because _attrs is not a class attribute | ||
# and Py35 doesn't support the new syntax. | ||
_attrs = {} # type: Dict[Optional[Hashable], Any] | ||
_attrs = {} # type: Dict[Hashable, Any] | ||
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. I don't think the optional should be removed. This looks like an inconsistency between the code and the TODO. 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. and the intent was to remove the TYPE_CHECKING block and use py3.6 syntax for the variable annotation |
||
|
||
# ---------------------------------------------------------------------- | ||
# Constructors | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,6 @@ | |
import numpy.ma as ma | ||
|
||
from pandas._libs import lib | ||
import pandas.compat as compat | ||
from pandas.compat import PY36 | ||
|
||
from pandas.core.dtypes.cast import ( | ||
construct_1d_arraylike_from_scalar, | ||
|
@@ -331,16 +329,13 @@ def extract_index(data): | |
have_raw_arrays = False | ||
have_series = False | ||
have_dicts = False | ||
have_ordered = False | ||
|
||
for val in data: | ||
if isinstance(val, ABCSeries): | ||
have_series = True | ||
indexes.append(val.index) | ||
elif isinstance(val, dict): | ||
have_dicts = True | ||
if isinstance(val, OrderedDict): | ||
have_ordered = True | ||
indexes.append(list(val.keys())) | ||
elif is_list_like(val) and getattr(val, "ndim", 1) == 1: | ||
have_raw_arrays = True | ||
|
@@ -352,7 +347,7 @@ def extract_index(data): | |
if have_series: | ||
index = _union_indexes(indexes) | ||
elif have_dicts: | ||
index = _union_indexes(indexes, sort=not (compat.PY36 or have_ordered)) | ||
index = _union_indexes(indexes, sort=False) | ||
|
||
if have_raw_arrays: | ||
lengths = list(set(raw_lengths)) | ||
|
@@ -550,7 +545,7 @@ def _list_of_dict_to_arrays(data, columns, coerce_float=False, dtype=None): | |
""" | ||
if columns is None: | ||
gen = (list(x.keys()) for x in data) | ||
types = (dict, OrderedDict) if PY36 else OrderedDict | ||
types = (dict, OrderedDict) | ||
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. maybe update docstring and inline types 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. I think its also worth inlining types now that types is a less complex expression and only used once. |
||
sort = not any(isinstance(d, types) for d in data) | ||
columns = lib.fast_unique_multiple_list_gen(gen, sort=sort) | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.