prompt
large_stringlengths 72
9.34k
| completion
large_stringlengths 0
7.61k
|
---|---|
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
<|fim_middle|>
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | charCount = charCount + 1
print operandCount, " 1" |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
<|fim_middle|>
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | numCount = numCount + 1
print operandCount, " 2" |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
<|fim_middle|>
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print 'TRUE' |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
<|fim_middle|>
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
<|fim_middle|>
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print "invalid expression"
print "1"
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
<|fim_middle|>
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
<|fim_middle|>
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
<|fim_middle|>
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print 'invalid expression'
print '2'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
<|fim_middle|>
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
<|fim_middle|>
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print 'invalid expression'
print '3'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
<|fim_middle|>
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
<|fim_middle|>
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
<|fim_middle|>
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
<|fim_middle|>
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
<|fim_middle|>
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print 'invalid expression'
print '4'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
<|fim_middle|>
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | entryBracketCount = entryBracketCount + 1
print operandCount, " 4" |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
<|fim_middle|>
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
<|fim_middle|>
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | continue |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
<|fim_middle|>
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
<|fim_middle|>
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print 'invalid expression'
print '5'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
<|fim_middle|>
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print "invalid expression"
print '6'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
<|fim_middle|>
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
print "valid expression"
<|fim▁end|> | print operandCount
print "invalid expression"
print '7'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
<|fim_middle|>
else:
print "valid expression"
<|fim▁end|> | print "invalid expression"
print '8'
exit(0) |
<|file_name|>parseTest.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
import re
userInput = raw_input("input equation\n")
numCount = 0
operandCount = 0
entryBracketCount = 0
exitBracketCount = 0
charCount = 0
endOfLine = len(userInput) - 1
for i in range(len(userInput)):
if (re.search('[\s*a-z\s*A-Z]+', userInput[i])):
charCount = charCount + 1
print operandCount, " 1"
elif (re.search('[\s*0-9]+', userInput[i])):
numCount = numCount + 1
print operandCount, " 2"
elif (re.search('[\*]', userInput[i])):
print 'TRUE'
# operandCount = operandCount + 1
# print operandCount, " 3.5"
# elif (re.search('[\s*\+|\s*\-|\s*\/]+', userInput[i])):
elif (re.search('[+-/*]+', userInput[i])):
operandCount = operandCount + 1
print operandCount, " 3"
# if(re.search('[\s*\+|\s*\-|\s*\/]+', userInput[endOfLine])):
if(re.search('[+-/*]+', userInput[endOfLine])):
print "invalid expression"
print "1"
exit(0)
else:
if((re.search('[\s*a-zA-Z]+', userInput[i - 1])) or (re.search('[\s*\d]+', userInput[i - 1]))):
continue
else:
print 'invalid expression'
print '2'
exit(0)
if(re.search('[\s*\d]+', userInput[i - 1])):
continue
else:
print 'invalid expression'
print '3'
exit(0)
if(re.search('[\s*a-zA-Z]+', userInput[i + 1])):
continue
elif(re.search('[\s*\d]+', userInput[i + 1])):
continue
elif (re.search('[\(]+', userInput[i + 1])):
continue
elif (re.search('[\)]+', userInput[i + 1])):
continue
else:
print 'invalid expression'
print '4'
exit(0)
elif (re.search('[\(]+', userInput[i])):
entryBracketCount = entryBracketCount + 1
print operandCount, " 4"
elif (re.search('[\)]+', userInput[i])):
exitBracketCount = exitBracketCount + 1
print operandCount, " 5"
if(re.search('[\)]+', userInput[endOfLine])):
continue
else:
if(re.search('[\(]+', userInput[i + 1])):
print 'invalid expression'
print '5'
exit(0)
print operandCount, " 6"
if (entryBracketCount != exitBracketCount):
print "invalid expression"
print '6'
exit(0)
elif operandCount == 0:
print operandCount
print "invalid expression"
print '7'
exit(0)
elif ((numCount == 0) and (charCount == 0)):
print "invalid expression"
print '8'
exit(0)
else:
<|fim_middle|>
<|fim▁end|> | print "valid expression" |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):<|fim▁hole|> def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | print func.__name__ |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
<|fim_middle|>
_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | """对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, <|fim_middle|>
r
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorato |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
<|fim_middle|>
pper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wra |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
<|fim_middle|>
装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的 |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
<|fim_middle|>
g(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_loggin |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while re<|fim_middle|>
corator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | try < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return de |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):<|fim_middle|>
"warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> |
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level= |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwa<|fim_middle|>
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | rgs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
|
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s<|fim_middle|>
ame__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | , %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __n |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim_middle|>
<|fim▁end|> | |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
<|fim_middle|>
pper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | return _wra |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += time <|fim_middle|>
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | out
|
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__na <|fim_middle|>
rint ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | me__))
elif level == "info":
p |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__na <|fim_middle|>
turn wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | me__))
return func(*args, **kwargs)
re |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
<|fim_middle|>
<|fim▁end|> | print("i am %s" % name)
foo() |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def <|fim_middle|>(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | retries |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
<|fim_middle|>_wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | def |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw<|fim_middle|> att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | ):
|
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retrie<|fim_middle|>:
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | s(times=3, timeout=2) |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(<|fim_middle|>kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | *args, ** |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att<|fim_middle|>= 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | , retry |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
<|fim_middle|>orator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | def dec |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
<|fim_middle|>per(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | def wrap |
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "w<|fim_middle|> print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
foo()<|fim▁end|> | arn":
|
<|file_name|>decorator.py<|end_file_name|><|fim▁begin|>#!-*- coding:utf-8 -*-
import time
def retries(times=3, timeout=1):
"""对未捕获异常进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
try:
return func(*args, **kw)
except:
att += timeout
if retry < times:
time.sleep(att)
return _wrapper
return decorator
def empty_content_retries(times=3, timeout=2):
"""响应为空的进行重试"""
def decorator(func):
def _wrapper(*args, **kw):
att, retry = 0, 0
while retry < times:
retry += 1
ret = func(*args, **kw)
if ret:
return ret
att += timeout
time.sleep(att)
return _wrapper
return decorator
def use_logging(level):
"""带参数的装饰器"""
def decorator(func):
print func.__name__
def wrapper(*args, **kwargs):
if level == "warn":
print ("level:%s, %s is running" % (level, func.__name__))
elif level == "info":
print ("level:%s, %s is running" % (level, func.__name__))
return func(*args, **kwargs)
return wrapper
return decorator
if __name__ == "__main__":
@use_logging(level="warn")
def foo(name='foo'):
print("i am %s" % name)
<|fim_middle|>o()<|fim▁end|> | fo |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)<|fim▁hole|> #process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()<|fim▁end|> | |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
<|fim_middle|>
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
<|fim_middle|>
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
<|fim_middle|>
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print "" |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
<|fim_middle|>
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print "" |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
<|fim_middle|>
if __name__ == "__main__":
main()
<|fim▁end|> | parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args() |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
<|fim_middle|>
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | not_found = 0;
break; |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
<|fim_middle|>
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | continue; |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
<|fim_middle|>
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | continue |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
<|fim_middle|>
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | not_found = 0;
break; |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
<|fim_middle|>
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | continue; |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
<|fim_middle|>
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1 |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
<|fim_middle|>
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
<|fim_middle|>
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1 |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
<|fim_middle|>
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | break |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
<|fim_middle|>
<|fim▁end|> | main() |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def <|fim_middle|>(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | __call__ |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def <|fim_middle|>(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def main():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | __call__ |
<|file_name|>official.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
#CHANGE ONLY, IF YOU KNOW, WHAT YOU DO!
#OPKMANAGER WILL CRASH IF YOUR OUTPUT IS INVALID!
import subprocess
import argparse
import time
import calendar
import string
import sys
class RegisterAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
print "Official Repository" # Name
print "web" # Type (maybe web for web, or anything else for usb)
print "http://www.gcw-zero.com/files/upload/opk/" #URL
print "official.py --update" #Call for updating the list
print "O" #letter to show
class UpdateAction(argparse.Action):
def __call__(self, parser, namespace, values, option_string=None):
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/gcw-repos/count.php',stdout=subprocess.PIPE,shell=True)
process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://www.gcw-zero.com/downloads',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('wget --timeout='+str(values[0])+' -qO- http://ziz.gp2x.de/temp/test.htm',stdout=subprocess.PIPE,shell=True)
#process = subprocess.Popen('cat downloads',stdout=subprocess.PIPE,shell=True)
output = process.stdout.read().split('<div class="downloads_overview">')
for output_part in output:
part = output_part.split('\n')
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<span class="downloads_title">')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
program_name_description = part[line_number];
name = program_name_description.split('>')[1].split('<')[0];
if (name == ""):
continue
line_number = 0;
not_found = 1;
while (line_number < len(part)):
if (part[line_number].strip().startswith('<a class="downloads_link"')):
not_found = 0;
break;
line_number += 1;
if not_found:
continue;
filename = part[line_number].split('href="file.php?file=')[1].split('">')[0];
print "["+name+"]"
description = program_name_description.split('>')[3];
print "description: "+description
print "filename: " + filename
l = len(part)
found_version = 0
found_image = 0
found_long = 0;
for i in range(0,l-1):
if string.find(part[i],'Publication Date') != -1:
version = part[i+1]
version = version.split('>')[1]
version = version.split('<')[0]
t = time.strptime(version,"%A, %d %b %Y")
print "version: " + str(calendar.timegm(t)) #NEEDED!
found_version = 1
if string.find(part[i],'<div class="downloads_preview"') != -1:
image = part[i];
image = image.split("background-image: url('")[1].split("');")[0];
print "image_url: http://www.gcw-zero.com/" + image
if string.find(part[i],'<p class="more fade">') != -1:
long_description = part[i];
long_description = long_description.split('<p class="more fade">')[1].split("</p>")[0];
long_description = long_description.replace('<br /> ','\\n')
long_description = long_description.split('>')
sys.stdout.write("long_description: ")
for long_description_part in long_description:
sys.stdout.write(long_description_part.split('<')[0])
sys.stdout.write('\n')
found_long = 1
if (found_version and found_image and found_long):
break
print ""
def <|fim_middle|>():
parser = argparse.ArgumentParser(description="Ziz's Repository script")
parser.add_argument('--register', nargs=0, action=RegisterAction)
parser.add_argument('--update', nargs=1, action=UpdateAction)
args = parser.parse_args()
if __name__ == "__main__":
main()
<|fim▁end|> | main |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):<|fim▁hole|> raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)<|fim▁end|> | self.age = age
def validate_age(age):
if age < 18: |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
<|fim_middle|>
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | def __init__(self,age):
self.age = age |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
<|fim_middle|>
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | self.age = age |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
<|fim_middle|>
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!" |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age < 18:
<|fim_middle|>
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | raise InvalidAge(age) |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
<|fim_middle|>
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | return "Welcome to the movies!!" |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
<|fim_middle|>
<|fim▁end|> | print validate_age(age) |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def <|fim_middle|>(self,age):
self.age = age
def validate_age(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | __init__ |
<|file_name|>sixth.py<|end_file_name|><|fim▁begin|>#!/usr/bin/python
# bigcinemas
class InvalidAge(Exception):
def __init__(self,age):
self.age = age
def <|fim_middle|>(age):
if age < 18:
raise InvalidAge(age)
else:
return "Welcome to the movies!!"
age = int(raw_input("please enter your age:"))
#print validate_age(age)
try:
validate_age(age)
# except Exception as e:
except InvalidAge as e:
print "Buddy!! you are very young at {}!! Grow up a bit.".format(e.age)
else:
print validate_age(age)
<|fim▁end|> | validate_age |
<|file_name|>4-7-even-solution.py<|end_file_name|><|fim▁begin|># จงเขียนโปรแกรมแสดงเลขคู่ในช่วง 0 ถึง 10 (รวม 10 ด้วย)
for i in range(11):
if (i % 2 == 0):<|fim▁hole|><|fim▁end|> | print(i) |
<|file_name|>4-7-even-solution.py<|end_file_name|><|fim▁begin|># จงเขียนโปรแกรมแสดงเลขคู่ในช่วง 0 ถึง 10 (รวม 10 ด้วย)
for i in range(11):
if (i % 2 == 0):
print(i) <|fim_middle|>
<|fim▁end|> | |
<|file_name|>qubole_operator.py<|end_file_name|><|fim▁begin|>#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,<|fim▁hole|># "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
"""This module is deprecated. Please use :mod:`airflow.providers.qubole.operators.qubole`."""
import warnings
# pylint: disable=unused-import
from airflow.providers.qubole.operators.qubole import QuboleOperator # noqa
warnings.warn(
"This module is deprecated. Please use `airflow.providers.qubole.operators.qubole`.",
DeprecationWarning,
stacklevel=2,
)<|fim▁end|> | # software distributed under the License is distributed on an |
<|file_name|>main.py<|end_file_name|><|fim▁begin|><|fim▁hole|>
import sys
def func():
print('{0}.{1}'.format(*sys.version_info[:2]))
print(repr(sys.argv[1:]))
print('Hello World')
return 0<|fim▁end|> | from __future__ import print_function |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import sys
def func():
<|fim_middle|>
<|fim▁end|> | print('{0}.{1}'.format(*sys.version_info[:2]))
print(repr(sys.argv[1:]))
print('Hello World')
return 0 |
<|file_name|>main.py<|end_file_name|><|fim▁begin|>from __future__ import print_function
import sys
def <|fim_middle|>():
print('{0}.{1}'.format(*sys.version_info[:2]))
print(repr(sys.argv[1:]))
print('Hello World')
return 0
<|fim▁end|> | func |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
<|fim▁hole|> host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)<|fim▁end|> | host_username = os.environ.get('nodeUserName')
|
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
<|fim_middle|>
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success') |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
<|fim_middle|>
<|fim▁end|> | global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600) |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
<|fim_middle|>
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | scheduler_execution_count += 1 |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
<|fim_middle|>
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | scheduler_execution_count -= 1 |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
<|fim_middle|>
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count)) |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
<|fim_middle|>
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | try:
vm.destroy()
except:
pass |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def <|fim_middle|>():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def error_cleanup():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | test |
<|file_name|>test_one_node_shutdown_with_scheduler.py<|end_file_name|><|fim▁begin|>'''
Integration Test for scheduler reboot VM in HA mode.
@author: Quarkonics
'''
import zstackwoodpecker.test_util as test_util
import zstackwoodpecker.test_state as test_state
import zstackwoodpecker.test_lib as test_lib
import zstackwoodpecker.operations.resource_operations as res_ops
import zstackwoodpecker.zstack_test.zstack_test_vm as test_vm_header
import zstackwoodpecker.operations.vm_operations as vm_ops
import zstackwoodpecker.operations.scheduler_operations as schd_ops
import test_stub
import time
import os
vm = None
node1_ip = None
node2_ip = None
def test():
global vm
global node1_ip
vm = test_stub.create_basic_vm()
vm.check()
start_date = int(time.time())
schd = vm_ops.reboot_vm_scheduler(vm.get_vm().uuid, 'simple', 'simple_reboot_vm_scheduler', start_date+60, 30)
node1_ip = os.environ.get('node1Ip')
node2_ip = os.environ.get('node2Ip')
test_util.test_logger("shutdown node: %s" % (node1_ip))
cmd = "init 0"
host_username = os.environ.get('nodeUserName')
host_password = os.environ.get('nodePassword')
rsp = test_lib.lib_execute_ssh_cmd(node1_ip, host_username, host_password, cmd, 180)
test_util.test_logger("wait for 2 minutes to see if http api still works well")
time.sleep(180)
test_stub.exercise_connection(600)
time.sleep(180)
scheduler_execution_count = 0
for i in range(0, 30):
for j in range(0, 6):
if test_lib.lib_find_in_remote_management_server_log(node1_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count += 1
if test_lib.lib_find_in_remote_management_server_log(node2_ip, host_username, host_password, start_date+60+30*i+j, '[msg received]: {"org.zstack.header.vm.RebootVmInstanceMsg', vm.get_vm().uuid):
scheduler_execution_count -= 1
if abs(scheduler_execution_count) < 5:
test_util.test_fail('VM reboot scheduler is expected to executed for more than 5 times, while it only execute %s times' % (scheduler_execution_count))
schd_ops.delete_scheduler(schd.uuid)
vm.destroy()
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
test_util.test_pass('Scheduler Test Success')
#Will be called only if exception happens in test().
def <|fim_middle|>():
global vm
global node1_ip
if vm:
try:
vm.destroy()
except:
pass
test_util.test_logger("recover node: %s" % (node1_ip))
os.system('bash -ex %s %s' % (os.environ.get('nodeRecoverScript'), node1_ip))
time.sleep(180)
test_stub.exercise_connection(600)
<|fim▁end|> | error_cleanup |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
# Examples of use
@deprecated
def some_old_function(x, y):
return x + y
class SomeClass:<|fim▁hole|> @deprecated
def some_old_method(self, x, y):
return x + y<|fim▁end|> | |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
<|fim_middle|>
# Examples of use
@deprecated
def some_old_function(x, y):
return x + y
class SomeClass:
@deprecated
def some_old_method(self, x, y):
return x + y<|fim▁end|> | """This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
<|fim_middle|>
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
# Examples of use
@deprecated
def some_old_function(x, y):
return x + y
class SomeClass:
@deprecated
def some_old_method(self, x, y):
return x + y<|fim▁end|> | warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs) |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
# Examples of use
@deprecated
def some_old_function(x, y):
<|fim_middle|>
class SomeClass:
@deprecated
def some_old_method(self, x, y):
return x + y<|fim▁end|> | return x + y |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
# Examples of use
@deprecated
def some_old_function(x, y):
return x + y
class SomeClass:
<|fim_middle|>
<|fim▁end|> | @deprecated
def some_old_method(self, x, y):
return x + y |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def deprecated(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
# Examples of use
@deprecated
def some_old_function(x, y):
return x + y
class SomeClass:
@deprecated
def some_old_method(self, x, y):
<|fim_middle|>
<|fim▁end|> | return x + y |
<|file_name|>warnings.py<|end_file_name|><|fim▁begin|># -*- coding: utf-8 -*-
"""
uds.warnings
~~~~~~~~~~~~
:copyright: Copyright (c) 2015, National Institute of Information and Communications Technology.All rights reserved.
:license: GPL2, see LICENSE for more details.
"""
import warnings
def <|fim_middle|>(func):
"""This is a decorator which can be used to mark functions
as deprecated. It will result in a warning being emitted
when the function is used.
:param func:
:return: new_func
"""
def new_func(*args, **kwargs):
warnings.warn("Call to deprecated function {}.".format(func.__name__),
category=DeprecationWarning)
return func(*args, **kwargs)
new_func.__name__ = func.__name__
new_func.__doc__ = func.__doc__
new_func.__dict__.update(func.__dict__)
return new_func
# Examples of use
@deprecated
def some_old_function(x, y):
return x + y
class SomeClass:
@deprecated
def some_old_method(self, x, y):
return x + y<|fim▁end|> | deprecated |