Update to latest version.

This commit is contained in:
Neil Fraser
2014-09-08 14:26:52 -07:00
parent 58f264f4ce
commit d998a1c8ec
737 changed files with 29546 additions and 27625 deletions

View File

@@ -43,11 +43,11 @@ Blockly.Python['math_number'] = function(block) {
Blockly.Python['math_arithmetic'] = function(block) {
// Basic arithmetic operators, and power.
var OPERATORS = {
ADD: [' + ', Blockly.Python.ORDER_ADDITIVE],
MINUS: [' - ', Blockly.Python.ORDER_ADDITIVE],
MULTIPLY: [' * ', Blockly.Python.ORDER_MULTIPLICATIVE],
DIVIDE: [' / ', Blockly.Python.ORDER_MULTIPLICATIVE],
POWER: [' ** ', Blockly.Python.ORDER_EXPONENTIATION]
'ADD': [' + ', Blockly.Python.ORDER_ADDITIVE],
'MINUS': [' - ', Blockly.Python.ORDER_ADDITIVE],
'MULTIPLY': [' * ', Blockly.Python.ORDER_MULTIPLICATIVE],
'DIVIDE': [' / ', Blockly.Python.ORDER_MULTIPLICATIVE],
'POWER': [' ** ', Blockly.Python.ORDER_EXPONENTIATION]
};
var tuple = OPERATORS[block.getFieldValue('OP')];
var operator = tuple[0];
@@ -147,12 +147,13 @@ Blockly.Python['math_single'] = function(block) {
Blockly.Python['math_constant'] = function(block) {
// Constants: PI, E, the Golden Ratio, sqrt(2), 1/sqrt(2), INFINITY.
var CONSTANTS = {
PI: ['math.pi', Blockly.Python.ORDER_MEMBER],
E: ['math.e', Blockly.Python.ORDER_MEMBER],
GOLDEN_RATIO: ['(1 + math.sqrt(5)) / 2', Blockly.Python.ORDER_MULTIPLICATIVE],
SQRT2: ['math.sqrt(2)', Blockly.Python.ORDER_MEMBER],
SQRT1_2: ['math.sqrt(1.0 / 2)', Blockly.Python.ORDER_MEMBER],
INFINITY: ['float(\'inf\')', Blockly.Python.ORDER_ATOMIC]
'PI': ['math.pi', Blockly.Python.ORDER_MEMBER],
'E': ['math.e', Blockly.Python.ORDER_MEMBER],
'GOLDEN_RATIO': ['(1 + math.sqrt(5)) / 2',
Blockly.Python.ORDER_MULTIPLICATIVE],
'SQRT2': ['math.sqrt(2)', Blockly.Python.ORDER_MEMBER],
'SQRT1_2': ['math.sqrt(1.0 / 2)', Blockly.Python.ORDER_MEMBER],
'INFINITY': ['float(\'inf\')', Blockly.Python.ORDER_ATOMIC]
};
var constant = block.getFieldValue('CONSTANT');
if (constant != 'INFINITY') {
@@ -257,7 +258,7 @@ Blockly.Python['math_on_list'] = function(block) {
case 'AVERAGE':
var functionName = Blockly.Python.provideFunction_(
'math_mean',
// This operation excludes null and values that are not int or float:',
// This operation excludes null and values that aren't int or float:',
// math_mean([null, null, "aString", 1, 9]) == 5.0.',
['def ' + Blockly.Python.FUNCTION_NAME_PLACEHOLDER_ + '(myList):',
' localList = [e for e in myList if type(e) in (int, float, long)]',