Skip to content

Commit a7a6e70

Browse files
committed
Merge pull request #10643 from kawochen/CLN-10566
CLN: Remove duplicate implementations of bind_method; typo in compat
2 parents 384eb45 + df249e8 commit a7a6e70

File tree

3 files changed

+3
-26
lines changed

3 files changed

+3
-26
lines changed

pandas/compat/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* Uses the original method if available, otherwise uses items, keys, values.
1515
* types:
1616
* text_type: unicode in Python 2, str in Python 3
17-
* binary_type: str in Python 2, bythes in Python 3
17+
* binary_type: str in Python 2, bytes in Python 3
1818
* string_types: basestring in Python 2, str in Python 3
1919
* bind_method: binds functions to classes
2020
* add_metaclass(metaclass) - class decorator that recreates class with with the

pandas/core/common.py

-24
Original file line numberDiff line numberDiff line change
@@ -113,30 +113,6 @@ def __instancecheck__(cls, inst):
113113
ABCGeneric = _ABCGeneric("ABCGeneric", tuple(), {})
114114

115115

116-
def bind_method(cls, name, func):
117-
"""Bind a method to class, python 2 and python 3 compatible.
118-
119-
Parameters
120-
----------
121-
122-
cls : type
123-
class to receive bound method
124-
name : basestring
125-
name of method on class instance
126-
func : function
127-
function to be bound as method
128-
129-
130-
Returns
131-
-------
132-
None
133-
"""
134-
# only python 2 has bound/unbound method issue
135-
if not compat.PY3:
136-
setattr(cls, name, types.MethodType(func, None, cls))
137-
else:
138-
setattr(cls, name, func)
139-
140116
class CategoricalDtypeType(type):
141117
"""
142118
the type of CategoricalDtype, this metaclass determines subclass ability

pandas/core/ops.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
import pandas.computation.expressions as expressions
1616
from pandas.lib import isscalar
1717
from pandas.tslib import iNaT
18-
from pandas.core.common import(bind_method, is_list_like, notnull, isnull,
18+
from pandas.compat import bind_method
19+
from pandas.core.common import(is_list_like, notnull, isnull,
1920
_values_from_object, _maybe_match_name,
2021
needs_i8_conversion, is_datetimelike_v_numeric,
2122
is_integer_dtype, is_categorical_dtype, is_object_dtype,

0 commit comments

Comments
 (0)