potiuk commented on a change in pull request #6702: [AIRFLOW-6140] Add missing types for some core classes. Depends on [AIRFLOW-6004] URL: https://github.com/apache/airflow/pull/6702#discussion_r353401169
########## File path: airflow/models/baseoperator.py ########## @@ -869,11 +877,16 @@ def get_task_instances(self, start_date=None, end_date=None, session=None): .order_by(TaskInstance.execution_date)\ .all() - def get_flat_relative_ids(self, upstream=False, found_descendants=None): + def get_flat_relative_ids(self, + upstream: bool = False, + found_descendants: Optional[Set[str]] = None) -> Set[str]: """ - Get a flat list of relatives' ids, either upstream or downstream. + Get a flat set of relatives' ids, either upstream or downstream. """ + if not self._dag: + return set() Review comment: It's only when the dag has never been set. We could also throw an exception here (or assert :)), but I think returning empty set is a better choice (because no Dag has no relative ids :D). With MyPy we now detect many places where None'able (i.e. Optional) field is used to call a method which is great because it really avoids having a mysterious errors during development. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services