You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/21 23:15:02 UTC

[GitHub] [airflow] dstandish opened a new pull request, #26578: Make sure ast has attr unparse in pre-commit

dstandish opened a new pull request, #26578:
URL: https://github.com/apache/airflow/pull/26578

   My version of ast in python 3.8 (3.8.13) does not have `unparse`.
   
   We can check that the function is there before using it.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] uranusjr commented on a diff in pull request #26578: Make sure ast has attr unparse in pre-commit

Posted by GitBox <gi...@apache.org>.
uranusjr commented on code in PR #26578:
URL: https://github.com/apache/airflow/pull/26578#discussion_r977066482


##########
scripts/ci/pre_commit/pre_commit_sync_dag_init_decorator.py:
##########
@@ -42,8 +42,10 @@ def _find_dag_deco(mod: ast.Module) -> ast.FunctionDef:
     return next(n for n in ast.iter_child_nodes(mod) if isinstance(n, ast.FunctionDef) and n.name == "dag")
 
 
+import ast
+
 # The new unparse() output is much more readable; fallback to dump() otherwise.
-if sys.version_info >= (3, 8):
+if sys.version_info >= (3, 8) and hasattr(ast, 'unparse'):

Review Comment:
   ```suggestion
   if sys.version_info >= (3, 9):
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] uranusjr commented on a diff in pull request #26578: Make sure ast has attr unparse in pre-commit

Posted by GitBox <gi...@apache.org>.
uranusjr commented on code in PR #26578:
URL: https://github.com/apache/airflow/pull/26578#discussion_r977066601


##########
scripts/ci/pre_commit/pre_commit_sync_dag_init_decorator.py:
##########
@@ -42,8 +42,10 @@ def _find_dag_deco(mod: ast.Module) -> ast.FunctionDef:
     return next(n for n in ast.iter_child_nodes(mod) if isinstance(n, ast.FunctionDef) and n.name == "dag")
 
 
+import ast
+

Review Comment:
   ```suggestion
   ```



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk commented on a diff in pull request #26578: Make sure ast has attr unparse in pre-commit

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #26578:
URL: https://github.com/apache/airflow/pull/26578#discussion_r977065940


##########
scripts/ci/pre_commit/pre_commit_sync_dag_init_decorator.py:
##########
@@ -42,8 +42,10 @@ def _find_dag_deco(mod: ast.Module) -> ast.FunctionDef:
     return next(n for n in ast.iter_child_nodes(mod) if isinstance(n, ast.FunctionDef) and n.name == "dag")
 
 
+import ast
+
 # The new unparse() output is much more readable; fallback to dump() otherwise.
-if sys.version_info >= (3, 8):
+if sys.version_info >= (3, 8) and hasattr(ast, 'unparse'):

Review Comment:
   I thnk the check is just wrong. According to https://docs.python.org/3.9/library/ast.html#ast.unparse it should be >= (3,9)



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] potiuk merged pull request #26578: Make sure ast has attr unparse in pre-commit

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #26578:
URL: https://github.com/apache/airflow/pull/26578


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org