From 45b54097af737321059ff3974681ca8e2dbfc318 Mon Sep 17 00:00:00 2001 From: ihsan Date: Mon, 29 Apr 2019 20:06:56 +0300 Subject: [PATCH 1/2] CLN: Remove unnecessary io function returns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These functions return a function either with empty return statement or doesn’t return. It causes docstring validation error with type RT01 (See #26234). --- pandas/core/frame.py | 13 ++++++------- pandas/core/generic.py | 5 ++--- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index e539391ba011e..ee2a700de6c62 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1394,13 +1394,12 @@ def to_gbq(self, destination_table, project_id=None, chunksize=None, read_gbq : Read a DataFrame from Google BigQuery. """ from pandas.io import gbq - return gbq.to_gbq( - self, destination_table, project_id=project_id, - chunksize=chunksize, reauth=reauth, if_exists=if_exists, - auth_local_webserver=auth_local_webserver, - table_schema=table_schema, location=location, - progress_bar=progress_bar, credentials=credentials, - verbose=verbose, private_key=private_key) + gbq.to_gbq(self, destination_table, project_id=project_id, + chunksize=chunksize, reauth=reauth, if_exists=if_exists, + auth_local_webserver=auth_local_webserver, + table_schema=table_schema, location=location, + progress_bar=progress_bar, credentials=credentials, + verbose=verbose, private_key=private_key) @classmethod def from_records(cls, data, index=None, exclude=None, columns=None, diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 0f92ea800c3e7..0f44d9ba60ec7 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2403,7 +2403,7 @@ def to_hdf(self, path_or_buf, key, **kwargs): >>> os.remove('data.h5') """ from pandas.io import pytables - return pytables.to_hdf(path_or_buf, key, self, **kwargs) + pytables.to_hdf(path_or_buf, key, self, **kwargs) def to_msgpack(self, path_or_buf=None, encoding='utf-8', **kwargs): """ @@ -2615,8 +2615,7 @@ def to_pickle(self, path, compression='infer', >>> os.remove("./dummy.pkl") """ from pandas.io.pickle import to_pickle - return to_pickle(self, path, compression=compression, - protocol=protocol) + to_pickle(self, path, compression=compression, protocol=protocol) def to_clipboard(self, excel=True, sep=None, **kwargs): r""" From bf4438bdd4a46695442716b6a14f8936876ab3a6 Mon Sep 17 00:00:00 2001 From: ihsan Date: Mon, 29 Apr 2019 22:57:48 +0300 Subject: [PATCH 2/2] CLN: Remove to_gbq return in pandas/io/gbq (#26238) --- pandas/io/gbq.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/io/gbq.py b/pandas/io/gbq.py index 871bc4a8221c2..3a6d538b5e616 100644 --- a/pandas/io/gbq.py +++ b/pandas/io/gbq.py @@ -172,9 +172,9 @@ def to_gbq(dataframe, destination_table, project_id=None, chunksize=None, table_schema=None, location=None, progress_bar=True, credentials=None, verbose=None, private_key=None): pandas_gbq = _try_import() - return pandas_gbq.to_gbq( - dataframe, destination_table, project_id=project_id, - chunksize=chunksize, reauth=reauth, if_exists=if_exists, - auth_local_webserver=auth_local_webserver, table_schema=table_schema, - location=location, progress_bar=progress_bar, - credentials=credentials, verbose=verbose, private_key=private_key) + pandas_gbq.to_gbq(dataframe, destination_table, project_id=project_id, + chunksize=chunksize, reauth=reauth, if_exists=if_exists, + auth_local_webserver=auth_local_webserver, + table_schema=table_schema, location=location, + progress_bar=progress_bar, credentials=credentials, + verbose=verbose, private_key=private_key)