Skip to content
This repository was archived by the owner on Mar 13, 2026. It is now read-only.

fix: remove unnecessary global variable definition#907

Merged
Linchin merged 1 commit into
googleapis:mainfrom
Linchin:f824
Apr 3, 2025
Merged

fix: remove unnecessary global variable definition#907
Linchin merged 1 commit into
googleapis:mainfrom
Linchin:f824

Conversation

@Linchin

@Linchin Linchin commented Apr 2, 2025

Copy link
Copy Markdown
Contributor

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, GaoleMeng and sycai April 2, 2025 22:03

@sycai sycai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks!

@chalmerlowe chalmerlowe left a comment

Copy link
Copy Markdown
Contributor

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
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

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