-
Notifications
You must be signed in to change notification settings - Fork 14.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consolidate import and usage of itertools #33479
Conversation
If we want to consolidate (not strictly necessary) I’d prefer the full |
b928305
to
c94feea
Compare
airflow/lineage/__init__.py
Outdated
@@ -142,7 +142,7 @@ def wrapper(self, context, *args, **kwargs): | |||
_inlets = self.xcom_pull( | |||
context, task_ids=task_ids, dag_id=self.dag_id, key=PIPELINE_OUTLETS, session=session | |||
) | |||
self.inlets.extend(i for i in itertools.chain.from_iterable(_inlets)) | |||
self.inlets.extend(itertools.chain.from_iterable(_inlets)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can just be
self.inlets.extend(itertools.chain.from_iterable(_inlets)) | |
self.inlets.extend(i for it in _inlets for i in it) |
but itertools has readability advantages.
for argument, default in itertools.zip_longest(arguments, defaults, fillvalue=None): | ||
for argument, default in zip(arguments, defaults): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are not equivalent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the subsequent line:
if argument is None or default is None:
continue
all the lines that come from zip_longest
but are ignored in zip
are ignored anyway.
524bb1c
to
1f89278
Compare
Conflicts :( |
(cherry picked from commit 95a930b)
No description provided.