leeyspaul commented on PR #65704:
URL: https://github.com/apache/airflow/pull/65704#issuecomment-4364415176
The CI failure started after this PR added `mask_secret()` calls to the
`GetConnection` and `GetVariable` branches of `_handle_request()`.
That function already had an older function-local import in the later
`MaskSecret` branch:
from airflow.sdk.log import mask_secret
In Python, an import inside a function is a local assignment for the entire
function scope. Because of that later import, Python treated all `mask_secret`
references in `_handle_request()` as local variables, including the new calls
that appear before the import. Those earlier calls then failed with
`UnboundLocalError`, and Ruff reported the same issue as `F823`.
I fixed it by removing the nested import and use the existing module-level
`mask_secret` import consistently. I'm unsure why it passed first, but then
later failed on merges. Something I will look into.
Sorry, this PR is now ready to merge. @o-nikolas @vincbeck @ferruzzi
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]