From 7dac4894bf20feaa72c081183333fcb564ff4e5a Mon Sep 17 00:00:00 2001 From: Miguel Barão Date: Fri, 14 Jan 2022 16:43:35 +0000 Subject: [PATCH] fix mypy and pyright warnings review explicitly indicates that a test was not corrected instead of grade=NaN --- demo/demo.yaml | 2 +- demo/questions/questions-tutorial.yaml | 1 + perguntations/__init__.py | 2 +- perguntations/app.py | 6 +++--- perguntations/initdb.py | 2 +- perguntations/main.py | 8 ++++---- perguntations/questions.py | 2 +- perguntations/serve.py | 2 +- perguntations/templates/review.html | 9 ++++++--- perguntations/testfactory.py | 6 +++--- setup.py | 2 +- 11 files changed, 23 insertions(+), 19 deletions(-) diff --git a/demo/demo.yaml b/demo/demo.yaml index d70cc2c..3db985b 100644 --- a/demo/demo.yaml +++ b/demo/demo.yaml @@ -32,7 +32,7 @@ autosubmit: false # shown to the student. If false, the test is saved but not corrected. # No grade is shown to the student. # (default: true) -autocorrect: false +autocorrect: true # Show points for each question (min and max). # (default: true) diff --git a/demo/questions/questions-tutorial.yaml b/demo/questions/questions-tutorial.yaml index 9ac3b49..e999397 100644 --- a/demo/questions/questions-tutorial.yaml +++ b/demo/questions/questions-tutorial.yaml @@ -500,6 +500,7 @@ return 0; // comentario } ``` + ``` # --------------------------------------------------------------------------- diff --git a/perguntations/__init__.py b/perguntations/__init__.py index 026ca93..9795837 100644 --- a/perguntations/__init__.py +++ b/perguntations/__init__.py @@ -33,7 +33,7 @@ proof of submission and for review. APP_NAME = 'perguntations' APP_VERSION = '2022.01.dev1' -APP_DESCRIPTION = __doc__ +APP_DESCRIPTION = str(__doc__) __author__ = 'Miguel Barão' __copyright__ = 'Copyright 2022, Miguel Barão' diff --git a/perguntations/app.py b/perguntations/app.py index f0de047..4129091 100644 --- a/perguntations/app.py +++ b/perguntations/app.py @@ -20,9 +20,9 @@ from sqlalchemy.orm import Session import yaml # this project -from perguntations.models import Student, Test, Question -from perguntations.tools import load_yaml -from perguntations.testfactory import TestFactory, TestFactoryException +from .models import Student, Test, Question +from .tools import load_yaml +from .testfactory import TestFactory, TestFactoryException # setup logger for this module logger = logging.getLogger(__name__) diff --git a/perguntations/initdb.py b/perguntations/initdb.py index 38ef8b4..b355076 100644 --- a/perguntations/initdb.py +++ b/perguntations/initdb.py @@ -18,7 +18,7 @@ from sqlalchemy.orm import Session from sqlalchemy.exc import IntegrityError # this project -from perguntations.models import Base, Student +from .models import Base, Student # ============================================================================ diff --git a/perguntations/main.py b/perguntations/main.py index 3eb7bbb..770963e 100644 --- a/perguntations/main.py +++ b/perguntations/main.py @@ -14,10 +14,10 @@ import ssl import sys # this project -from perguntations.app import App, AppException -from perguntations.serve import run_webserver -from perguntations.tools import load_yaml -from perguntations import APP_NAME, APP_VERSION +from .app import App, AppException +from .serve import run_webserver +from .tools import load_yaml +from . import APP_NAME, APP_VERSION # ---------------------------------------------------------------------------- def parse_cmdline_arguments() -> argparse.Namespace: diff --git a/perguntations/questions.py b/perguntations/questions.py index 57b7013..a78ab83 100644 --- a/perguntations/questions.py +++ b/perguntations/questions.py @@ -15,7 +15,7 @@ from typing import Any, Dict, NewType import uuid # this project -from perguntations.tools import run_script, run_script_async +from .tools import run_script, run_script_async # setup logger for this module logger = logging.getLogger(__name__) diff --git a/perguntations/serve.py b/perguntations/serve.py index a1dfe49..f2b8925 100644 --- a/perguntations/serve.py +++ b/perguntations/serve.py @@ -26,7 +26,7 @@ import tornado.web import tornado.httpserver # this project -from perguntations.parser_markdown import md_to_html +from .parser_markdown import md_to_html # setup logger for this module diff --git a/perguntations/templates/review.html b/perguntations/templates/review.html index 02436d6..9e01ef4 100644 --- a/perguntations/templates/review.html +++ b/perguntations/templates/review.html @@ -97,9 +97,12 @@
- {{ round(t['grade'], 2) }} valores - {% if t['state'] == 'QUIT' %} - (DESISTÊNCIA) + {% if t['state'] == 'CORRECTED' %} + {{ round(t['grade'], 2) }} valores + {% elif t['state'] == 'SUBMITTED' %} + (não corrigido) + {% elif t['state'] == 'QUIT' %} + (DESISTIU) {% end %}
diff --git a/perguntations/testfactory.py b/perguntations/testfactory.py index b251e07..a8a1d86 100644 --- a/perguntations/testfactory.py +++ b/perguntations/testfactory.py @@ -11,9 +11,9 @@ import logging import schema # this project -from perguntations.questions import QFactory, QuestionException, QDict -from perguntations.test import Test -from perguntations.tools import load_yaml +from .questions import QFactory, QuestionException, QDict +from .test import Test +from .tools import load_yaml # Logger configuration logger = logging.getLogger(__name__) diff --git a/setup.py b/setup.py index bf35edb..3d78630 100644 --- a/setup.py +++ b/setup.py @@ -28,8 +28,8 @@ setup( 'mistune<2.0', 'pyyaml>=5.1', 'pygments', + 'schema>=0.7', 'sqlalchemy>=1.4', - # 'sqlalchemy[asyncio,mypy]>=1.4', 'bcrypt>=3.1' ], entry_points={ -- libgit2 0.21.2