Skip to content

Consolidate import and usage of itertools - #33479

Merged
potiuk merged 1 commit into
apache:mainfrom
eumiro:itertools
Aug 21, 2023
Merged

potiuk merged 1 commit into
apache:mainfrom
eumiro:itertools

Conversation

@eumiro

@eumiro eumiro commented Aug 17, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@uranusjr

Copy link
Copy Markdown
Member

If we want to consolidate (not strictly necessary) I’d prefer the full itertools name. it is used in some places as a variable (short for iterator).

Comment thread airflow/www/views.py Outdated
@eumiro
eumiro force-pushed the itertools branch 3 times, most recently from b928305 to c94feea Compare August 19, 2023 17:40
Comment thread airflow/lineage/__init__.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can just be

Suggested change
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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are not equivalent.

Copy link
Copy Markdown
Contributor Author

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.

@eumiro
eumiro force-pushed the itertools branch 2 times, most recently from 524bb1c to 1f89278 Compare August 20, 2023 05:25
@potiuk

potiuk commented Aug 20, 2023

Copy link
Copy Markdown
Member

Conflicts :(

@potiuk
potiuk merged commit 95a930b into apache:main Aug 21, 2023
@ephraimbuddy ephraimbuddy added the type:misc/internal Changelog: Misc changes that should appear in change log label Aug 27, 2023
@ephraimbuddy ephraimbuddy added this to the Airflow 2.7.1 milestone Aug 27, 2023
ephraimbuddy pushed a commit that referenced this pull request Aug 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants