Skip to content

Commit c8638ec

Browse files
committed
Fix bug: wrongly propagated inverted gradings
1 parent 7b0704d commit c8638ec

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"[python]": {
33
"editor.formatOnSave": true,
4-
"editor.defaultFormatter": "ms-python.black-formatter",
4+
"editor.defaultFormatter": "charliermarsh.ruff",
55
"editor.wordBasedSuggestions": "off",
66
"editor.codeActionsOnSave": {
77
"source.organizeImports.isort": "explicit"

src/classy_blocks/grading/grading.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ def copy(self, length: float, invert: bool = False) -> "Grading":
115115
"""Creates a new grading with the same chops (counts) on a different length,
116116
keeping chop.preserve quantity constant;
117117
118-
the 'length' parameter is the new wire's length"""
118+
the 'length' parameter is the new wire's length;
119+
'invert' does not set the grading.inverted flag but flips the original value"""
119120
new_grading = Grading(length)
120121

121122
for data in self.chop_data:
@@ -132,6 +133,7 @@ def copy(self, length: float, invert: bool = False) -> "Grading":
132133

133134
new_grading.add_chop(Chop(**new_args))
134135

136+
new_grading.inverted = self.inverted
135137
if invert:
136138
new_grading.inverted = not new_grading.inverted
137139

src/classy_blocks/items/wires/wire.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ def copy_to_coincidents(self):
101101
for coincident in self.coincidents:
102102
if coincident.grading.is_defined:
103103
continue
104+
104105
coincident.grading = self.grading.copy(self.length, not coincident.is_aligned(self))
105106

106107
def check_consistency(self) -> None:

0 commit comments

Comments
 (0)