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