Fix bug when broadcasting deprecated config#7121
Conversation
6fde880 to
3dfd6fa
Compare
|
@ColemanTom has spotted this in the wild.... Closes #7167 |
oliver-sanders
left a comment
There was a problem hiding this comment.
LGTM, tested as working.
Gotta couple of QA things which aren't covered by the linter, open to debate.
cylc/flow/parsec/upgrade.py
Outdated
| self.DEPR_MSG = self.DEPR_TEMPLATE.format('broadcast') | ||
| self.OBSLT_MSG = ( | ||
| "Obsolete config items were rejected by the broadcast." | ||
| ) |
There was a problem hiding this comment.
Overloading class constants isn't the nicest pattern (actually gets flagged by flake8 C002 as redefinition of constant).
Both only get used once, so might be more appropriate to do the formatting there than storing the modified template on the instance?
There was a problem hiding this comment.
Is that just because the variables have uppercase names? Otherwise there is nothing constant about class attributes and there can be no harm in reassigning a instance attribute that shares the same name as a class attribute
There was a problem hiding this comment.
Yep. Python has no top-level concept of a constant, so there is a convention instead, we use upper case for constants and lower case for variables. Once defined a constant should not be redefined (C002).
This pattern is also using class/instance variable shadowing because we have two variables with the same name, cls.DEPR_MSG and self.DEPR_MSG which can be confusing as self.DEPR_MSG will return cls.DEPR_MSG if the instance variable is unset.
3dfd6fa to
f3f81c3
Compare
Repro
Any simple workflow
Check List
CONTRIBUTING.mdand added my name as a Code Contributor.?.?.xbranch.