Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger committed Nov 12, 2018
1 parent ebadf6f commit e5f6976
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pandas/core/arrays/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import operator

from pandas.core.base import StringMixin
from pandas.core.dtypes.generic import ABCSeries, ABCIndexClass
from pandas.errors import AbstractMethodError
from pandas.compat.numpy import function as nv
Expand All @@ -20,7 +19,7 @@
_not_implemented_message = "{} does not implement {}."


class ExtensionArray(StringMixin):
class ExtensionArray(object):
"""Abstract base class for custom 1-D array types.
pandas will recognize instances of this class as proper arrays
Expand Down Expand Up @@ -50,7 +49,7 @@ class ExtensionArray(StringMixin):
by overriding:
* _formatter
* __unicode__
* __repr__
Some methods require casting the ExtensionArray to an ndarray of Python
objects with ``self.astype(object)``, which may be expensive. When
Expand Down Expand Up @@ -658,7 +657,7 @@ def copy(self, deep=False):
# ------------------------------------------------------------------------
# Printing
# ------------------------------------------------------------------------
def __unicode__(self):
def __repr__(self):
from pandas.io.formats.printing import format_object_summary

template = (
Expand Down Expand Up @@ -686,18 +685,22 @@ def _formatter(self, formatter=None):
Parameters
----------
formatter: GenericArrayFormatter, optional
The formatter this array is being rendered with. The formatter
may have a `.formatter` method already defined. By default, this
will be used if a `formatter` is passed, otherwise the formatter
is ``str``.
The formatter this array is being rendered with. This will be
passed when the ExtensionArray is being rendered inside of a
Series, Index, or DataFrame. This will be ``None`` when called
from a top-level ``repr(array)``.
By default, when ``formatter`` is passed, the return value
is ``formatter.formatter``. Otherwise, the default formatter
is ``repr``.
Returns
-------
Callable[[Any], str]
A callable that gets instances of the scalar type and
returns a string.
"""
return getattr(formatter, 'formatter', None) or str
return getattr(formatter, 'formatter', None) or repr

def _formatting_values(self):
# type: () -> np.ndarray
Expand Down

0 comments on commit e5f6976

Please sign in to comment.