Skip to content

Commit

Permalink
release: v10.1.0
Browse files Browse the repository at this point in the history
Merge pull request #7371 from google/rc/v10.1.0
  • Loading branch information
ericblackmonGoogle authored Aug 10, 2023
2 parents e76b9c5 + 74049c7 commit 8cbc7ed
Show file tree
Hide file tree
Showing 315 changed files with 6,299 additions and 5,584 deletions.
2 changes: 1 addition & 1 deletion appengine/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ def xmlToKey(xml_content):
# Store XML and return a generated key.
xml_hash = int(hashlib.sha1(xml_content.encode("utf-8")).hexdigest(), 16)
xml_hash = int(xml_hash % (2 ** 64) - (2 ** 63))
lookup_query = Xml.query(Xml.xml_hash == xml_hash)
client = ndb.Client()
with client.context():
lookup_query = Xml.query(Xml.xml_hash == xml_hash)
lookup_result = lookup_query.get()
if lookup_result:
xml_key = lookup_result.key.string_id()
Expand Down
2 changes: 1 addition & 1 deletion blocks/blocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ export const blocks: {[key: string]: BlockDefinition} = Object.assign(
math.blocks,
procedures.blocks,
variables.blocks,
variablesDynamic.blocks
variablesDynamic.blocks,
);
34 changes: 17 additions & 17 deletions blocks/lists.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const LISTS_CREATE_WITH = {
this.updateShape_();
this.setOutput(true, 'Array');
this.setMutator(
new MutatorIcon(['lists_create_with_item'], this as unknown as BlockSvg)
new MutatorIcon(['lists_create_with_item'], this as unknown as BlockSvg),
); // BUG(#6905)
this.setTooltip(Msg['LISTS_CREATE_WITH_TOOLTIP']);
},
Expand Down Expand Up @@ -182,16 +182,16 @@ const LISTS_CREATE_WITH = {
*/
decompose: function (
this: CreateWithBlock,
workspace: Workspace
workspace: Workspace,
): ContainerBlock {
const containerBlock = workspace.newBlock(
'lists_create_with_container'
'lists_create_with_container',
) as ContainerBlock;
(containerBlock as BlockSvg).initSvg();
let connection = containerBlock.getInput('STACK')!.connection;
for (let i = 0; i < this.itemCount_; i++) {
const itemBlock = workspace.newBlock(
'lists_create_with_item'
'lists_create_with_item',
) as ItemBlock;
(itemBlock as BlockSvg).initSvg();
if (!itemBlock.previousConnection) {
Expand All @@ -209,7 +209,7 @@ const LISTS_CREATE_WITH = {
*/
compose: function (this: CreateWithBlock, containerBlock: Block) {
let itemBlock: ItemBlock | null = containerBlock.getInputTargetBlock(
'STACK'
'STACK',
) as ItemBlock;
// Count number of inputs.
const connections: Connection[] = [];
Expand Down Expand Up @@ -242,7 +242,7 @@ const LISTS_CREATE_WITH = {
*/
saveConnections: function (this: CreateWithBlock, containerBlock: Block) {
let itemBlock: ItemBlock | null = containerBlock.getInputTargetBlock(
'STACK'
'STACK',
) as ItemBlock;
let i = 0;
while (itemBlock) {
Expand All @@ -265,7 +265,7 @@ const LISTS_CREATE_WITH = {
this.removeInput('EMPTY');
} else if (!this.itemCount_ && !this.getInput('EMPTY')) {
this.appendDummyInput('EMPTY').appendField(
Msg['LISTS_CREATE_EMPTY_TITLE']
Msg['LISTS_CREATE_EMPTY_TITLE'],
);
}
// Add new inputs.
Expand Down Expand Up @@ -297,7 +297,7 @@ const LISTS_CREATE_WITH_CONTAINER = {
init: function (this: ContainerBlock) {
this.setStyle('list_blocks');
this.appendDummyInput().appendField(
Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD']
Msg['LISTS_CREATE_WITH_CONTAINER_TITLE_ADD'],
);
this.appendStatementInput('STACK');
this.setTooltip(Msg['LISTS_CREATE_WITH_CONTAINER_TOOLTIP']);
Expand Down Expand Up @@ -358,7 +358,7 @@ const LISTS_INDEXOF = {
this.setTooltip(() => {
return Msg['LISTS_INDEX_OF_TOOLTIP'].replace(
'%1',
this.workspace.options.oneBasedIndex ? '0' : '-1'
this.workspace.options.oneBasedIndex ? '0' : '-1',
);
});
},
Expand Down Expand Up @@ -401,7 +401,7 @@ const LISTS_GETINDEX = {
const isStatement = value === 'REMOVE';
(this.getSourceBlock() as GetIndexBlock).updateStatement_(isStatement);
return undefined;
}
},
);
this.appendValueInput('VALUE')
.setCheck('Array')
Expand Down Expand Up @@ -568,7 +568,7 @@ const LISTS_GETINDEX = {
this.appendValueInput('AT').setCheck('Number');
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
this.appendDummyInput('ORDINAL').appendField(
Msg['ORDINAL_NUMBER_SUFFIX']
Msg['ORDINAL_NUMBER_SUFFIX'],
);
}
} else {
Expand Down Expand Up @@ -596,7 +596,7 @@ const LISTS_GETINDEX = {
return null;
}
return undefined;
}
},
);
this.getInput('AT')!.appendField(menu, 'WHERE');
if (Msg['LISTS_GET_INDEX_TAIL']) {
Expand Down Expand Up @@ -685,7 +685,7 @@ const LISTS_SETINDEX = {
' ' +
Msg['LISTS_INDEX_FROM_START_TOOLTIP'].replace(
'%1',
this.workspace.options.oneBasedIndex ? '#1' : '#0'
this.workspace.options.oneBasedIndex ? '#1' : '#0',
);
}
return tooltip;
Expand Down Expand Up @@ -747,7 +747,7 @@ const LISTS_SETINDEX = {
this.appendValueInput('AT').setCheck('Number');
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
this.appendDummyInput('ORDINAL').appendField(
Msg['ORDINAL_NUMBER_SUFFIX']
Msg['ORDINAL_NUMBER_SUFFIX'],
);
}
} else {
Expand Down Expand Up @@ -775,7 +775,7 @@ const LISTS_SETINDEX = {
return null;
}
return undefined;
}
},
);
this.moveInputBefore('AT', 'TO');
if (this.getInput('ORDINAL')) {
Expand Down Expand Up @@ -887,7 +887,7 @@ const LISTS_GETSUBLIST = {
this.appendValueInput('AT' + n).setCheck('Number');
if (Msg['ORDINAL_NUMBER_SUFFIX']) {
this.appendDummyInput('ORDINAL' + n).appendField(
Msg['ORDINAL_NUMBER_SUFFIX']
Msg['ORDINAL_NUMBER_SUFFIX'],
);
}
} else {
Expand Down Expand Up @@ -915,7 +915,7 @@ const LISTS_GETSUBLIST = {
block.setFieldValue(value, 'WHERE' + n);
return null;
}
}
},
);
this.getInput('AT' + n)!.appendField(menu, 'WHERE' + n);
if (n === 1) {
Expand Down
24 changes: 12 additions & 12 deletions blocks/logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ const TOOLTIPS_BY_OP = {

Extensions.register(
'logic_op_tooltip',
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP)
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP),
);

/** Type of a block that has CONTROLS_IF_MUTATOR_MIXIN */
Expand Down Expand Up @@ -417,10 +417,10 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
this.elseifCount_++;
// TODO(#6920): null valid, undefined not.
valueConnections.push(
clauseBlock.valueConnection_ as Connection | null
clauseBlock.valueConnection_ as Connection | null,
);
statementConnections.push(
clauseBlock.statementConnection_ as Connection | null
clauseBlock.statementConnection_ as Connection | null,
);
break;
case 'controls_if_else':
Expand All @@ -438,7 +438,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
this.reconnectChildBlocks_(
valueConnections,
statementConnections,
elseStatementConnection
elseStatementConnection,
);
},
/**
Expand Down Expand Up @@ -500,7 +500,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
this.reconnectChildBlocks_(
valueConnections,
statementConnections,
elseStatementConnection
elseStatementConnection,
);
},
/**
Expand All @@ -523,12 +523,12 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
.setCheck('Boolean')
.appendField(Msg['CONTROLS_IF_MSG_ELSEIF']);
this.appendStatementInput('DO' + i).appendField(
Msg['CONTROLS_IF_MSG_THEN']
Msg['CONTROLS_IF_MSG_THEN'],
);
}
if (this.elseCount_) {
this.appendStatementInput('ELSE').appendField(
Msg['CONTROLS_IF_MSG_ELSE']
Msg['CONTROLS_IF_MSG_ELSE'],
);
}
},
Expand All @@ -545,7 +545,7 @@ const CONTROLS_IF_MUTATOR_MIXIN = {
this: IfBlock,
valueConnections: Array<Connection | null>,
statementConnections: Array<Connection | null>,
elseStatementConnection: Connection | null
elseStatementConnection: Connection | null,
) {
for (let i = 1; i <= this.elseifCount_; i++) {
valueConnections[i]?.reconnect(this, 'IF' + i);
Expand All @@ -559,7 +559,7 @@ Extensions.registerMutator(
'controls_if_mutator',
CONTROLS_IF_MUTATOR_MIXIN,
null as unknown as undefined, // TODO(#6920)
['controls_if_elseif', 'controls_if_else']
['controls_if_elseif', 'controls_if_else'],
);

/**
Expand All @@ -579,7 +579,7 @@ const CONTROLS_IF_TOOLTIP_EXTENSION = function (this: IfBlock) {
return Msg['CONTROLS_IF_TOOLTIP_4'];
}
return '';
}.bind(this)
}.bind(this),
);
};

Expand Down Expand Up @@ -617,7 +617,7 @@ const LOGIC_COMPARE_ONCHANGE_MIXIN = {
blockB &&
!this.workspace.connectionChecker.doTypeChecks(
blockA.outputConnection!,
blockB.outputConnection!
blockB.outputConnection!,
)
) {
// Mismatch between two inputs. Revert the block connections,
Expand Down Expand Up @@ -686,7 +686,7 @@ const LOGIC_TERNARY_ONCHANGE_MIXIN = {
block &&
!block.workspace.connectionChecker.doTypeChecks(
block.outputConnection!,
parentConnection
parentConnection,
)
) {
// Ensure that any disconnections are grouped with the causing
Expand Down
19 changes: 11 additions & 8 deletions blocks/loops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ const WHILE_UNTIL_TOOLTIPS = {

Extensions.register(
'controls_whileUntil_tooltip',
Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS)
Extensions.buildTooltipForDropdown('MODE', WHILE_UNTIL_TOOLTIPS),
);

/**
Expand All @@ -242,7 +242,7 @@ const BREAK_CONTINUE_TOOLTIPS = {

Extensions.register(
'controls_flow_tooltip',
Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS)
Extensions.buildTooltipForDropdown('FLOW', BREAK_CONTINUE_TOOLTIPS),
);

/** Type of a block that has CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN */
Expand All @@ -264,7 +264,7 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = {
*/
customContextMenu: function (
this: CustomContextMenuBlock,
options: Array<ContextMenuOption | LegacyContextMenuOption>
options: Array<ContextMenuOption | LegacyContextMenuOption>,
) {
if (this.isInFlyout) {
return;
Expand All @@ -289,17 +289,20 @@ const CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN = {

Extensions.registerMixin(
'contextMenu_newGetVariableBlock',
CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN
CUSTOM_CONTEXT_MENU_CREATE_VARIABLES_GET_MIXIN,
);

Extensions.register(
'controls_for_tooltip',
Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR')
Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOR_TOOLTIP}', 'VAR'),
);

Extensions.register(
'controls_forEach_tooltip',
Extensions.buildTooltipWithFieldText('%{BKY_CONTROLS_FOREACH_TOOLTIP}', 'VAR')
Extensions.buildTooltipWithFieldText(
'%{BKY_CONTROLS_FOREACH_TOOLTIP}',
'VAR',
),
);

/**
Expand Down Expand Up @@ -366,7 +369,7 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = {
}
const enabled = !!this.getSurroundLoop();
this.setWarningText(
enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING']
enabled ? null : Msg['CONTROLS_FLOW_STATEMENTS_WARNING'],
);
if (!this.isInFlyout) {
const group = Events.getGroup();
Expand All @@ -380,7 +383,7 @@ const CONTROL_FLOW_IN_LOOP_CHECK_MIXIN = {

Extensions.registerMixin(
'controls_flow_in_loop_check',
CONTROL_FLOW_IN_LOOP_CHECK_MIXIN
CONTROL_FLOW_IN_LOOP_CHECK_MIXIN,
);

// Register provided blocks.
Expand Down
12 changes: 6 additions & 6 deletions blocks/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ const TOOLTIPS_BY_OP = {

Extensions.register(
'math_op_tooltip',
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP)
Extensions.buildTooltipForDropdown('OP', TOOLTIPS_BY_OP),
);

/** Type of a block that has IS_DIVISBLEBY_MUTATOR_MIXIN */
Expand Down Expand Up @@ -502,20 +502,20 @@ const IS_DIVISIBLE_MUTATOR_EXTENSION = function (this: DivisiblebyBlock) {
const divisorInput = option === 'DIVISIBLE_BY';
(this.getSourceBlock() as DivisiblebyBlock).updateShape_(divisorInput);
return undefined; // FieldValidators can't be void. Use option as-is.
}
},
);
};

Extensions.registerMutator(
'math_is_divisibleby_mutator',
IS_DIVISIBLEBY_MUTATOR_MIXIN,
IS_DIVISIBLE_MUTATOR_EXTENSION
IS_DIVISIBLE_MUTATOR_EXTENSION,
);

// Update the tooltip of 'math_change' block to reference the variable.
Extensions.register(
'math_change_tooltip',
Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR')
Extensions.buildTooltipWithFieldText('%{BKY_MATH_CHANGE_TOOLTIP}', 'VAR'),
);

/** Type of a block that has LIST_MODES_MUTATOR_MIXIN */
Expand Down Expand Up @@ -578,14 +578,14 @@ const LIST_MODES_MUTATOR_EXTENSION = function (this: ListModesBlock) {
function (this: ListModesBlock, newOp: string) {
this.updateType_(newOp);
return undefined;
}.bind(this)
}.bind(this),
);
};

Extensions.registerMutator(
'math_modes_of_list_mutator',
LIST_MODES_MUTATOR_MIXIN,
LIST_MODES_MUTATOR_EXTENSION
LIST_MODES_MUTATOR_EXTENSION,
);

// Register provided blocks.
Expand Down
Loading

0 comments on commit 8cbc7ed

Please sign in to comment.