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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to