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

Refactor csv download code for mapped VMPs #1707

Merged
merged 2 commits into from
Oct 31, 2023
Merged

Conversation

rebkwok
Copy link
Contributor

@rebkwok rebkwok commented Oct 30, 2023

Discovered another small bug in how the mapped VMP descriptions were produced, and realised that the previous code was ridiculously overcomplicated. The first commit refactors the way the mapped-VMP descriptions are generated, the second one removed the extra code that was only there for the overcomplicated previous version.

Copy link
Member

@iaindillingham iaindillingham left a comment

Choose a reason for hiding this comment

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

I've only been able to give a cursory review, I'm afraid, because I'm not familiar with the codebase. However, there's less code for the same tests, which strongly suggests everything's in order 🙂

if previous_vmp not in prev_to_vmp_mapping:
prev_to_vmp_mapping[previous_vmp] = vmp
# mapping in a previous code
previous_vmps_to_add.setdefault(previous, []).append(vmp)
Copy link
Member

Choose a reason for hiding this comment

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

I'd have reached for collections.defaultdict here. I didn't know about dict.setdefault 👍🏻

@rebkwok rebkwok merged commit 479f3bc into main Oct 31, 2023
6 checks passed
@rebkwok rebkwok deleted the refactor-download-csv branch October 31, 2023 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants