Added casefolding for label name comparisons. #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes
Fixes #84 by @dhruvkb
Description
This PR is currently a work in progress to solve issue #84
I added the
casefold()
method to allow for better syncing of the labels.Technical details
I basically have 2 options for how to solve this. The first involves adding casefolding to the
set_labels.py
. I am assuming the error was occurring for the conditional on line 48 inset_labels.py
:final_label_name
is a string and is checking its value against the key values ofinitial_labels
which in this case are also strings. So iffinal_label_name
have a value of"Bug"
and lets say there is a key ininitial_labels
called"bug"
, the conditional will succeed causing the label creation error.So my proposal for the change is to have the keys of both dictionaries housing the labels be normalized with a
casefold
.I had reverted changes I initially made to have casefolidng in the equality operators in
models.py
. I did this as when comparing labels, we want to make sure that there is differences found when we want to intentionally update the casing of a label.Tests
I wasn't able to test this with your code as I don't have access to your repository. However, I set up a private repository to test the functions myself. Based on the changes I made, I was able to effectively sync the labels while taking the case insensitivity of GitHub.
Checklist
Update index.md
).main
ormaster
).visible errors. N/A
Developer Certificate of Origin
Developer Certificate of Origin