potiuk commented on a change in pull request #20000: URL: https://github.com/apache/airflow/pull/20000#discussion_r763084583
########## File path: airflow/models/baseoperator.py ########## @@ -1301,8 +1305,13 @@ def run( from airflow.models import DagRun from airflow.utils.types import DagRunType - start_date = start_date or self.start_date - end_date = end_date or self.end_date or timezone.utcnow() + # Assertions for typing -- we need a dag, for this function, and when we have a DAG we are + # _guaranteed_ to have start_date (else we couldn't have been added to a DAG) + if TYPE_CHECKING: + assert self.start_date Review comment: We could potentially do some automated check if "assert" is preceded by `if TYPE_CHECKING:` in pre-commit. -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org