fix some linter errors

parent eac90506
...@@ -7,7 +7,7 @@ linter: ...@@ -7,7 +7,7 @@ linter:
- python3 -V - python3 -V
- uname -a - uname -a
- apt install -y sqlite3 locales-all git python3-flask python3-ldap3 python3-requests python3-lxml python3-icalendar python3-mysql.connector python3-requests python3-coverage pylint3 - apt install -y sqlite3 locales-all git python3-flask python3-ldap3 python3-requests python3-lxml python3-icalendar python3-mysql.connector python3-requests python3-coverage pylint3
- pylint3 --indent-string='\t' --indent-after-paren=1 --max-line-length=140 --output-format=text *.py | tee pylint.txt - pylint3 --indent-string='\t' --indent-after-paren=1 --max-line-length=160 --output-format=text *.py | tee pylint.txt
artifacts: artifacts:
paths: paths:
- pylint.txt - pylint.txt
......
...@@ -15,17 +15,17 @@ def import_xmp_chapters(jobid, jobtype, data, state, status): ...@@ -15,17 +15,17 @@ def import_xmp_chapters(jobid, jobtype, data, state, status):
if int(chapter['time']) in times: if int(chapter['time']) in times:
continue continue
modify('INSERT INTO chapters (lecture_id, time, text, visible, time_created, time_updated) VALUES (?, ?, ?, 0, ?, ?)', modify('INSERT INTO chapters (lecture_id, time, text, visible, time_created, time_updated) VALUES (?, ?, ?, 0, ?, ?)',
data['lecture_id'], int(chapter['time']), chapter['text'], data['lecture_id'], int(chapter['time']), chapter['text'],
datetime.now(), datetime.now()) datetime.now(), datetime.now())
@app.route('/internal/newchapter/<int:lectureid>', methods=['POST', 'GET']) @app.route('/internal/newchapter/<int:lectureid>', methods=['POST', 'GET'])
def suggest_chapter(lectureid): def suggest_chapter(lectureid):
time = request.values['time'] time = request.values['time']
text = request.values['text'] text = request.values['text']
assert(time and text) assert time and text
try: try:
x = datetime.strptime(time,'%H:%M:%S') x = datetime.strptime(time, '%H:%M:%S')
time= timedelta(hours=x.hour,minutes=x.minute,seconds=x.second).total_seconds() time = timedelta(hours=x.hour, minutes=x.minute, seconds=x.second).total_seconds()
time = int(time) time = int(time)
except ValueError: except ValueError:
if 'ref' in request.values: if 'ref' in request.values:
...@@ -58,4 +58,4 @@ def chapters(lectureid): ...@@ -58,4 +58,4 @@ def chapters(lectureid):
last = c last = c
if 'json' in request.values: if 'json' in request.values:
return Response(json.dumps([{'time': c['time'], 'text': c['text']} for c in chapters]), mimetype='application/json') return Response(json.dumps([{'time': c['time'], 'text': c['text']} for c in chapters]), mimetype='application/json')
return Response(render_template('chapters.srt',chapters=chapters), 200, {'Content-Type':'text/vtt'}) return Response(render_template('chapters.srt', chapters=chapters), 200, {'Content-Type':'text/vtt'})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment