From 561991040795650114ab1d75e41cb24cc6dd87fd Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Thu, 19 Jul 2018 15:25:28 -0700 Subject: [PATCH 1/2] CLN: Unreachable code, Boolean comparison, duplicate functions --- asv_bench/benchmarks/groupby.py | 2 +- doc/sphinxext/numpydoc/docscrape_sphinx.py | 4 ---- pandas/_libs/internals.pyx | 2 +- pandas/core/indexes/period.py | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/asv_bench/benchmarks/groupby.py b/asv_bench/benchmarks/groupby.py index 0725bbeb6c36d..b51b41614bc49 100644 --- a/asv_bench/benchmarks/groupby.py +++ b/asv_bench/benchmarks/groupby.py @@ -142,7 +142,7 @@ def time_frame_nth(self, dtype): def time_series_nth_any(self, dtype): self.df['values'].groupby(self.df['key']).nth(0, dropna='any') - def time_groupby_nth_all(self, dtype): + def time_series_nth_all(self, dtype): self.df['values'].groupby(self.df['key']).nth(0, dropna='all') def time_series_nth(self, dtype): diff --git a/doc/sphinxext/numpydoc/docscrape_sphinx.py b/doc/sphinxext/numpydoc/docscrape_sphinx.py index 19c355eba1898..8b3932bcdd4ec 100644 --- a/doc/sphinxext/numpydoc/docscrape_sphinx.py +++ b/doc/sphinxext/numpydoc/docscrape_sphinx.py @@ -56,10 +56,6 @@ def _str_indent(self, doc, indent=4): def _str_signature(self): return [''] - if self['Signature']: - return ['``%s``' % self['Signature']] + [''] - else: - return [''] def _str_summary(self): return self['Summary'] + [''] diff --git a/pandas/_libs/internals.pyx b/pandas/_libs/internals.pyx index 2179999859dbb..68698f45d5623 100644 --- a/pandas/_libs/internals.pyx +++ b/pandas/_libs/internals.pyx @@ -390,7 +390,7 @@ def get_blkno_indexers(int64_t[:] blknos, bint group=True): start = 0 cur_blkno = blknos[start] - if group == False: + if group is False: for i in range(1, n): if blknos[i] != cur_blkno: yield cur_blkno, slice(start, i) diff --git a/pandas/core/indexes/period.py b/pandas/core/indexes/period.py index 4d8e57820f29d..c5cb507e729f1 100644 --- a/pandas/core/indexes/period.py +++ b/pandas/core/indexes/period.py @@ -315,7 +315,6 @@ def __contains__(self, key): return True except Exception: return False - return False contains = __contains__ From 1a5a48638e16942ce330607028867f2c6b937cb5 Mon Sep 17 00:00:00 2001 From: Matt Roeschke Date: Fri, 20 Jul 2018 10:09:23 -0700 Subject: [PATCH 2/2] Undo sphinxtext change --- doc/sphinxext/numpydoc/docscrape_sphinx.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/sphinxext/numpydoc/docscrape_sphinx.py b/doc/sphinxext/numpydoc/docscrape_sphinx.py index 8b3932bcdd4ec..19c355eba1898 100644 --- a/doc/sphinxext/numpydoc/docscrape_sphinx.py +++ b/doc/sphinxext/numpydoc/docscrape_sphinx.py @@ -56,6 +56,10 @@ def _str_indent(self, doc, indent=4): def _str_signature(self): return [''] + if self['Signature']: + return ['``%s``' % self['Signature']] + [''] + else: + return [''] def _str_summary(self): return self['Summary'] + ['']