Skip to content

CLN:Unused Variables #21974

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

Closed
wants to merge 1 commit into from
Closed

Conversation

mroeschke
Copy link
Member

  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

Used PyCharm inspections to check:

  • Unused local variables
  • Unreachable code
  • set([..]) to {...}

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

there are some very aggressive changes here

@@ -390,7 +390,7 @@ def get_blkno_indexers(int64_t[:] blknos, bint group=True):
start = 0
cur_blkno = blknos[start]

if group == False:
if not group:
Copy link
Member

Choose a reason for hiding this comment

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

Group is false

@@ -15,9 +15,6 @@ def load_reduce(self):
args = stack.pop()
func = stack[-1]

if len(args) and type(args[0]) is type:
n = args[0].__name__ # noqa
Copy link
Member

Choose a reason for hiding this comment

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

Do we know what this is for? “Noqa” suggests author knewflake would complain

@@ -1022,9 +1022,6 @@ def rename(self, *args, **kwargs):
copy = kwargs.pop('copy', True)
inplace = kwargs.pop('inplace', False)
level = kwargs.pop('level', None)
axis = kwargs.pop('axis', None)
Copy link
Member

Choose a reason for hiding this comment

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

I think part of the point of this is to empty out the kwargs dict, no?

@@ -845,7 +845,6 @@ def _sqlalchemy_type(self, col):

if col_type == 'datetime64' or col_type == 'datetime':
try:
tz = col.tzinfo # noqa
Copy link
Member

Choose a reason for hiding this comment

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

I’d assume this is a roundabout way to check for a tzinfo attribute?

@jbrockmendel
Copy link
Member

I thought flake8 checked for unused variables, unreachable code. Are we using an old version or something?

The set comprehensions are a good fix. Might be worth adding that flake8 plugin while you’re at it.

@mroeschke
Copy link
Member Author

I'm not sure if PyCharm is using flake8 under the hood or they have their own introspection method, but it was catching some things that flake8 wasn't.

Nonetheless, I'll scale this back and break it into smaller PR's

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.

3 participants