Skip to content

fix: remove unnecessary global variable definition #907

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

Merged
merged 1 commit into from
Apr 3, 2025

Conversation

Linchin
Copy link
Contributor

@Linchin Linchin commented Apr 2, 2025

A new rule in flake8 (F824) has caused our lint test to fail with the following error message, because we defined a global variable in some methods, but we didn't assign any value to them. In this case, you can access the global variable directly so it's unnecessary to define it.

nox > flake8 pandas_gbq tests
pandas_gbq/gbq.py:274:9: F824 `global context` is unused: name is never assigned in scope
pandas_gbq/gbq.py:872:5: F824 `global context` is unused: name is never assigned in scope
nox > Command flake8 pandas_gbq tests failed with exit code 1

Example log: https://github.com/googleapis/python-bigquery-pandas/actions/runs/14229816667/job/39877861461?pr=899

Note: We do change values of some fields to global context, but we do so by accessing its property, and context was not reassigned, so F824 still applies here.

@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: bigquery Issues related to the googleapis/python-bigquery-pandas API. labels Apr 2, 2025
@Linchin Linchin marked this pull request as ready for review April 2, 2025 22:03
@Linchin Linchin requested review from a team as code owners April 2, 2025 22:03
@Linchin Linchin requested review from GaoleMeng and sycai April 2, 2025 22:03
Copy link
Contributor

@sycai sycai left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Collaborator

@chalmerlowe chalmerlowe left a comment

Choose a reason for hiding this comment

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

LGTM

@Linchin Linchin added kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Apr 3, 2025
@Linchin Linchin enabled auto-merge (squash) April 3, 2025 18:36
@yoshi-kokoro yoshi-kokoro removed kokoro:run Add this label to force Kokoro to re-run the tests. kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Apr 3, 2025
@Linchin Linchin added the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 3, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Apr 3, 2025
@Linchin Linchin merged commit d4d85ce into googleapis:main Apr 3, 2025
20 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/python-bigquery-pandas API. size: xs Pull request size is extra small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants