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, STYLE: remove unused variables and imports in Cython files #48290

Merged
merged 5 commits into from
Sep 7, 2022

Conversation

MarcoGorelli
Copy link
Member

  • closes #xxxx (Replace xxxx with the Github issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.

Tried putting together a little Cython linter, here's the unused variables/imports it finds. More to come, but this already cleans up quite a few things

@MarcoGorelli MarcoGorelli changed the title CLN, STYLE: remove unused variables and imports CLN, STYLE: remove unused variables and imports in Cython files Aug 28, 2022
@MarcoGorelli MarcoGorelli added Clean Code Style Code style, linting, code_checks labels Aug 28, 2022
@MarcoGorelli MarcoGorelli marked this pull request as draft August 29, 2022 18:02
@MarcoGorelli MarcoGorelli marked this pull request as ready for review August 29, 2022 20:44
@@ -26,6 +26,10 @@ repos:
hooks:
- id: codespell
types_or: [python, rst, markdown]
- repo: https://github.com/MarcoGorelli/cython-lint
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just glancing at this, im stoked at the concept!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this have/need eyeballs?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would certainly help if you're interested, thanks!

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm - very nice work

@mroeschke mroeschke added this to the 1.6 milestone Sep 7, 2022
@mroeschke mroeschke merged commit 6dc589b into pandas-dev:main Sep 7, 2022
@mroeschke
Copy link
Member

Great cleanup @MarcoGorelli!

@WillAyd
Copy link
Member

WillAyd commented Sep 7, 2022

It would be interesting to know why a lot of these unused variables don't get picked up via build warnings

@MarcoGorelli
Copy link
Member Author

I think the build warnings just pick up unreachable code

@WillAyd
Copy link
Member

WillAyd commented Sep 7, 2022

Gcc/llvm should warn for unused variables with the flags we have (-Wunused-variable us part of -Wall). My guess is Cython is generating code that still "uses" these variables and prevents that from happening. Likely hard to fix but in an ideal would that wouldn't happen in the first place

@mroeschke mroeschke modified the milestones: 1.6, 2.0 Oct 13, 2022
noatamir pushed a commit to noatamir/pandas that referenced this pull request Nov 9, 2022
…as-dev#48290)

* remove unused variables and imports

* wip

* bump to 0.1.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Code Style Code style, linting, code_checks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants