From 139cc84ad52611ec01fc8e3704e5804b97aa9296 Mon Sep 17 00:00:00 2001 From: Jeremy Schendel Date: Fri, 1 Feb 2019 09:16:02 -0700 Subject: [PATCH 1/2] CLN: Remove sentinel_factory() in favor of object() --- pandas/core/common.py | 7 ------- pandas/io/formats/html.py | 4 ++-- pandas/io/formats/style.py | 2 +- 3 files changed, 3 insertions(+), 10 deletions(-) diff --git a/pandas/core/common.py b/pandas/core/common.py index b4de0daa13b16..082e43c2e7cfb 100644 --- a/pandas/core/common.py +++ b/pandas/core/common.py @@ -383,13 +383,6 @@ def standardize_mapping(into): return into -def sentinel_factory(): - class Sentinel(object): - pass - - return Sentinel() - - def random_state(state=None): """ Helper function for processing random_state arguments. diff --git a/pandas/io/formats/html.py b/pandas/io/formats/html.py index f41749e0a7745..f5993f37897c4 100644 --- a/pandas/io/formats/html.py +++ b/pandas/io/formats/html.py @@ -190,7 +190,7 @@ def _write_col_header(self, indent): if self.fmt.sparsify: # GH3547 - sentinel = com.sentinel_factory() + sentinel = object() else: sentinel = False levels = self.columns.format(sparsify=sentinel, adjoin=False, @@ -386,7 +386,7 @@ def _write_hierarchical_rows(self, fmt_values, indent): if self.fmt.sparsify: # GH3547 - sentinel = com.sentinel_factory() + sentinel = object() levels = frame.index.format(sparsify=sentinel, adjoin=False, names=False) diff --git a/pandas/io/formats/style.py b/pandas/io/formats/style.py index 598453eb92d25..61862ee0028d3 100644 --- a/pandas/io/formats/style.py +++ b/pandas/io/formats/style.py @@ -1322,7 +1322,7 @@ def _get_level_lengths(index, hidden_elements=None): Result is a dictionary of (level, inital_position): span """ - sentinel = com.sentinel_factory() + sentinel = object() levels = index.format(sparsify=sentinel, adjoin=False, names=False) if hidden_elements is None: From 6cb976ea0c9dc05ded564aa6ef390cc05fbbe622 Mon Sep 17 00:00:00 2001 From: Jeremy Schendel Date: Fri, 1 Feb 2019 17:25:49 -0700 Subject: [PATCH 2/2] lint --- pandas/io/formats/html.py | 1 - 1 file changed, 1 deletion(-) diff --git a/pandas/io/formats/html.py b/pandas/io/formats/html.py index f5993f37897c4..2d8b40016c9af 100644 --- a/pandas/io/formats/html.py +++ b/pandas/io/formats/html.py @@ -12,7 +12,6 @@ from pandas.core.dtypes.generic import ABCMultiIndex from pandas import compat -import pandas.core.common as com from pandas.core.config import get_option from pandas.io.common import _is_url