airflow
airflow copied to clipboard
Fix invalid escape sequence in EKS Hook module
Body
Right now import airflow/providers/amazon/aws/hooks/eks.py raise DeprecationWarning / SyntaxWarning (depends on python version)
{
"category":"DeprecationWarning",
"message":"invalid escape sequence \\s",
"filename":"airflow/providers/amazon/aws/hooks/eks.py",
"lineno":79,
"when":"collect",
"node_id":null
}
We should avoid to use something that deprecated in Python itself years ago in Python 3.6.
https://github.com/apache/airflow/blob/b7ac00d12dd81ae25507c53712f7bd8b6dfca981/airflow/providers/amazon/aws/hooks/eks.py#L80-L81
https://github.com/apache/airflow/blob/b7ac00d12dd81ae25507c53712f7bd8b6dfca981/airflow/providers/amazon/aws/hooks/eks.py#L91-L93
\ in the end of the line make sense only in regular strings, not in triple quoted, however right now it work as intended - remove new line in the end of the line
[!NOTE] This rule right now ignored in statical code checks (provided by ruff rule
W605) on module level https://github.com/apache/airflow/blob/79b5443d40545d16f219f4f7dc260257fdf45bbd/pyproject.toml#L392-L393 So it also required to remove this lines frompyproject.toml,
[!WARNING] Ruff Autofix suggest use raw string here, however it is not a case here and better rewrite built this command. Previous attempt https://github.com/apache/airflow/pull/38734 is reverted https://github.com/apache/airflow/pull/38864
Committer
- [X] I acknowledge that I am a maintainer/committer of the Apache Airflow project.
Is there more work left in this that I can help with? @Taragolis
There is only one things remaining, that it exact the thing which describe into the issue
This warning which might annoying end users because since Python 3.12+ such warnings become SyntaxWarning, see: https://github.com/python/cpython/issues/98401, which are not ignored by default as DeprecatedWarnings
So if you would like to fix, feel free to make a PR