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/12/01 22:50:04 UTC

[GitHub] [airflow] potiuk commented on pull request #28019: Use asserts instead of exceptions for executor not started

potiuk commented on PR #28019:
URL: https://github.com/apache/airflow/pull/28019#issuecomment-1334545117

   > OK -- I updated to use the `if TYPE_CHECKING` style
   
   I think this is misunderstanding. This "if TYPE_CHECKING" is not something that you should add. There are specific places where we want to use assert for `if TYPE_CHECKING` when we want to get rid of `mypy` warning that None has no property etc. The role of "assert" in tnis case is to "calm down" MyPy so that it does not complain, in places where we **know** None cannot hapen for example.
   
   But in the case above, we actually want raise those messages if something unexpected happens. The way  it is done now - those messages will never be printed because if TYPE_CHECKING is only true when MyPy parses the code.
   
   I think - with the current state of our approach - you simply can't replace those if-s  wiht asserts.


-- 
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