Skip to content

CLN: De-privatize core.common funcs, remove unused #22001

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

Merged
merged 19 commits into from
Jul 24, 2018
Merged
Show file tree
Hide file tree
Changes from 15 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
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 @@ -119,7 +119,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 @@ -166,7 +166,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 @@ -399,7 +399,7 @@ def _add_comparison_methods(cls):
# 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 @@ -80,7 +80,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 @@ -151,7 +151,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