Skip to content

Commit

Permalink
Keras model update
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhvani Patel committed Jul 19, 2017
1 parent 47216ce commit 74aea82
Show file tree
Hide file tree
Showing 15 changed files with 305 additions and 334 deletions.
Binary file modified __pycache__/toCheck.pypy-41.pyc
Binary file not shown.
Binary file modified __pycache__/toCheckD.pypy-41.pyc
Binary file not shown.
Binary file modified __pycache__/toCheckI.pypy-41.pyc
Binary file not shown.
Binary file modified __pycache__/toCheckS.pypy-41.pyc
Binary file not shown.
168 changes: 0 additions & 168 deletions check_pypy_syntax.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,174 +34,6 @@ def find_nth(haystack, needle, n):
n -= 1
return start

# Main method
def checkPyPySyntaxDel(src):
myFile = open("toCheckD.py", "w")
myFile.write(src)
myFile.close()
proc = subprocess.Popen(['pypy', '-m', 'py_compile', 'toCheckD.py'], stderr=subprocess.PIPE)
streamdata, err = proc.communicate()
rc = proc.returncode
if rc == 0:
# No errors, all good
if os.path.isfile("toCheckD.py") == True:
os.remove("toCheckD.py")
return None
else:
# Error, disect data for constructor
fileBegInd = find_nth(err, 'File ', 1)
fileEndInd = find_nth(err, ',', 1)
lineInd = find_nth(err, 'line ', 1)

nextLineInd = find_nth(err, '\n', 1)


add = err[lineInd+5:nextLineInd]
add = re.sub("[^0-9]", "", add)
if(add == ''):
add = '-1'
line = int(add)

textInd = find_nth(err, ' ', 1)
temp2 = err[textInd+4:]


nextLineIndTemp = find_nth(temp2, ' ', 1)
textAfter = err[textInd+4:nextLineIndTemp+textInd+3]

fileName = err[fileBegInd+6:fileEndInd-1]

colon = ':'

textBeforeInd = err.rfind(colon.encode())
textBefore = err[textBeforeInd+2:]
textBefore = textBefore.strip()

colonTwo = ':'

text = textBefore + colon.encode() + textAfter

cutoffInd = find_nth(err, '^', 1)
errorname = err[cutoffInd+2:textBeforeInd]

errorObj = CompileError(fileName, line, None, None, text, errorname)
if os.path.isfile("toCheckD.py") == True:
os.remove("toCheckD.py")
return [errorObj]


# Main method
def checkPyPySyntaxIns(src):
myFile = open("toCheckI.py", "w")
myFile.write(src)
myFile.close()
proc = subprocess.Popen(['pypy', '-m', 'py_compile', 'toCheckI.py'], stderr=subprocess.PIPE)
streamdata, err = proc.communicate()
rc = proc.returncode
if rc == 0:
# No errors, all good
if os.path.isfile("toCheckI.py") == True:
os.remove("toCheckI.py")
return None
else:
# Error, disect data for constructor
fileBegInd = find_nth(err, 'File ', 1)
fileEndInd = find_nth(err, ',', 1)
lineInd = find_nth(err, 'line ', 1)

nextLineInd = find_nth(err, '\n', 1)


add = err[lineInd+5:nextLineInd]
add = re.sub("[^0-9]", "", add)
if(add == ''):
add = '-1'
line = int(add)

textInd = find_nth(err, ' ', 1)
temp2 = err[textInd+4:]


nextLineIndTemp = find_nth(temp2, ' ', 1)
textAfter = err[textInd+4:nextLineIndTemp+textInd+3]

fileName = err[fileBegInd+6:fileEndInd-1]

colon = ':'

textBeforeInd = err.rfind(colon.encode())
textBefore = err[textBeforeInd+2:]
textBefore = textBefore.strip()

colonTwo = ':'

text = textBefore + colon.encode() + textAfter

cutoffInd = find_nth(err, '^', 1)
errorname = err[cutoffInd+2:textBeforeInd]

errorObj = CompileError(fileName, line, None, None, text, errorname)
if os.path.isfile("toCheckI.py") == True:
os.remove("toCheckI.py")
return [errorObj]

# Main method
def checkPyPySyntaxSub(src):
myFile = open("toCheckS.py", "w")
myFile.write(src)
myFile.close()
proc = subprocess.Popen(['pypy', '-m', 'py_compile', 'toCheckS.py'], stderr=subprocess.PIPE)
streamdata, err = proc.communicate()
rc = proc.returncode
if rc == 0:
# No errors, all good
if os.path.isfile("toCheckS.py") == True:
os.remove("toCheckS.py")
return None
else:
# Error, disect data for constructor
fileBegInd = find_nth(err, 'File ', 1)
fileEndInd = find_nth(err, ',', 1)
lineInd = find_nth(err, 'line ', 1)

nextLineInd = find_nth(err, '\n', 1)


add = err[lineInd+5:nextLineInd]
add = re.sub("[^0-9]", "", add)
if(add == ''):
add = '-1'
line = int(add)

textInd = find_nth(err, ' ', 1)
temp2 = err[textInd+4:]


nextLineIndTemp = find_nth(temp2, ' ', 1)
textAfter = err[textInd+4:nextLineIndTemp+textInd+3]

fileName = err[fileBegInd+6:fileEndInd-1]

colon = ':'

textBeforeInd = err.rfind(colon.encode())
textBefore = err[textBeforeInd+2:]
textBefore = textBefore.strip()

colonTwo = ':'

text = textBefore + colon.encode() + textAfter

cutoffInd = find_nth(err, '^', 1)
errorname = err[cutoffInd+2:textBeforeInd]

errorObj = CompileError(fileName, line, None, None, text, errorname)
if os.path.isfile("toCheckS.py") == True:
os.remove("toCheckS.py")
return [errorObj]



# Main method
def checkPyPySyntax(src):
myFile = open("toCheck.py", "w")
Expand Down
Binary file modified check_pypy_syntax.pyc
Binary file not shown.
Loading

0 comments on commit 74aea82

Please sign in to comment.