From aab3dea59e11f5c3bcfb86368a202ab17919fef4 Mon Sep 17 00:00:00 2001 From: tp Date: Sat, 25 May 2019 18:56:24 +0200 Subject: [PATCH] CLN: remove StringMixin from code base, except core.computation --- pandas/io/pytables.py | 19 +++++++++---------- pandas/io/stata.py | 3 +-- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/pandas/io/pytables.py b/pandas/io/pytables.py index 0f7f6fe399256..11f705e88179d 100644 --- a/pandas/io/pytables.py +++ b/pandas/io/pytables.py @@ -32,7 +32,6 @@ to_datetime) from pandas.core.arrays.categorical import Categorical from pandas.core.arrays.sparse import BlockIndex, IntIndex -from pandas.core.base import StringMixin import pandas.core.common as com from pandas.core.computation.pytables import Expr, maybe_expression from pandas.core.index import ensure_index @@ -398,7 +397,7 @@ def _is_metadata_of(group, parent_group): return False -class HDFStore(StringMixin): +class HDFStore: """ Dict-like IO interface for storing pandas objects in PyTables @@ -520,7 +519,7 @@ def __contains__(self, key): def __len__(self): return len(self.groups()) - def __str__(self): + def __repr__(self): return '{type}\nFile path: {path}\n'.format( type=type(self), path=pprint_thing(self._path)) @@ -1519,7 +1518,7 @@ def get_result(self, coordinates=False): return results -class IndexCol(StringMixin): +class IndexCol: """ an index column description class @@ -1587,7 +1586,7 @@ def set_table(self, table): self.table = table return self - def __str__(self): + def __repr__(self): temp = tuple( map(pprint_thing, (self.name, @@ -1881,7 +1880,7 @@ def __init__(self, values=None, kind=None, typ=None, self.set_data(data) self.set_metadata(metadata) - def __str__(self): + def __repr__(self): temp = tuple( map(pprint_thing, (self.name, @@ -2286,7 +2285,7 @@ def get_attr(self): pass -class Fixed(StringMixin): +class Fixed: """ represent an object in my store facilitate read/write of various types of objects @@ -2336,7 +2335,7 @@ def pandas_type(self): def format_type(self): return 'fixed' - def __str__(self): + def __repr__(self): """ return a pretty representation of myself """ self.infer_axes() s = self.shape @@ -3077,8 +3076,8 @@ def table_type_short(self): def format_type(self): return 'table' - def __str__(self): - """ return a pretty representatgion of myself """ + def __repr__(self): + """ return a pretty representation of myself """ self.infer_axes() dc = ",dc->[{columns}]".format(columns=(','.join( self.data_columns) if len(self.data_columns) else '')) diff --git a/pandas/io/stata.py b/pandas/io/stata.py index 27ddc4ef6f594..d8dfd15477974 100644 --- a/pandas/io/stata.py +++ b/pandas/io/stata.py @@ -31,7 +31,6 @@ from pandas import ( Categorical, DatetimeIndex, NaT, Timestamp, concat, isna, to_datetime, to_timedelta) -from pandas.core.base import StringMixin from pandas.core.frame import DataFrame from pandas.core.series import Series @@ -712,7 +711,7 @@ def generate_value_label(self, byteorder, encoding): return bio.read() -class StataMissingValue(StringMixin): +class StataMissingValue: """ An observation's missing value.