Skip to content
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

zip_longest instead of zip in parse_csv #14109

Closed
wants to merge 1 commit into from

Conversation

pondrejk
Copy link
Contributor

@pondrejk pondrejk commented Feb 16, 2024

Problem Statement

The Ruff code standard B905 requires the zip strict value to be explicitly stated, it does not require it to be True.

Solution

This PR sets the value to what it (implicitly) was before #13491 thus removing the need for #13737 #13797 #13999 #13989 and additional changes discussed in the last mentioned PR

[edit]: using zip_longest to not drop any data and adding log about the mismatch

@pondrejk pondrejk added CLI Issues and PRs involving the CLI Easy Fix :) Easiest Fix to review and quick merge request. Framework Changes A modification of the robottelo framework CherryPick PR needs CherryPick to previous branches 6.12.z Introduced in or relating directly to Satellite 6.12 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 labels Feb 16, 2024
@pondrejk pondrejk self-assigned this Feb 16, 2024
@pondrejk pondrejk requested a review from a team as a code owner February 16, 2024 18:44
@pondrejk
Copy link
Contributor Author

trigger: test-robottelo

@JacobCallahan
Copy link
Member

Does this work in the situations all of those linked PRs were trying to solve or does it just mask the problem? The reason I ask is because there is a difference in zipped iterables where data from one is lost by turning off strict mode.

@Satellite-QE
Copy link
Collaborator

PRT Result

Build Number: 5778
Build Status: SUCCESS
PRT Comment: pytest null
Test Result : ======== 11 passed, 6009 deselected, 99 warnings in 1635.28s (0:27:15) =========

@Satellite-QE Satellite-QE added the PRT-Passed Indicates that latest PRT run is passed for the PR label Feb 16, 2024
@pondrejk
Copy link
Contributor Author

pondrejk commented Feb 19, 2024

Does this work in the situations all of those linked PRs were trying to solve or does it just mask the problem? The reason I ask is because there is a difference in zipped iterables where data from one is lost by turning off strict mode.

It does work in a sense that it unblocks tests. Without the need to work around the csv sniffing, we are left only with jobinvocation hammer output that does not fit. There is a bz for it, so maybe I can add some logic around that.

@pondrejk pondrejk changed the title zip strict=False in parse_csv zip_longest instead of zip in parse_csv Feb 19, 2024
@pondrejk
Copy link
Contributor Author

So I made a change to zip_longest, so that data are kept in case of mismatch

@ogajduse
Copy link
Member

An observation from my investigation on #13989:
We can completely ditch zip if we use csv.DictReader from the standard library. https://docs.python.org/3/library/csv.html#csv.DictReader

@pondrejk
Copy link
Contributor Author

closing in favor of #13989

@pondrejk pondrejk closed this Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.12.z Introduced in or relating directly to Satellite 6.12 6.13.z Introduced in or relating directly to Satellite 6.13 6.14.z Introduced in or relating directly to Satellite 6.14 6.15.z Introduced in or relating directly to Satellite 6.15 AutoMerge_Cherry_Picked The cherrypicked PRs of master PR would be automerged if all checks passing CherryPick PR needs CherryPick to previous branches CLI Issues and PRs involving the CLI Easy Fix :) Easiest Fix to review and quick merge request. Framework Changes A modification of the robottelo framework PRT-Passed Indicates that latest PRT run is passed for the PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants