@@ -1305,51 +1305,6 @@ Yet another is that there is an internal error. The internal error message is:
13051305 }
13061306 }
13071307
1308- async checkPythonSyntax ( ) {
1309- let code = this . editor . getValue ( ) ;
1310- fetch ( '/ns/coach/python_check' , {
1311- method : 'POST' ,
1312- body : code
1313- } )
1314- . then ( ( response ) => {
1315- return response . json ( ) ;
1316- } )
1317- . then ( ( data ) => {
1318- if ( data . trim ( ) !== '' ) {
1319- //clean up returned text
1320- let errorLines = data . split ( "\n" ) ;
1321- let codeLines = code . split ( "\n" ) ;
1322- let message = "" ;
1323- for ( let line of errorLines ) {
1324- if ( line . indexOf ( ".py:" ) != - 1 ) {
1325- //old pyflakes returns "file:line:col error"
1326- //new pyflakes returns "file:line:col: error"
1327- //handle either
1328- const cleaner = / [ ^ . ] * .p y : ( \d + ) : ( \d + ) : ? ( .* ) / i;
1329- let lineParts = line . match ( cleaner )
1330- message += "Line " + lineParts [ 1 ] + ": " + lineParts [ 3 ] + "\n" ;
1331- message += codeLines [ lineParts [ 1 ] - 1 ] + "\n" ;
1332- message += " " . repeat ( lineParts [ 2 ] - 1 ) + "^\n" ;
1333- } else {
1334- message += line + "\n" ;
1335- }
1336- }
1337- message = message . slice ( 0 , - 1 ) ; //remove trailing newline
1338-
1339- //Render
1340- let checkDiv = document . createElement ( "div" ) ;
1341- checkDiv . classList . add ( "python_check_results" ) ;
1342- let checkPre = checkDiv . appendChild ( document . createElement ( "pre" ) ) ;
1343- checkPre . textContent = message ;
1344- this . codecoach . append ( checkDiv ) ;
1345- $ ( this . codecoach ) . css ( "display" , "block" ) ;
1346- }
1347- } )
1348- . catch ( err => {
1349- console . log ( "Error with ajax python check:" , err ) ;
1350- } ) ;
1351- }
1352-
13531308 /* runProg has several async elements to it.
13541309 * 1. Skulpt runs the python program asynchronously
13551310 * 2. The history is restored asynchronously
0 commit comments