Skip to content

Commit

Permalink
CLN: De-privatize core.common funcs, remove unused (pandas-dev#22001)
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel authored and victor committed Sep 30, 2018
1 parent d9b48b0 commit cdecb73
Show file tree
Hide file tree
Showing 50 changed files with 271 additions and 477 deletions.
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ Removal of prior version deprecations/changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- The ``LongPanel`` and ``WidePanel`` classes have been removed (:issue:`10892`)
-
- Several private functions were removed from the (non-public) module ``pandas.core.common`` (:issue:`22001`)
-
-

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def match(to_match, values, na_sentinel=-1):
-------
match : ndarray of integers
"""
values = com._asarray_tuplesafe(values)
values = com.asarray_tuplesafe(values)
htable, _, values, dtype, ndtype = _get_hashtable_algo(values)
to_match, _, _ = _ensure_data(to_match, dtype)
table = htable(min(len(to_match), 1000000))
Expand Down Expand Up @@ -412,7 +412,7 @@ def isin(comps, values):
# handle categoricals
return comps._values.isin(values)

comps = com._values_from_object(comps)
comps = com.values_from_object(comps)

comps, dtype, _ = _ensure_data(comps)
values, _, _ = _ensure_data(values, dtype=dtype)
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/arrays/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

import pandas.core.algorithms as algorithms

from pandas.io.formats import console
from pandas.io.formats.terminal import get_terminal_size
from pandas.util._validators import validate_bool_kwarg, validate_fillna_kwargs
from pandas.core.config import get_option
Expand Down Expand Up @@ -1887,7 +1888,7 @@ def _repr_categories_info(self):
length=len(self.categories), dtype=dtype)
width, height = get_terminal_size()
max_width = get_option("display.width") or width
if com.in_ipython_frontend():
if console.in_ipython_frontend():
# 0 = no breaks
max_width = 0
levstring = ""
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def wrapper(self, other):
self._assert_tzawareness_compat(other)

result = meth(self, np.asarray(other))
result = com._values_from_object(result)
result = com.values_from_object(result)

# Make sure to pass an array to result[...]; indexing with
# Series breaks with older version of numpy
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,7 @@ def __array__(self, dtype=None):
examples='',
))
def to_tuples(self, na_tuple=True):
tuples = com._asarray_tuplesafe(zip(self.left, self.right))
tuples = com.asarray_tuplesafe(zip(self.left, self.right))
if not na_tuple:
# GH 18756
tuples = np.where(~self.isna(), tuples, np.nan)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def _generate_range(cls, start, end, periods, freq, fields):
freq = Period._maybe_convert_freq(freq)

field_count = len(fields)
if com._count_not_none(start, end) > 0:
if com.count_not_none(start, end) > 0:
if field_count > 0:
raise ValueError('Can either instantiate from fields '
'or endpoints, but not both')
Expand Down Expand Up @@ -392,7 +392,7 @@ def _maybe_convert_timedelta(self, other):
# Constructor Helpers

def _get_ordinal_range(start, end, periods, freq, mult=1):
if com._count_not_none(start, end, periods) != 2:
if com.count_not_none(start, end, periods) != 2:
raise ValueError('Of the three parameters: start, end, and periods, '
'exactly two must be specified')

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/timedeltas.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def wrapper(self, other):
else:
other = type(self)(other).values
result = meth(self, other)
result = com._values_from_object(result)
result = com.values_from_object(result)

o_mask = np.array(isna(other))
if o_mask.any():
Expand Down Expand Up @@ -150,7 +150,7 @@ def __new__(cls, values, freq=None, start=None, end=None, periods=None,
@classmethod
def _generate_range(cls, start, end, periods, freq, closed=None, **kwargs):
# **kwargs are for compat with TimedeltaIndex, which includes `name`
if com._count_not_none(start, end, periods, freq) != 3:
if com.count_not_none(start, end, periods, freq) != 3:
raise ValueError('Of the four parameters: start, end, periods, '
'and freq, exactly three must be specified')

Expand Down
4 changes: 2 additions & 2 deletions pandas/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def _aggregate_multiple_funcs(self, arg, _level, _axis):
results.append(colg.aggregate(a))

# make sure we find a good name
name = com._get_callable_name(a) or a
name = com.get_callable_name(a) or a
keys.append(name)
except (TypeError, DataError):
pass
Expand Down Expand Up @@ -856,7 +856,7 @@ def tolist(self):
numpy.ndarray.tolist
"""
if is_datetimelike(self._values):
return [com._maybe_box_datetimelike(x) for x in self._values]
return [com.maybe_box_datetimelike(x) for x in self._values]
elif is_extension_array_dtype(self._values):
return list(self._values)
else:
Expand Down
Loading

0 comments on commit cdecb73

Please sign in to comment.