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

Some followup work on the --json PR #759

Merged
merged 10 commits into from
Jun 19, 2023
Merged

Conversation

carmenbianca
Copy link
Member

Some refactoring work on top of the work done in #654.

Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
These should reduce repetition and hopefully reduce errors.

Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
@carmenbianca carmenbianca marked this pull request as ready for review June 10, 2023 16:05
src/reuse/header.py Outdated Show resolved Hide resolved
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
I broke it during a previous commit. Because Python 3.7 is EOL in two
weeks, I figure we can just drop it now.

Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
Signed-off-by: Carmen Bianca BAKKER <carmenbianca@fsfe.org>
foo.py
"""
new_kwargs = {}
for key, attr_val in self.__dict__.items():
Copy link
Member

Choose a reason for hiding this comment

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

Just checking: there is no need to check the keys of the other dictionary as all keys are added on initiation and so the structure is the same.

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, provided you have two ReuseInfo objects.

I considered the cases ReuseInfo.copy(SuperReuseInfo) and SuperReuseInfo.copy(ReuseInfo), but didn't write tests for them.

In the first case, the extra fields in SuperReuseInfo are not copied over into the new object, because they're not in ReuseInfo's dict.

In the second case, the extra fields in SuperReuseInfo cannot be overwritten because they do not exist in ReuseInfo.

Copy link
Member

@nicorikken nicorikken left a comment

Choose a reason for hiding this comment

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

Lots of great improvements under the hood. Nice!

Copy link
Member

@linozen linozen left a comment

Choose a reason for hiding this comment

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

All looks great to me. Thanks @carmenbianca

@linozen linozen merged commit 06b8b46 into fsfe:main Jun 19, 2023
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.

3 participants