mirror of
https://github.com/google/blockly.git
synced 2026-01-04 23:50:12 +01:00
chore: Clean up variable assignment. (#7962)
* chore: Clean up variable assignment. * fix: variable now const as a result of prev commit
This commit is contained in:
@@ -62,8 +62,8 @@ def run_query():
|
||||
while more:
|
||||
results, cursor, more = query.fetch_page(PAGE_SIZE, start_cursor=cursor)
|
||||
handle_results(results)
|
||||
page_count = page_count + 1
|
||||
result_count = result_count + len(results)
|
||||
page_count += 1
|
||||
result_count += len(results)
|
||||
print(f'{datetime.datetime.now().strftime("%I:%M:%S %p")} : page {page_count} : {result_count}')
|
||||
|
||||
run_query()
|
||||
|
||||
@@ -444,7 +444,6 @@ export class FieldVariable extends FieldDropdown {
|
||||
// #1499.
|
||||
// Set the allowable variable types. Null means all types on the workspace.
|
||||
if (Array.isArray(variableTypes)) {
|
||||
variableTypes = variableTypes;
|
||||
// Make sure the default type is valid.
|
||||
let isInArray = false;
|
||||
for (let i = 0; i < variableTypes.length; i++) {
|
||||
|
||||
@@ -75,8 +75,7 @@ export function load(
|
||||
}
|
||||
|
||||
// reverse() is destructive, so we have to re-reverse to correct the order.
|
||||
for (let [name, deserializer] of deserializers.reverse()) {
|
||||
name = name;
|
||||
for (const [name, deserializer] of deserializers.reverse()) {
|
||||
const pluginState = state[name];
|
||||
if (pluginState) {
|
||||
(deserializer as ISerializer)?.load(state[name], workspace);
|
||||
|
||||
@@ -287,7 +287,7 @@ export class ShortcutRegistry {
|
||||
}
|
||||
}
|
||||
if (serializedKey !== '' && e.keyCode) {
|
||||
serializedKey = serializedKey + '+' + e.keyCode;
|
||||
serializedKey += '+' + e.keyCode;
|
||||
} else if (e.keyCode) {
|
||||
serializedKey = String(e.keyCode);
|
||||
}
|
||||
@@ -335,7 +335,7 @@ export class ShortcutRegistry {
|
||||
}
|
||||
|
||||
if (serializedKey !== '' && keyCode) {
|
||||
serializedKey = serializedKey + '+' + keyCode;
|
||||
serializedKey += '+' + keyCode;
|
||||
} else if (keyCode) {
|
||||
serializedKey = `${keyCode}`;
|
||||
}
|
||||
|
||||
@@ -87,8 +87,8 @@ export function getInjectionDivXY(element: Element): Coordinate {
|
||||
let y = 0;
|
||||
while (element) {
|
||||
const xy = getRelativeXY(element);
|
||||
x = x + xy.x;
|
||||
y = y + xy.y;
|
||||
x += xy.x;
|
||||
y += xy.y;
|
||||
const classes = element.getAttribute('class') || '';
|
||||
if ((' ' + classes + ' ').includes(' injectionDiv ')) {
|
||||
break;
|
||||
|
||||
@@ -318,7 +318,7 @@ function ${generator.FUNCTION_NAME_PLACEHOLDER_}(values) {
|
||||
}
|
||||
for (var j = 0; j < counts.length; j++) {
|
||||
if (counts[j][1] === maxCount) {
|
||||
modes.push(counts[j][0]);
|
||||
modes.push(counts[j][0]);
|
||||
}
|
||||
}
|
||||
return modes;
|
||||
@@ -341,7 +341,7 @@ function ${generator.FUNCTION_NAME_PLACEHOLDER_}(numbers) {
|
||||
for (var j = 0; j < n; j++) {
|
||||
variance += Math.pow(numbers[j] - mean, 2);
|
||||
}
|
||||
variance = variance / n;
|
||||
variance /= n;
|
||||
return Math.sqrt(variance);
|
||||
}
|
||||
`,
|
||||
|
||||
@@ -81,7 +81,7 @@ def main():
|
||||
for line in infile:
|
||||
if line.startswith('///'):
|
||||
if description:
|
||||
description = description + ' ' + line[3:].strip()
|
||||
description += ' ' + line[3:].strip()
|
||||
else:
|
||||
description = line[3:].strip()
|
||||
else:
|
||||
|
||||
@@ -513,7 +513,7 @@ function mathModes(values) {
|
||||
}
|
||||
for (var j = 0; j < counts.length; j++) {
|
||||
if (counts[j][1] === maxCount) {
|
||||
modes.push(counts[j][0]);
|
||||
modes.push(counts[j][0]);
|
||||
}
|
||||
}
|
||||
return modes;
|
||||
@@ -527,7 +527,7 @@ function mathStandardDeviation(numbers) {
|
||||
for (var j = 0; j < n; j++) {
|
||||
variance += Math.pow(numbers[j] - mean, 2);
|
||||
}
|
||||
variance = variance / n;
|
||||
variance /= n;
|
||||
return Math.sqrt(variance);
|
||||
}
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ dartGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, dartGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, dartGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -158,7 +158,7 @@ javascriptGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, javascriptGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, javascriptGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -145,7 +145,7 @@ phpGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, phpGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, phpGenerator.ORDER_ATOMIC];
|
||||
|
||||
@@ -129,7 +129,7 @@ pythonGenerator.forBlock['unittest_adjustindex'] = function(block) {
|
||||
return [Number(index) + 1, pythonGenerator.ORDER_ATOMIC];
|
||||
} else {
|
||||
// If the index is dynamic, adjust it in code.
|
||||
index = index + ' + 1';
|
||||
index += ' + 1';
|
||||
}
|
||||
} else if (Blockly.utils.string.isNumber(index)) {
|
||||
return [index, pythonGenerator.ORDER_ATOMIC];
|
||||
|
||||
Reference in New Issue
Block a user