Commit aaf1985a authored by Jamy Mahabier's avatar Jamy Mahabier

Organize Python imports

parent 8bd5b93e
import pytest
import os
import pytest
from zesje.helpers import scan_helper, image_helper
# Mocks
......
import pytest
import cv2
import PIL
import os
import math
import os
import cv2
import numpy as np
import PIL
import pytest
from zesje.helpers import image_helper
......
......@@ -4,8 +4,8 @@ import os
from os.path import abspath, dirname
from flask import Flask
from werkzeug.exceptions import NotFound
from flask_basicauth import BasicAuth
from werkzeug.exceptions import NotFound
from .api import api_bp
from .models import db
......
import sys
import os
sys.path.append(os.getcwd())
import sys
sys.path.append(os.getcwd())
from zesje import app
app.run()
import pandas
from collections import ChainMap
from pony import orm
from collections import namedtuple, OrderedDict, ChainMap
from ..models import Exam, Problem, Student, Solution
import pandas
from . import yaml_helper
from ..models import Exam, Problem, Solution, Student
def update_exam(exam, existing_yaml, new_yaml):
existing_version, existing_name, _, existing_widgets = yaml_helper.parse(existing_yaml)
......
......@@ -7,7 +7,6 @@ import pandas
import yaml
def parse(yml):
""" Get the important parameters from a yaml """
......
""" Models used in the db """
from datetime import datetime
import random
import string
from datetime import datetime
from pony.orm import db_session, Database, Required, Optional, PrimaryKey, Set
# from https://editor.ponyorm.com/user/zesje/zesje/python
......
import os
import datetime
import glob
import os
import zipfile
from io import BytesIO
import datetime
from flask import current_app as app, abort, send_file
from flask_restful import Resource, reqparse
......
import os
from io import BytesIO
from flask import abort, Response, current_app as app
from pony import orm
from ..helpers import db_helper
......
......@@ -6,6 +6,7 @@ from pony import orm
from ..models import Problem, FeedbackOption
class Feedback(Resource):
""" List of feedback options of a problem """
......
......@@ -5,7 +5,6 @@ from flask_restful import Resource, reqparse
from pony import orm
from ..models import db, Grader
from ._helpers import required_string
......@@ -60,7 +59,7 @@ class Graders(Resource):
last_name: str
"""
args = self.post_parser.parse_args()
try:
Grader(first_name= args['first_name'],
last_name=args['last_name'])
......
import os
from flask import abort, Response
from pony import orm
import numpy as np
......
""" REST api for problems """
from flask import request
from flask_restful import Resource, reqparse
from pony import orm
from ..models import db, Exam, Problem, ProblemWidget
......
import os
from subprocess import run
import multiprocessing
import os
from flask import abort, current_app as app
from flask import current_app as app
from flask_restful import Resource, reqparse
from werkzeug.datastructures import FileStorage
from pony import orm
from ..models import Exam, Scan
from ..helpers import scan_helper
from ..models import Exam, Scan
class Scans(Resource):
"""Getting a list of uploaded scans, and uploading new ones."""
......
from flask import abort, Response, current_app as app
from pony import orm
import numpy as np
import cv2
......
""" REST api for solutions """
from flask_restful import Resource, reqparse
from datetime import datetime
from flask_restful import Resource, reqparse
from pony import orm
from ..models import Exam, Submission, Problem, Solution, FeedbackOption
......
import io
from flask_restful import Resource, reqparse
from pony import orm
from werkzeug.datastructures import FileStorage
import pandas as pd, io
import pandas as pd
from ..models import Student
......@@ -24,7 +27,7 @@ class Students(Resource):
id: int
first_name: str
last_name: str
email: str
email: str
If no student_id is provided the entire list of students will be returned.
"""
......@@ -63,7 +66,7 @@ class Students(Resource):
Expects a json payload in the format::
{
"studentID": int,
"studentID": int,
"firstName": str,
"lastName": str,
"email": str OR null - this value is optional and may be empty, but must be unique
......
import re
from flask_restful import Resource, reqparse
from pony import orm
from ..models import Exam, Submission, Student
page_match = re.compile(r'.*page(\d+).jpg').match
......
import os
from io import BytesIO
from flask import abort, Response, current_app as app
from flask import abort, Response
from pony import orm
import pandas
import matplotlib
import numpy as np
import pandas
from ..models import Exam, Submission
from ..helpers.db_helper import full_exam_data
from ..models import Exam
import matplotlib
matplotlib.use('agg')
import seaborn
from matplotlib import pyplot
import seaborn # noqa: E402
from matplotlib import pyplot # noqa: E402
@orm.db_session
def get(exam_id):
......
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