Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 30982ff

Browse files
Remove old checkPythonSyntax
1 parent bd74a56 commit 30982ff

File tree

1 file changed

+0
-45
lines changed

1 file changed

+0
-45
lines changed

runestone/activecode/js/activecode.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -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 = /[^.]*.py:(\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

Comments
 (0)