-
Notifications
You must be signed in to change notification settings - Fork 405
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
transpose key of RomanNumeral #1414
Conversation
post.key = self.key.transpose(value, inPlace=False) | ||
return post | ||
else: | ||
self.key = self.key.transpose(value, inPlace=False) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why couldn't this be self.key.transpose(value, inPlace=True)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's what I had in my initial commit (a40e41a) but I changed it based on the discussion in #1413 and your feedback at #1413 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah okay -- yes, we solved the problem in RomanText but not elsewhere, my bad.
music21/roman.py
Outdated
@@ -3089,6 +3091,28 @@ def _updatePitches(self): | |||
f'_updatePitches() was unable to derive pitches from the figure: {self.figure!r}' | |||
) # pragma: no cover | |||
|
|||
def transpose(self, value, *, inPlace=False) -> t.Optional[T]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for this to work, self has to be annotated with T as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see Harmony L 2338
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, fixed, but mypy didn't seem to be complaining. The "x" seems to be because coverage decreased slightly. (Not quite sure why since both inPlace=True
and inplace=False
are tested in the RomanNumeral.transpose()
doctest.)
I didn't see that this was ready because it was marked with an "x" -- reviewed now -- one fix needed to not get incorrect typing, one nice to have. Consider looking at the paradigm in key.Key transpose where the two inPlace options are typed differently so that it's obvious to the typing system whether to expect a RN or None to be returned. |
mypy is failing now:
I don't get these errors on my local machine; I just tried merging the current master into the branch and I still don't get them. So I'm not sure whether this PR is somehow introducing them? |
They must have upgraded their version of mypy today and it now finds errors that it didn't before. Those aren't from your work, so we can go and merge and I'll squash them separately. THANKS! |
oh, wait I turned on merge protection to prevent me from accidentally committing to master and I can't overrule this without some major tweaking (2-factor, etc.) so I'll get a separate fix in and then merge this. Sorry for the delay. |
Closing and reopening to get a clean board. |
Fixes the issue in #1413. I closely modeled RomanNumeral.transpose() on Harmony.transpose().