Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLN:Remove unused **kwargs from user facing methods #23249

Merged
merged 7 commits into from
Nov 12, 2018

Conversation

kprestel
Copy link
Contributor

@kprestel kprestel commented Oct 20, 2018

closes GH18748 for user facing methods.

An updated extra_kwargs.txt mostly shows internal functions and false positives.

There are a few cases like all of the visit_* functions that removing the **kwargs breaks the API.

@pep8speaks
Copy link

pep8speaks commented Oct 20, 2018

Hello @kprestel! Thanks for updating the PR.

Comment last updated on November 11, 2018 at 16:41 Hours UTC

@codecov
Copy link

codecov bot commented Oct 20, 2018

Codecov Report

Merging #23249 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #23249   +/-   ##
=======================================
  Coverage   92.23%   92.23%           
=======================================
  Files         161      161           
  Lines       51288    51288           
=======================================
  Hits        47304    47304           
  Misses       3984     3984
Flag Coverage Δ
#multiple 90.62% <100%> (ø) ⬆️
#single 42.26% <100%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/io/pytables.py 92.34% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58a59bd...0a785d5. Read the comment docs.

@WillAyd WillAyd added the Clean label Oct 22, 2018
@WillAyd
Copy link
Member

WillAyd commented Oct 23, 2018

Quick glance at the CI failures seem related to the change. If you could take a look would be great, ping if you need help

pandas/core/groupby/groupby.py Outdated Show resolved Hide resolved
@kprestel
Copy link
Contributor Author

@WillAyd I think I fixed the tests (they all pass locally) but the change I had to make seems a bit counter to the essence of this issue.

It seems that the failures were mostly related to passing the kwarg errors added in regards to issue #20835, but naively I seems that it doesn't actually do anything. It just seems like its forcing **kwargs to be passed around to several functions but it only contains errors which from what I can tell doesn't do anything.

Its likely that I just don't know what I'm talking about and this is needed for something that I just don't know about, but I wanted to at least bring it up so someone with more knowledge of the code base can look a bit closer at it.

Thanks again for the review and the help!

@WillAyd
Copy link
Member

WillAyd commented Oct 28, 2018

Hmm OK. I personally wouldn't be opposed to making errors a named argument if it helps with the code readability - how many functions are we talking about?

pandas/core/groupby/groupby.py Outdated Show resolved Hide resolved
pandas/io/pytables.py Outdated Show resolved Hide resolved
@kprestel
Copy link
Contributor Author

@WillAyd It wasn't a ton of functions. Maybe 3-4?

@WillAyd
Copy link
Member

WillAyd commented Oct 29, 2018

I'm not against using an explicit named parameter instead of kwargs for the errors. That would also somewhat progress towards #20903 so if it is simple and helps code readability I say go for that

pandas/core/groupby/groupby.py Outdated Show resolved Hide resolved
pandas/core/groupby/groupby.py Outdated Show resolved Hide resolved
@jreback jreback added this to the 0.24.0 milestone Oct 30, 2018
@jreback
Copy link
Contributor

jreback commented Oct 30, 2018

does this competely close #18748 ?

@jreback
Copy link
Contributor

jreback commented Nov 3, 2018

can you merge master and update

@kprestel
Copy link
Contributor Author

kprestel commented Nov 3, 2018

@jreback Addressed your request for changes and yes this completely closes #18748. There are some internal functions as well as test functions that still have this issue but as you said in the issue, those aren't really an issue. I have run the script from the issue and the results are posted in this PR.

@WillAyd I don't actually think passing numeric_only warrants a separate issue. It seems to actually make it more consistent with the other functions in the module. cumprod and cumsum for example, already pass the **kwargs to the self._cython_transform function.

I can add a test if you want but I do believe that it is in the same of this issue I'm addressing so it belongs in this PR. I'm happy to change it (or add a whatsnew + tests) if you want but I don't think its necessarily warranted.

pandas/core/groupby/groupby.py Outdated Show resolved Hide resolved
@kprestel
Copy link
Contributor Author

@jreback I reverted that numeric_only change. I will open up a new issue and PR for that.

Thanks for the help.

@WillAyd WillAyd merged commit 8a7ecee into pandas-dev:master Nov 12, 2018
@WillAyd
Copy link
Member

WillAyd commented Nov 12, 2018

Thanks @kprestel !

@kprestel kprestel deleted the kwargs-clean-up branch November 12, 2018 14:24
thoo added a commit to thoo/pandas that referenced this pull request Nov 12, 2018
* upstream/master:
  BUG: Don't over-optimize memory with jagged CSV (pandas-dev#23527)
  DEPR: Deprecate usecols as int in read_excel (pandas-dev#23635)
  More helpful Stata string length error. (pandas-dev#23629)
  BUG: astype fill_value for SparseArray.astype (pandas-dev#23547)
  CLN: datetimelike arrays: isort, small reorg (pandas-dev#23587)
  CI: Check in the CI that assert_raises_regex is not being used (pandas-dev#23627)
  CLN:Remove unused **kwargs from user facing methods (pandas-dev#23249)
  DOC: Enhancing pivot / reshape docs (pandas-dev#21038)
  TST: Fix xfailing DataFrame arithmetic tests by transposing (pandas-dev#23620)
thoo added a commit to thoo/pandas that referenced this pull request Nov 12, 2018
…fixed

* upstream/master:
  DOC: avoid SparseArray.take error (pandas-dev#23637)
  CLN: remove incorrect usages of com.AbstractMethodError (pandas-dev#23625)
  DOC: Adding validation of the section order in docstrings (pandas-dev#23607)
  BUG: Don't over-optimize memory with jagged CSV (pandas-dev#23527)
  DEPR: Deprecate usecols as int in read_excel (pandas-dev#23635)
  More helpful Stata string length error. (pandas-dev#23629)
  BUG: astype fill_value for SparseArray.astype (pandas-dev#23547)
  CLN: datetimelike arrays: isort, small reorg (pandas-dev#23587)
  CI: Check in the CI that assert_raises_regex is not being used (pandas-dev#23627)
  CLN:Remove unused **kwargs from user facing methods (pandas-dev#23249)
JustinZhengBC pushed a commit to JustinZhengBC/pandas that referenced this pull request Nov 14, 2018
tm9k1 pushed a commit to tm9k1/pandas that referenced this pull request Nov 19, 2018
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Pingviinituutti pushed a commit to Pingviinituutti/pandas that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants