This commit is contained in:
Aaron Dodson
2024-11-04 12:55:45 -08:00
parent aedcfd6da5
commit fc40ff62ac
325 changed files with 95337 additions and 0 deletions

208
dist/python_compressed.js vendored Normal file
View File

@@ -0,0 +1,208 @@
// Do not edit this file; automatically generated.
/* eslint-disable */
;(function(root, factory) {
if (typeof define === 'function' && define.amd) { // AMD
define(["./blockly_compressed.js"], factory);
} else if (typeof exports === 'object') { // Node.js
module.exports = factory(require("./blockly_compressed.js"));
} else { // Script
root.python = factory(root.Blockly);
root.Blockly.Python = root.python.pythonGenerator;
}
}(this, function(__parent__) {
var $=__parent__.__namespace__;
var lists_create_empty$$module$build$src$generators$python$lists=function(a,b){return["[]",Order$$module$build$src$generators$python$python_generator.ATOMIC]},lists_create_with$$module$build$src$generators$python$lists=function(a,b){const c=Array(a.itemCount_);for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$python$python_generator.NONE)||"None";return["["+c.join(", ")+"]",Order$$module$build$src$generators$python$python_generator.ATOMIC]},lists_repeat$$module$build$src$generators$python$lists=
function(a,b){const c=b.valueToCode(a,"ITEM",Order$$module$build$src$generators$python$python_generator.NONE)||"None";a=b.valueToCode(a,"NUM",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE)||"0";return["["+c+"] * "+a,Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},lists_length$$module$build$src$generators$python$lists=function(a,b){return["len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"[]")+")",
Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},lists_isEmpty$$module$build$src$generators$python$lists=function(a,b){return["not len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"[]")+")",Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT]},lists_indexOf$$module$build$src$generators$python$lists=function(a,b){const c=b.valueToCode(a,"FIND",Order$$module$build$src$generators$python$python_generator.NONE)||
"[]",d=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''";let e=" -1",f="",g=" - 1";a.workspace.options.oneBasedIndex&&(e=" 0",f=" + 1",g="");return[("FIRST"===a.getFieldValue("END")?b.provideFunction_("first_index",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(my_list, elem):
try: index = my_list.index(elem)${f}
except: index =${e}
return index
`):b.provideFunction_("last_index",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(my_list, elem):
try: index = len(my_list) - my_list[::-1].index(elem)${g}
except: index =${e}
return index
`))+"("+d+", "+c+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},lists_getIndex$$module$build$src$generators$python$lists=function(a,b){const c=a.getFieldValue("MODE")||"GET",d=a.getFieldValue("WHERE")||"FROM_START";var e=b.valueToCode(a,"VALUE","RANDOM"===d?Order$$module$build$src$generators$python$python_generator.NONE:Order$$module$build$src$generators$python$python_generator.MEMBER)||"[]";switch(d){case "FIRST":if("GET"===c)return[e+"[0]",Order$$module$build$src$generators$python$python_generator.MEMBER];
if("GET_REMOVE"===c)return[e+".pop(0)",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];if("REMOVE"===c)return e+".pop(0)\n";break;case "LAST":if("GET"===c)return[e+"[-1]",Order$$module$build$src$generators$python$python_generator.MEMBER];if("GET_REMOVE"===c)return[e+".pop()",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];if("REMOVE"===c)return e+".pop()\n";break;case "FROM_START":a=b.getAdjustedInt(a,"AT");if("GET"===c)return[e+"["+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER];
if("GET_REMOVE"===c)return[e+".pop("+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];if("REMOVE"===c)return e+".pop("+a+")\n";break;case "FROM_END":a=b.getAdjustedInt(a,"AT",1,!0);if("GET"===c)return[e+"["+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER];if("GET_REMOVE"===c)return[e+".pop("+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];if("REMOVE"===c)return e+".pop("+a+")\n";break;case "RANDOM":b.definitions_.import_random=
"import random";if("GET"===c)return["random.choice("+e+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];e=b.provideFunction_("lists_remove_random_item",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(myList):
x = int(random.random() * len(myList))
return myList.pop(x)
`)+"("+e+")";if("GET_REMOVE"===c)return[e,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];if("REMOVE"===c)return e+"\n"}throw Error("Unhandled combination (lists_getIndex).");},lists_setIndex$$module$build$src$generators$python$lists=function(a,b){let c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$python$python_generator.MEMBER)||"[]";const d=a.getFieldValue("MODE")||"GET";var e=a.getFieldValue("WHERE")||"FROM_START";const f=b.valueToCode(a,"TO",Order$$module$build$src$generators$python$python_generator.NONE)||
"None";switch(e){case "FIRST":if("SET"===d)return c+"[0] = "+f+"\n";if("INSERT"===d)return c+".insert(0, "+f+")\n";break;case "LAST":if("SET"===d)return c+"[-1] = "+f+"\n";if("INSERT"===d)return c+".append("+f+")\n";break;case "FROM_START":b=b.getAdjustedInt(a,"AT");if("SET"===d)return c+"["+b+"] = "+f+"\n";if("INSERT"===d)return c+".insert("+b+", "+f+")\n";break;case "FROM_END":b=b.getAdjustedInt(a,"AT",1,!0);if("SET"===d)return c+"["+b+"] = "+f+"\n";if("INSERT"===d)return c+".insert("+b+", "+f+
")\n";break;case "RANDOM":b.definitions_.import_random="import random";c.match(/^\w+$/)?a="":(a=b.nameDB_.getDistinctName("tmp_list",$.NameType$$module$build$src$core$names.VARIABLE),e=a+" = "+c+"\n",c=a,a=e);b=b.nameDB_.getDistinctName("tmp_x",$.NameType$$module$build$src$core$names.VARIABLE);a+=b+" = int(random.random() * len("+c+"))\n";if("SET"===d)return a+(c+"["+b+"] = "+f+"\n");if("INSERT"===d)return a+(c+".insert("+b+", "+f+")\n")}throw Error("Unhandled combination (lists_setIndex).");},lists_getSublist$$module$build$src$generators$python$lists=
function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$python$python_generator.MEMBER)||"[]";var d=a.getFieldValue("WHERE1");const e=a.getFieldValue("WHERE2");switch(d){case "FROM_START":d=b.getAdjustedInt(a,"AT1");0===d&&(d="");break;case "FROM_END":d=b.getAdjustedInt(a,"AT1",1,!0);break;case "FIRST":d="";break;default:throw Error("Unhandled option (lists_getSublist)");}switch(e){case "FROM_START":a=b.getAdjustedInt(a,"AT2",1);break;case "FROM_END":a=b.getAdjustedInt(a,"AT2",
0,!0);$.isNumber$$module$build$src$core$utils$string(String(a))?0===a&&(a=""):(b.definitions_.import_sys="import sys",a+=" or sys.maxsize");break;case "LAST":a="";break;default:throw Error("Unhandled option (lists_getSublist)");}return[c+"["+d+" : "+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER]},lists_sort$$module$build$src$generators$python$lists=function(a,b){const c=b.valueToCode(a,"LIST",Order$$module$build$src$generators$python$python_generator.NONE)||"[]",d=a.getFieldValue("TYPE");
a="1"===a.getFieldValue("DIRECTION")?"False":"True";return[b.provideFunction_("lists_sort",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(my_list, type, reverse):
def try_float(s):
try:
return float(s)
except:
return 0
key_funcs = {
"NUMERIC": try_float,
"TEXT": str,
"IGNORE_CASE": lambda s: str(s).lower()
}
key_func = key_funcs[type]
list_cpy = list(my_list)
return sorted(list_cpy, key=key_func, reverse=reverse)
`)+"("+c+', "'+d+'", '+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},lists_split$$module$build$src$generators$python$lists=function(a,b){var c=a.getFieldValue("MODE");if("SPLIT"===c)c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''",a=b.valueToCode(a,"DELIM",Order$$module$build$src$generators$python$python_generator.NONE),a=c+".split("+a+")";else if("JOIN"===c)c=b.valueToCode(a,"INPUT",Order$$module$build$src$generators$python$python_generator.NONE)||
"[]",a=(b.valueToCode(a,"DELIM",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''")+".join("+c+")";else throw Error("Unknown mode: "+c);return[a,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},lists_reverse$$module$build$src$generators$python$lists=function(a,b){return["list(reversed("+(b.valueToCode(a,"LIST",Order$$module$build$src$generators$python$python_generator.NONE)||"[]")+"))",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},
controls_if$$module$build$src$generators$python$logic=function(a,b){let c=0,d="",e,f;b.STATEMENT_PREFIX&&(d+=b.injectId(b.STATEMENT_PREFIX,a));do f=b.valueToCode(a,"IF"+c,Order$$module$build$src$generators$python$python_generator.NONE)||"False",e=b.statementToCode(a,"DO"+c)||b.PASS,b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+=(0===c?"if ":"elif ")+f+":\n"+e,c++;while(a.getInput("IF"+c));if(a.getInput("ELSE")||b.STATEMENT_SUFFIX)e=b.statementToCode(a,"ELSE")||
b.PASS,b.STATEMENT_SUFFIX&&(e=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,a),b.INDENT)+e),d+="else:\n"+e;return d},logic_compare$$module$build$src$generators$python$logic=function(a,b){const c={EQ:"==",NEQ:"!=",LT:"<",LTE:"<=",GT:">",GTE:">="}[a.getFieldValue("OP")],d=Order$$module$build$src$generators$python$python_generator.RELATIONAL,e=b.valueToCode(a,"A",d)||"0";a=b.valueToCode(a,"B",d)||"0";return[e+" "+c+" "+a,d]},logic_operation$$module$build$src$generators$python$logic=function(a,b){const c=
"AND"===a.getFieldValue("OP")?"and":"or",d="and"===c?Order$$module$build$src$generators$python$python_generator.LOGICAL_AND:Order$$module$build$src$generators$python$python_generator.LOGICAL_OR;let e=b.valueToCode(a,"A",d);a=b.valueToCode(a,"B",d);e||a?(b="and"===c?"True":"False",e||(e=b),a||(a=b)):a=e="False";return[e+" "+c+" "+a,d]},logic_negate$$module$build$src$generators$python$logic=function(a,b){return["not "+(b.valueToCode(a,"BOOL",Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT)||
"True"),Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT]},logic_boolean$$module$build$src$generators$python$logic=function(a,b){return["TRUE"===a.getFieldValue("BOOL")?"True":"False",Order$$module$build$src$generators$python$python_generator.ATOMIC]},logic_null$$module$build$src$generators$python$logic=function(a,b){return["None",Order$$module$build$src$generators$python$python_generator.ATOMIC]},logic_ternary$$module$build$src$generators$python$logic=function(a,b){const c=
b.valueToCode(a,"IF",Order$$module$build$src$generators$python$python_generator.CONDITIONAL)||"False",d=b.valueToCode(a,"THEN",Order$$module$build$src$generators$python$python_generator.CONDITIONAL)||"None";a=b.valueToCode(a,"ELSE",Order$$module$build$src$generators$python$python_generator.CONDITIONAL)||"None";return[d+" if "+c+" else "+a,Order$$module$build$src$generators$python$python_generator.CONDITIONAL]},controls_repeat_ext$$module$build$src$generators$python$loops=function(a,b){let c;c=a.getField("TIMES")?
String(parseInt(a.getFieldValue("TIMES"),10)):b.valueToCode(a,"TIMES",Order$$module$build$src$generators$python$python_generator.NONE)||"0";c=$.isNumber$$module$build$src$core$utils$string(c)?parseInt(c,10):"int("+c+")";let d=b.statementToCode(a,"DO");d=b.addLoopTrap(d,a)||b.PASS;return"for "+b.nameDB_.getDistinctName("count",$.NameType$$module$build$src$core$names.VARIABLE)+" in range("+c+"):\n"+d},controls_whileUntil$$module$build$src$generators$python$loops=function(a,b){const c="UNTIL"===a.getFieldValue("MODE");
let d=b.valueToCode(a,"BOOL",c?Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT:Order$$module$build$src$generators$python$python_generator.NONE)||"False",e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a)||b.PASS;c&&(d="not "+d);return"while "+d+":\n"+e},controls_for$$module$build$src$generators$python$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));var d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$python$python_generator.NONE)||"0",e=b.valueToCode(a,
"TO",Order$$module$build$src$generators$python$python_generator.NONE)||"0",f=b.valueToCode(a,"BY",Order$$module$build$src$generators$python$python_generator.NONE)||"1";let g=b.statementToCode(a,"DO");g=b.addLoopTrap(g,a)||b.PASS;let h="";a=function(){return b.provideFunction_("upRange",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
while start <= stop:
yield start
start += abs(step)
`)};const k=function(){return b.provideFunction_("downRange",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(start, stop, step):
while start >= stop:
yield start
start -= abs(step)
`)};if($.isNumber$$module$build$src$core$utils$string(d)&&$.isNumber$$module$build$src$core$utils$string(e)&&$.isNumber$$module$build$src$core$utils$string(f))d=Number(d),e=Number(e),f=Math.abs(Number(f)),0===d%1&&0===e%1&&0===f%1?(d<=e?(e++,a=0===d&&1===f?e:d+", "+e,1!==f&&(a+=", "+f)):(e--,a=d+", "+e+", -"+f),a="range("+a+")"):(a=d<e?a():k(),a+="("+d+", "+e+", "+f+")");else{const l=function(m,n){$.isNumber$$module$build$src$core$utils$string(m)?m=String(Number(m)):m.match(/^\w+$/)||(n=b.nameDB_.getDistinctName(c+
n,$.NameType$$module$build$src$core$names.VARIABLE),h+=n+" = "+m+"\n",m=n);return m};d=l(d,"_start");e=l(e,"_end");f=l(f,"_inc");"number"===typeof d&&"number"===typeof e?(a=d<e?a():k(),a+="("+d+", "+e+", "+f+")"):a="("+d+" <= "+e+") and "+a()+"("+d+", "+e+", "+f+") or "+k()+"("+d+", "+e+", "+f+")"}return h+="for "+c+" in "+a+":\n"+g},controls_forEach$$module$build$src$generators$python$loops=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR")),d=b.valueToCode(a,"LIST",Order$$module$build$src$generators$python$python_generator.RELATIONAL)||
"[]";let e=b.statementToCode(a,"DO");e=b.addLoopTrap(e,a)||b.PASS;return"for "+c+" in "+d+":\n"+e},controls_flow_statements$$module$build$src$generators$python$loops=function(a,b){let c="";b.STATEMENT_PREFIX&&(c+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(c+=b.injectId(b.STATEMENT_SUFFIX,a));if(b.STATEMENT_PREFIX){const d=a.getSurroundLoop();d&&!d.suppressPrefixSuffix&&(c+=b.injectId(b.STATEMENT_PREFIX,d))}switch(a.getFieldValue("FLOW")){case "BREAK":return c+"break\n";case "CONTINUE":return c+
"continue\n"}throw Error("Unknown flow statement.");},math_number$$module$build$src$generators$python$math=function(a,b){a=Number(a.getFieldValue("NUM"));return Infinity===a?['float("inf")',Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]:-Infinity===a?['-float("inf")',Order$$module$build$src$generators$python$python_generator.UNARY_SIGN]:[String(a),0>a?Order$$module$build$src$generators$python$python_generator.UNARY_SIGN:Order$$module$build$src$generators$python$python_generator.ATOMIC]},
math_arithmetic$$module$build$src$generators$python$math=function(a,b){var c={ADD:[" + ",Order$$module$build$src$generators$python$python_generator.ADDITIVE],MINUS:[" - ",Order$$module$build$src$generators$python$python_generator.ADDITIVE],MULTIPLY:[" * ",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE],DIVIDE:[" / ",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE],POWER:[" ** ",Order$$module$build$src$generators$python$python_generator.EXPONENTIATION]}[a.getFieldValue("OP")];
const d=c[0];c=c[1];const e=b.valueToCode(a,"A",c)||"0";a=b.valueToCode(a,"B",c)||"0";return[e+d+a,c]},math_single$$module$build$src$generators$python$math=function(a,b){const c=a.getFieldValue("OP");let d;if("NEG"===c)return d=b.valueToCode(a,"NUM",Order$$module$build$src$generators$python$python_generator.UNARY_SIGN)||"0",["-"+d,Order$$module$build$src$generators$python$python_generator.UNARY_SIGN];b.definitions_.import_math="import math";a="SIN"===c||"COS"===c||"TAN"===c?b.valueToCode(a,"NUM",
Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE)||"0":b.valueToCode(a,"NUM",Order$$module$build$src$generators$python$python_generator.NONE)||"0";switch(c){case "ABS":d="math.fabs("+a+")";break;case "ROOT":d="math.sqrt("+a+")";break;case "LN":d="math.log("+a+")";break;case "LOG10":d="math.log10("+a+")";break;case "EXP":d="math.exp("+a+")";break;case "POW10":d="math.pow(10,"+a+")";break;case "ROUND":d="round("+a+")";break;case "ROUNDUP":d="math.ceil("+a+")";break;case "ROUNDDOWN":d=
"math.floor("+a+")";break;case "SIN":d="math.sin("+a+" / 180.0 * math.pi)";break;case "COS":d="math.cos("+a+" / 180.0 * math.pi)";break;case "TAN":d="math.tan("+a+" / 180.0 * math.pi)"}if(d)return[d,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL];switch(c){case "ASIN":d="math.asin("+a+") / math.pi * 180";break;case "ACOS":d="math.acos("+a+") / math.pi * 180";break;case "ATAN":d="math.atan("+a+") / math.pi * 180";break;default:throw Error("Unknown math operator: "+c);}return[d,
Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},math_constant$$module$build$src$generators$python$math=function(a,b){const c={PI:["math.pi",Order$$module$build$src$generators$python$python_generator.MEMBER],E:["math.e",Order$$module$build$src$generators$python$python_generator.MEMBER],GOLDEN_RATIO:["(1 + math.sqrt(5)) / 2",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE],SQRT2:["math.sqrt(2)",Order$$module$build$src$generators$python$python_generator.MEMBER],
SQRT1_2:["math.sqrt(1.0 / 2)",Order$$module$build$src$generators$python$python_generator.MEMBER],INFINITY:["float('inf')",Order$$module$build$src$generators$python$python_generator.ATOMIC]};a=a.getFieldValue("CONSTANT");"INFINITY"!==a&&(b.definitions_.import_math="import math");return c[a]},math_number_property$$module$build$src$generators$python$math=function(a,b){var c={EVEN:[" % 2 == 0",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE,Order$$module$build$src$generators$python$python_generator.RELATIONAL],
ODD:[" % 2 == 1",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE,Order$$module$build$src$generators$python$python_generator.RELATIONAL],WHOLE:[" % 1 == 0",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE,Order$$module$build$src$generators$python$python_generator.RELATIONAL],POSITIVE:[" > 0",Order$$module$build$src$generators$python$python_generator.RELATIONAL,Order$$module$build$src$generators$python$python_generator.RELATIONAL],NEGATIVE:[" < 0",
Order$$module$build$src$generators$python$python_generator.RELATIONAL,Order$$module$build$src$generators$python$python_generator.RELATIONAL],DIVISIBLE_BY:[null,Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE,Order$$module$build$src$generators$python$python_generator.RELATIONAL],PRIME:[null,Order$$module$build$src$generators$python$python_generator.NONE,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]};const d=a.getFieldValue("PROPERTY"),[e,f,g]=c[d];
c=b.valueToCode(a,"NUMBER_TO_CHECK",f)||"0";if("PRIME"===d)b.definitions_.import_math="import math",b.definitions_.from_numbers_import_Number="from numbers import Number",a=b.provideFunction_("math_isPrime",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(n):
# https://en.wikipedia.org/wiki/Primality_test#Naive_methods
# If n is not a number but a string, try parsing it.
if not isinstance(n, Number):
try:
n = float(n)
except:
return False
if n == 2 or n == 3:
return True
# False if n is negative, is 1, or not whole, or if n is divisible by 2 or 3.
if n <= 1 or n % 1 != 0 or n % 2 == 0 or n % 3 == 0:
return False
# Check all the numbers of form 6k +/- 1, up to sqrt(n).
for x in range(6, int(math.sqrt(n)) + 2, 6):
if n % (x - 1) == 0 or n % (x + 1) == 0:
return False
return True
`)+"("+c+")";else if("DIVISIBLE_BY"===d){a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE)||"0";if("0"===a)return["False",Order$$module$build$src$generators$python$python_generator.ATOMIC];a=c+" % "+a+" == 0"}else a=c+e;return[a,g]},math_change$$module$build$src$generators$python$math=function(a,b){b.definitions_.from_numbers_import_Number="from numbers import Number";const c=b.valueToCode(a,"DELTA",Order$$module$build$src$generators$python$python_generator.ADDITIVE)||
"0";a=b.getVariableName(a.getFieldValue("VAR"));return a+" = ("+a+" if isinstance("+a+", Number) else 0) + "+c+"\n"},math_on_list$$module$build$src$generators$python$math=function(a,b){const c=a.getFieldValue("OP");a=b.valueToCode(a,"LIST",Order$$module$build$src$generators$python$python_generator.NONE)||"[]";switch(c){case "SUM":b="sum("+a+")";break;case "MIN":b="min("+a+")";break;case "MAX":b="max("+a+")";break;case "AVERAGE":b.definitions_.from_numbers_import_Number="from numbers import Number";
b=b.provideFunction_("math_mean",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(myList):
localList = [e for e in myList if isinstance(e, Number)]
if not localList: return
return float(sum(localList)) / len(localList)
`)+"("+a+")";break;case "MEDIAN":b.definitions_.from_numbers_import_Number="from numbers import Number";b=b.provideFunction_("math_median",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(myList):
localList = sorted([e for e in myList if isinstance(e, Number)])
if not localList: return
if len(localList) % 2 == 0:
return (localList[len(localList) // 2 - 1] + localList[len(localList) // 2]) / 2.0
else:
return localList[(len(localList) - 1) // 2]
`)+"("+a+")";break;case "MODE":b=b.provideFunction_("math_modes",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(some_list):
modes = []
# Using a lists of [item, count] to keep count rather than dict
# to avoid "unhashable" errors when the counted item is itself a list or dict.
counts = []
maxCount = 1
for item in some_list:
found = False
for count in counts:
if count[0] == item:
count[1] += 1
maxCount = max(maxCount, count[1])
found = True
if not found:
counts.append([item, 1])
for counted_item, item_count in counts:
if item_count == maxCount:
modes.append(counted_item)
return modes
`)+"("+a+")";break;case "STD_DEV":b.definitions_.import_math="import math";b=b.provideFunction_("math_standard_deviation",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(numbers):
n = len(numbers)
if n == 0: return
mean = float(sum(numbers)) / n
variance = sum((x - mean) ** 2 for x in numbers) / n
return math.sqrt(variance)
`)+"("+a+")";break;case "RANDOM":b.definitions_.import_random="import random";b="random.choice("+a+")";break;default:throw Error("Unknown operator: "+c);}return[b,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},math_modulo$$module$build$src$generators$python$math=function(a,b){const c=b.valueToCode(a,"DIVIDEND",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE)||"0";a=b.valueToCode(a,"DIVISOR",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE)||
"0";return[c+" % "+a,Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},math_constrain$$module$build$src$generators$python$math=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"0",d=b.valueToCode(a,"LOW",Order$$module$build$src$generators$python$python_generator.NONE)||"0";a=b.valueToCode(a,"HIGH",Order$$module$build$src$generators$python$python_generator.NONE)||"float('inf')";return["min(max("+c+", "+d+"), "+
a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},math_random_int$$module$build$src$generators$python$math=function(a,b){b.definitions_.import_random="import random";const c=b.valueToCode(a,"FROM",Order$$module$build$src$generators$python$python_generator.NONE)||"0";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$python$python_generator.NONE)||"0";return["random.randint("+c+", "+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},
math_random_float$$module$build$src$generators$python$math=function(a,b){b.definitions_.import_random="import random";return["random.random()",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},math_atan2$$module$build$src$generators$python$math=function(a,b){b.definitions_.import_math="import math";const c=b.valueToCode(a,"X",Order$$module$build$src$generators$python$python_generator.NONE)||"0";return["math.atan2("+(b.valueToCode(a,"Y",Order$$module$build$src$generators$python$python_generator.NONE)||
"0")+", "+c+") / math.pi * 180",Order$$module$build$src$generators$python$python_generator.MULTIPLICATIVE]},procedures_defreturn$$module$build$src$generators$python$procedures=function(a,b){var c=[],d=a.workspace,e=$.allUsedVarModels$$module$build$src$core$variables(d)||[];for(var f of e)e=f.name,a.getVars().includes(e)||c.push(b.getVariableName(e));d=$.allDeveloperVariables$$module$build$src$core$variables(d);for(f=0;f<d.length;f++)c.push(b.nameDB_.getName(d[f],$.NameType$$module$build$src$core$names.DEVELOPER_VARIABLE));
d=c.length?b.INDENT+"global "+c.join(", ")+"\n":"";c=b.getProcedureName(a.getFieldValue("NAME"));f="";b.STATEMENT_PREFIX&&(f+=b.injectId(b.STATEMENT_PREFIX,a));b.STATEMENT_SUFFIX&&(f+=b.injectId(b.STATEMENT_SUFFIX,a));f&&(f=b.prefixLines(f,b.INDENT));e="";b.INFINITE_LOOP_TRAP&&(e=b.prefixLines(b.injectId(b.INFINITE_LOOP_TRAP,a),b.INDENT));let g="";a.getInput("STACK")&&(g=b.statementToCode(a,"STACK"));let h="";a.getInput("RETURN")&&(h=b.valueToCode(a,"RETURN",Order$$module$build$src$generators$python$python_generator.NONE)||
"");let k="";g&&h&&(k=f);h?h=b.INDENT+"return "+h+"\n":g||(g=b.PASS);const l=[],m=a.getVars();for(let n=0;n<m.length;n++)l[n]=b.getVariableName(m[n]);d="def "+c+"("+l.join(", ")+"):\n"+d+f+e+g+k+h;d=b.scrub_(a,d);b.definitions_["%"+c]=d;return null},procedures_callreturn$$module$build$src$generators$python$procedures=function(a,b){const c=b.getProcedureName(a.getFieldValue("NAME")),d=[],e=a.getVars();for(let f=0;f<e.length;f++)d[f]=b.valueToCode(a,"ARG"+f,Order$$module$build$src$generators$python$python_generator.NONE)||
"None";return[c+"("+d.join(", ")+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},procedures_callnoreturn$$module$build$src$generators$python$procedures=function(a,b){return b.forBlock.procedures_callreturn(a,b)[0]+"\n"},procedures_ifreturn$$module$build$src$generators$python$procedures=function(a,b){let c="if "+(b.valueToCode(a,"CONDITION",Order$$module$build$src$generators$python$python_generator.NONE)||"False")+":\n";b.STATEMENT_SUFFIX&&(c+=b.prefixLines(b.injectId(b.STATEMENT_SUFFIX,
a),b.INDENT));a.hasReturnValue_?(a=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"None",c+=b.INDENT+"return "+a+"\n"):c+=b.INDENT+"return\n";return c},text$$module$build$src$generators$python$text=function(a,b){return[b.quote_(a.getFieldValue("TEXT")),Order$$module$build$src$generators$python$python_generator.ATOMIC]},text_join$$module$build$src$generators$python$text=function(a,b){switch(a.itemCount_){case 0:return["''",Order$$module$build$src$generators$python$python_generator.ATOMIC];
case 1:return a=b.valueToCode(a,"ADD0",Order$$module$build$src$generators$python$python_generator.NONE)||"''",forceString$$module$build$src$generators$python$text(a);case 2:var c=b.valueToCode(a,"ADD0",Order$$module$build$src$generators$python$python_generator.NONE)||"''";a=b.valueToCode(a,"ADD1",Order$$module$build$src$generators$python$python_generator.NONE)||"''";return[forceString$$module$build$src$generators$python$text(c)[0]+" + "+forceString$$module$build$src$generators$python$text(a)[0],Order$$module$build$src$generators$python$python_generator.ADDITIVE];
default:c=[];for(let d=0;d<a.itemCount_;d++)c[d]=b.valueToCode(a,"ADD"+d,Order$$module$build$src$generators$python$python_generator.NONE)||"''";a=b.nameDB_.getDistinctName("x",$.NameType$$module$build$src$core$names.VARIABLE);return["''.join([str("+a+") for "+a+" in ["+c.join(", ")+"]])",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]}},text_append$$module$build$src$generators$python$text=function(a,b){const c=b.getVariableName(a.getFieldValue("VAR"));a=b.valueToCode(a,"TEXT",
Order$$module$build$src$generators$python$python_generator.NONE)||"''";return c+" = str("+c+") + "+forceString$$module$build$src$generators$python$text(a)[0]+"\n"},text_length$$module$build$src$generators$python$text=function(a,b){return["len("+(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''")+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_isEmpty$$module$build$src$generators$python$text=function(a,b){return["not len("+
(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"''")+")",Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT]},text_indexOf$$module$build$src$generators$python$text=function(a,b){const c="FIRST"===a.getFieldValue("END")?"find":"rfind",d=b.valueToCode(a,"FIND",Order$$module$build$src$generators$python$python_generator.NONE)||"''";b=(b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''")+"."+c+
"("+d+")";return a.workspace.options.oneBasedIndex?[b+" + 1",Order$$module$build$src$generators$python$python_generator.ADDITIVE]:[b,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_charAt$$module$build$src$generators$python$text=function(a,b){const c=a.getFieldValue("WHERE")||"FROM_START",d=b.valueToCode(a,"VALUE","RANDOM"===c?Order$$module$build$src$generators$python$python_generator.NONE:Order$$module$build$src$generators$python$python_generator.MEMBER)||"''";switch(c){case "FIRST":return[d+
"[0]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "LAST":return[d+"[-1]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "FROM_START":return a=b.getAdjustedInt(a,"AT"),[d+"["+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "FROM_END":return a=b.getAdjustedInt(a,"AT",1,!0),[d+"["+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER];case "RANDOM":return b.definitions_.import_random="import random",
[b.provideFunction_("text_random_letter",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(text):
x = int(random.random() * len(text))
return text[x]
`)+"("+d+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]}throw Error("Unhandled option (text_charAt).");},text_getSubstring$$module$build$src$generators$python$text=function(a,b){var c=a.getFieldValue("WHERE1");const d=a.getFieldValue("WHERE2"),e=b.valueToCode(a,"STRING",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''";switch(c){case "FROM_START":c=b.getAdjustedInt(a,"AT1");0===c&&(c="");break;case "FROM_END":c=b.getAdjustedInt(a,"AT1",1,!0);break;
case "FIRST":c="";break;default:throw Error("Unhandled option (text_getSubstring)");}switch(d){case "FROM_START":a=b.getAdjustedInt(a,"AT2",1);break;case "FROM_END":a=b.getAdjustedInt(a,"AT2",0,!0);$.isNumber$$module$build$src$core$utils$string(String(a))?0===a&&(a=""):(b.definitions_.import_sys="import sys",a+=" or sys.maxsize");break;case "LAST":a="";break;default:throw Error("Unhandled option (text_getSubstring)");}return[e+"["+c+" : "+a+"]",Order$$module$build$src$generators$python$python_generator.MEMBER]},
text_changeCase$$module$build$src$generators$python$text=function(a,b){const c={UPPERCASE:".upper()",LOWERCASE:".lower()",TITLECASE:".title()"}[a.getFieldValue("CASE")];return[(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''")+c,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_trim$$module$build$src$generators$python$text=function(a,b){const c={LEFT:".lstrip()",RIGHT:".rstrip()",BOTH:".strip()"}[a.getFieldValue("MODE")];
return[(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''")+c,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_print$$module$build$src$generators$python$text=function(a,b){return"print("+(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.NONE)||"''")+")\n"},text_prompt_ext$$module$build$src$generators$python$text=function(a,b){var c=b.provideFunction_("text_prompt",`
def ${b.FUNCTION_NAME_PLACEHOLDER_}(msg):
try:
return raw_input(msg)
except NameError:
return input(msg)
`);b=a.getField("TEXT")?b.quote_(a.getFieldValue("TEXT")):b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.NONE)||"''";c=c+"("+b+")";"NUMBER"===a.getFieldValue("TYPE")&&(c="float("+c+")");return[c,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_count$$module$build$src$generators$python$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''";a=b.valueToCode(a,"SUB",Order$$module$build$src$generators$python$python_generator.NONE)||
"''";return[c+".count("+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_replace$$module$build$src$generators$python$text=function(a,b){const c=b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''",d=b.valueToCode(a,"FROM",Order$$module$build$src$generators$python$python_generator.NONE)||"''";a=b.valueToCode(a,"TO",Order$$module$build$src$generators$python$python_generator.NONE)||"''";return[c+".replace("+d+", "+a+")",
Order$$module$build$src$generators$python$python_generator.MEMBER]},text_reverse$$module$build$src$generators$python$text=function(a,b){return[(b.valueToCode(a,"TEXT",Order$$module$build$src$generators$python$python_generator.MEMBER)||"''")+"[::-1]",Order$$module$build$src$generators$python$python_generator.MEMBER]},variables_get$$module$build$src$generators$python$variables=function(a,b){return[b.getVariableName(a.getFieldValue("VAR")),Order$$module$build$src$generators$python$python_generator.ATOMIC]},
variables_set$$module$build$src$generators$python$variables=function(a,b){const c=b.valueToCode(a,"VALUE",Order$$module$build$src$generators$python$python_generator.NONE)||"0";return b.getVariableName(a.getFieldValue("VAR"))+" = "+c+"\n"},Order$$module$build$src$generators$python$python_generator;
(function(a){a[a.ATOMIC=0]="ATOMIC";a[a.COLLECTION=1]="COLLECTION";a[a.STRING_CONVERSION=1]="STRING_CONVERSION";a[a.MEMBER=2.1]="MEMBER";a[a.FUNCTION_CALL=2.2]="FUNCTION_CALL";a[a.EXPONENTIATION=3]="EXPONENTIATION";a[a.UNARY_SIGN=4]="UNARY_SIGN";a[a.BITWISE_NOT=4]="BITWISE_NOT";a[a.MULTIPLICATIVE=5]="MULTIPLICATIVE";a[a.ADDITIVE=6]="ADDITIVE";a[a.BITWISE_SHIFT=7]="BITWISE_SHIFT";a[a.BITWISE_AND=8]="BITWISE_AND";a[a.BITWISE_XOR=9]="BITWISE_XOR";a[a.BITWISE_OR=10]="BITWISE_OR";a[a.RELATIONAL=11]="RELATIONAL";
a[a.LOGICAL_NOT=12]="LOGICAL_NOT";a[a.LOGICAL_AND=13]="LOGICAL_AND";a[a.LOGICAL_OR=14]="LOGICAL_OR";a[a.CONDITIONAL=15]="CONDITIONAL";a[a.LAMBDA=16]="LAMBDA";a[a.NONE=99]="NONE"})(Order$$module$build$src$generators$python$python_generator||(Order$$module$build$src$generators$python$python_generator={}));
var PythonGenerator$$module$build$src$generators$python$python_generator=class extends $.CodeGenerator$$module$build$src$core$generator{constructor(a="Python"){super(a);this.ORDER_OVERRIDES=[[Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL,Order$$module$build$src$generators$python$python_generator.MEMBER],[Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL],[Order$$module$build$src$generators$python$python_generator.MEMBER,
Order$$module$build$src$generators$python$python_generator.MEMBER],[Order$$module$build$src$generators$python$python_generator.MEMBER,Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL],[Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT,Order$$module$build$src$generators$python$python_generator.LOGICAL_NOT],[Order$$module$build$src$generators$python$python_generator.LOGICAL_AND,Order$$module$build$src$generators$python$python_generator.LOGICAL_AND],[Order$$module$build$src$generators$python$python_generator.LOGICAL_OR,
Order$$module$build$src$generators$python$python_generator.LOGICAL_OR]];this.PASS="";this.isInitialized=!1;for(const b in Order$$module$build$src$generators$python$python_generator)a=Order$$module$build$src$generators$python$python_generator[b],"string"!==typeof a&&(this["ORDER_"+b]=a);this.addReservedWords("False,None,True,and,as,assert,break,class,continue,def,del,elif,else,except,exec,finally,for,from,global,if,import,in,is,lambda,nonlocal,not,or,pass,print,raise,return,try,while,with,yield,NotImplemented,Ellipsis,__debug__,quit,exit,copyright,license,credits,ArithmeticError,AssertionError,AttributeError,BaseException,BlockingIOError,BrokenPipeError,BufferError,BytesWarning,ChildProcessError,ConnectionAbortedError,ConnectionError,ConnectionRefusedError,ConnectionResetError,DeprecationWarning,EOFError,Ellipsis,EnvironmentError,Exception,FileExistsError,FileNotFoundError,FloatingPointError,FutureWarning,GeneratorExit,IOError,ImportError,ImportWarning,IndentationError,IndexError,InterruptedError,IsADirectoryError,KeyError,KeyboardInterrupt,LookupError,MemoryError,ModuleNotFoundError,NameError,NotADirectoryError,NotImplemented,NotImplementedError,OSError,OverflowError,PendingDeprecationWarning,PermissionError,ProcessLookupError,RecursionError,ReferenceError,ResourceWarning,RuntimeError,RuntimeWarning,StandardError,StopAsyncIteration,StopIteration,SyntaxError,SyntaxWarning,SystemError,SystemExit,TabError,TimeoutError,TypeError,UnboundLocalError,UnicodeDecodeError,UnicodeEncodeError,UnicodeError,UnicodeTranslateError,UnicodeWarning,UserWarning,ValueError,Warning,ZeroDivisionError,_,__build_class__,__debug__,__doc__,__import__,__loader__,__name__,__package__,__spec__,abs,all,any,apply,ascii,basestring,bin,bool,buffer,bytearray,bytes,callable,chr,classmethod,cmp,coerce,compile,complex,copyright,credits,delattr,dict,dir,divmod,enumerate,eval,exec,execfile,exit,file,filter,float,format,frozenset,getattr,globals,hasattr,hash,help,hex,id,input,int,intern,isinstance,issubclass,iter,len,license,list,locals,long,map,max,memoryview,min,next,object,oct,open,ord,pow,print,property,quit,range,raw_input,reduce,reload,repr,reversed,round,set,setattr,slice,sorted,staticmethod,str,sum,super,tuple,type,unichr,unicode,vars,xrange,zip")}init(a){super.init(a);
this.PASS=this.INDENT+"pass\n";this.nameDB_?this.nameDB_.reset():this.nameDB_=new $.Names$$module$build$src$core$names(this.RESERVED_WORDS_);this.nameDB_.setVariableMap(a.getVariableMap());this.nameDB_.populateVariables(a);this.nameDB_.populateProcedures(a);const b=[];var c=$.allDeveloperVariables$$module$build$src$core$variables(a);for(let d=0;d<c.length;d++)b.push(this.nameDB_.getName(c[d],$.Names$$module$build$src$core$names.DEVELOPER_VARIABLE_TYPE)+" = None");a=$.allUsedVarModels$$module$build$src$core$variables(a);
for(c=0;c<a.length;c++)b.push(this.getVariableName(a[c].getId())+" = None");this.definitions_.variables=b.join("\n");this.isInitialized=!0}finish(a){const b=[],c=[];for(let d in this.definitions_){const e=this.definitions_[d];e.match(/^(from\s+\S+\s+)?import\s+\S+/)?b.push(e):c.push(e)}a=super.finish(a);this.isInitialized=!1;this.nameDB_.reset();return(b.join("\n")+"\n\n"+c.join("\n\n")).replace(/\n\n+/g,"\n\n").replace(/\n*$/,"\n\n\n")+a}scrubNakedValue(a){return a+"\n"}quote_(a){a=a.replace(/\\/g,
"\\\\").replace(/\n/g,"\\\n");let b="'";a.includes("'")&&(a.includes('"')?a=a.replace(/'/g,"\\'"):b='"');return b+a+b}multiline_quote_(a){return a.split(/\n/g).map(this.quote_).join(" + '\\n' + \n")}scrub_(a,b,c=!1){let d="";if(!a.outputConnection||!a.outputConnection.targetConnection){var e=a.getCommentText();e&&(e=$.wrap$$module$build$src$core$utils$string(e,this.COMMENT_WRAP-3),d+=this.prefixLines(e+"\n","# "));for(let f=0;f<a.inputList.length;f++)a.inputList[f].type===$.inputTypes$$module$build$src$core$inputs$input_types.VALUE&&
(e=a.inputList[f].connection.targetBlock())&&(e=this.allNestedComments(e))&&(d+=this.prefixLines(e,"# "))}a=a.nextConnection&&a.nextConnection.targetBlock();c=c?"":this.blockToCode(a);return d+b+c}getAdjustedInt(a,b,c=0,d=!1){a.workspace.options.oneBasedIndex&&c--;const e=a.workspace.options.oneBasedIndex?"1":"0";a=this.valueToCode(a,b,c?Order$$module$build$src$generators$python$python_generator.ADDITIVE:Order$$module$build$src$generators$python$python_generator.NONE)||e;$.isNumber$$module$build$src$core$utils$string(a)?
(a=parseInt(a,10)+c,d&&(a=-a)):(a=0<c?"int("+a+" + "+c+")":0>c?"int("+a+" - "+-c+")":"int("+a+")",d&&(a="-"+a));return a}},module$build$src$generators$python$python_generator={};module$build$src$generators$python$python_generator.Order=Order$$module$build$src$generators$python$python_generator;module$build$src$generators$python$python_generator.PythonGenerator=PythonGenerator$$module$build$src$generators$python$python_generator;var module$build$src$generators$python$lists={};module$build$src$generators$python$lists.lists_create_empty=lists_create_empty$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_create_with=lists_create_with$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_getIndex=lists_getIndex$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_getSublist=lists_getSublist$$module$build$src$generators$python$lists;
module$build$src$generators$python$lists.lists_indexOf=lists_indexOf$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_isEmpty=lists_isEmpty$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_length=lists_length$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_repeat=lists_repeat$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_reverse=lists_reverse$$module$build$src$generators$python$lists;
module$build$src$generators$python$lists.lists_setIndex=lists_setIndex$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_sort=lists_sort$$module$build$src$generators$python$lists;module$build$src$generators$python$lists.lists_split=lists_split$$module$build$src$generators$python$lists;var controls_ifelse$$module$build$src$generators$python$logic=controls_if$$module$build$src$generators$python$logic,module$build$src$generators$python$logic={};module$build$src$generators$python$logic.controls_if=controls_if$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.controls_ifelse=controls_if$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_boolean=logic_boolean$$module$build$src$generators$python$logic;
module$build$src$generators$python$logic.logic_compare=logic_compare$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_negate=logic_negate$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_null=logic_null$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_operation=logic_operation$$module$build$src$generators$python$logic;module$build$src$generators$python$logic.logic_ternary=logic_ternary$$module$build$src$generators$python$logic;var controls_repeat$$module$build$src$generators$python$loops=controls_repeat_ext$$module$build$src$generators$python$loops,module$build$src$generators$python$loops={};module$build$src$generators$python$loops.controls_flow_statements=controls_flow_statements$$module$build$src$generators$python$loops;module$build$src$generators$python$loops.controls_for=controls_for$$module$build$src$generators$python$loops;module$build$src$generators$python$loops.controls_forEach=controls_forEach$$module$build$src$generators$python$loops;
module$build$src$generators$python$loops.controls_repeat=controls_repeat_ext$$module$build$src$generators$python$loops;module$build$src$generators$python$loops.controls_repeat_ext=controls_repeat_ext$$module$build$src$generators$python$loops;module$build$src$generators$python$loops.controls_whileUntil=controls_whileUntil$$module$build$src$generators$python$loops;var math_round$$module$build$src$generators$python$math=math_single$$module$build$src$generators$python$math,math_trig$$module$build$src$generators$python$math=math_single$$module$build$src$generators$python$math,module$build$src$generators$python$math={};module$build$src$generators$python$math.math_arithmetic=math_arithmetic$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_atan2=math_atan2$$module$build$src$generators$python$math;
module$build$src$generators$python$math.math_change=math_change$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_constant=math_constant$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_constrain=math_constrain$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_modulo=math_modulo$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_number=math_number$$module$build$src$generators$python$math;
module$build$src$generators$python$math.math_number_property=math_number_property$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_on_list=math_on_list$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_random_float=math_random_float$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_random_int=math_random_int$$module$build$src$generators$python$math;
module$build$src$generators$python$math.math_round=math_single$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_single=math_single$$module$build$src$generators$python$math;module$build$src$generators$python$math.math_trig=math_single$$module$build$src$generators$python$math;var procedures_defnoreturn$$module$build$src$generators$python$procedures=procedures_defreturn$$module$build$src$generators$python$procedures,module$build$src$generators$python$procedures={};module$build$src$generators$python$procedures.procedures_callnoreturn=procedures_callnoreturn$$module$build$src$generators$python$procedures;module$build$src$generators$python$procedures.procedures_callreturn=procedures_callreturn$$module$build$src$generators$python$procedures;
module$build$src$generators$python$procedures.procedures_defnoreturn=procedures_defreturn$$module$build$src$generators$python$procedures;module$build$src$generators$python$procedures.procedures_defreturn=procedures_defreturn$$module$build$src$generators$python$procedures;module$build$src$generators$python$procedures.procedures_ifreturn=procedures_ifreturn$$module$build$src$generators$python$procedures;var strRegExp$$module$build$src$generators$python$text=/^\s*'([^']|\\')*'\s*$/,forceString$$module$build$src$generators$python$text=function(a){return strRegExp$$module$build$src$generators$python$text.test(a)?[a,Order$$module$build$src$generators$python$python_generator.ATOMIC]:["str("+a+")",Order$$module$build$src$generators$python$python_generator.FUNCTION_CALL]},text_prompt$$module$build$src$generators$python$text=text_prompt_ext$$module$build$src$generators$python$text,module$build$src$generators$python$text=
{};module$build$src$generators$python$text.text=text$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_append=text_append$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_changeCase=text_changeCase$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_charAt=text_charAt$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_count=text_count$$module$build$src$generators$python$text;
module$build$src$generators$python$text.text_getSubstring=text_getSubstring$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_indexOf=text_indexOf$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_isEmpty=text_isEmpty$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_join=text_join$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_length=text_length$$module$build$src$generators$python$text;
module$build$src$generators$python$text.text_print=text_print$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_prompt=text_prompt_ext$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_prompt_ext=text_prompt_ext$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_replace=text_replace$$module$build$src$generators$python$text;module$build$src$generators$python$text.text_reverse=text_reverse$$module$build$src$generators$python$text;
module$build$src$generators$python$text.text_trim=text_trim$$module$build$src$generators$python$text;var module$build$src$generators$python$variables={};module$build$src$generators$python$variables.variables_get=variables_get$$module$build$src$generators$python$variables;module$build$src$generators$python$variables.variables_set=variables_set$$module$build$src$generators$python$variables;var module$build$src$generators$python$variables_dynamic={};module$build$src$generators$python$variables_dynamic.variables_get_dynamic=variables_get$$module$build$src$generators$python$variables;module$build$src$generators$python$variables_dynamic.variables_set_dynamic=variables_set$$module$build$src$generators$python$variables;var pythonGenerator$$module$build$src$generators$python=new PythonGenerator$$module$build$src$generators$python$python_generator;pythonGenerator$$module$build$src$generators$python.addReservedWords("math,random,Number");
var generators$$module$build$src$generators$python=Object.assign({},module$build$src$generators$python$lists,module$build$src$generators$python$logic,module$build$src$generators$python$loops,module$build$src$generators$python$math,module$build$src$generators$python$procedures,module$build$src$generators$python$text,module$build$src$generators$python$variables,module$build$src$generators$python$variables_dynamic);
for(const a in generators$$module$build$src$generators$python)pythonGenerator$$module$build$src$generators$python.forBlock[a]=generators$$module$build$src$generators$python[a];var module$build$src$generators$python={};module$build$src$generators$python.Order=Order$$module$build$src$generators$python$python_generator;module$build$src$generators$python.PythonGenerator=PythonGenerator$$module$build$src$generators$python$python_generator;module$build$src$generators$python.pythonGenerator=pythonGenerator$$module$build$src$generators$python;
module$build$src$generators$python.__namespace__=$;
return module$build$src$generators$python;
}));
//# sourceMappingURL=python_compressed.js.map