Commit 7dac4894bf20feaa72c081183333fcb564ff4e5a

Authored by Miguel Barão
1 parent 1b9491c2
Exists in master and in 1 other branch dev

fix mypy and pyright warnings

review explicitly indicates that a test was not corrected instead of grade=NaN
demo/demo.yaml
... ... @@ -32,7 +32,7 @@ autosubmit: false
32 32 # shown to the student. If false, the test is saved but not corrected.
33 33 # No grade is shown to the student.
34 34 # (default: true)
35   -autocorrect: false
  35 +autocorrect: true
36 36  
37 37 # Show points for each question (min and max).
38 38 # (default: true)
... ...
demo/questions/questions-tutorial.yaml
... ... @@ -500,6 +500,7 @@
500 500 return 0; // comentario
501 501 }
502 502 ```
  503 +
503 504 ```
504 505  
505 506 # ---------------------------------------------------------------------------
... ...
perguntations/__init__.py
... ... @@ -33,7 +33,7 @@ proof of submission and for review.
33 33  
34 34 APP_NAME = 'perguntations'
35 35 APP_VERSION = '2022.01.dev1'
36   -APP_DESCRIPTION = __doc__
  36 +APP_DESCRIPTION = str(__doc__)
37 37  
38 38 __author__ = 'Miguel Barão'
39 39 __copyright__ = 'Copyright 2022, Miguel Barão'
... ...
perguntations/app.py
... ... @@ -20,9 +20,9 @@ from sqlalchemy.orm import Session
20 20 import yaml
21 21  
22 22 # this project
23   -from perguntations.models import Student, Test, Question
24   -from perguntations.tools import load_yaml
25   -from perguntations.testfactory import TestFactory, TestFactoryException
  23 +from .models import Student, Test, Question
  24 +from .tools import load_yaml
  25 +from .testfactory import TestFactory, TestFactoryException
26 26  
27 27 # setup logger for this module
28 28 logger = logging.getLogger(__name__)
... ...
perguntations/initdb.py
... ... @@ -18,7 +18,7 @@ from sqlalchemy.orm import Session
18 18 from sqlalchemy.exc import IntegrityError
19 19  
20 20 # this project
21   -from perguntations.models import Base, Student
  21 +from .models import Base, Student
22 22  
23 23  
24 24 # ============================================================================
... ...
perguntations/main.py
... ... @@ -14,10 +14,10 @@ import ssl
14 14 import sys
15 15  
16 16 # this project
17   -from perguntations.app import App, AppException
18   -from perguntations.serve import run_webserver
19   -from perguntations.tools import load_yaml
20   -from perguntations import APP_NAME, APP_VERSION
  17 +from .app import App, AppException
  18 +from .serve import run_webserver
  19 +from .tools import load_yaml
  20 +from . import APP_NAME, APP_VERSION
21 21  
22 22 # ----------------------------------------------------------------------------
23 23 def parse_cmdline_arguments() -> argparse.Namespace:
... ...
perguntations/questions.py
... ... @@ -15,7 +15,7 @@ from typing import Any, Dict, NewType
15 15 import uuid
16 16  
17 17 # this project
18   -from perguntations.tools import run_script, run_script_async
  18 +from .tools import run_script, run_script_async
19 19  
20 20 # setup logger for this module
21 21 logger = logging.getLogger(__name__)
... ...
perguntations/serve.py
... ... @@ -26,7 +26,7 @@ import tornado.web
26 26 import tornado.httpserver
27 27  
28 28 # this project
29   -from perguntations.parser_markdown import md_to_html
  29 +from .parser_markdown import md_to_html
30 30  
31 31  
32 32 # setup logger for this module
... ...
perguntations/templates/review.html
... ... @@ -97,9 +97,12 @@
97 97 <div class="row">
98 98 <label for="nota" class="col-sm-2">Nota:</label>
99 99 <div class="col-sm-10" id="nota">
100   - <span class="badge badge-primary">{{ round(t['grade'], 2) }}</span> valores
101   - {% if t['state'] == 'QUIT' %}
102   - (DESISTÊNCIA)
  100 + {% if t['state'] == 'CORRECTED' %}
  101 + <span class="badge badge-primary">{{ round(t['grade'], 2) }}</span> valores
  102 + {% elif t['state'] == 'SUBMITTED' %}
  103 + (não corrigido)
  104 + {% elif t['state'] == 'QUIT' %}
  105 + (DESISTIU)
103 106 {% end %}
104 107 </div>
105 108 </div>
... ...
perguntations/testfactory.py
... ... @@ -11,9 +11,9 @@ import logging
11 11 import schema
12 12  
13 13 # this project
14   -from perguntations.questions import QFactory, QuestionException, QDict
15   -from perguntations.test import Test
16   -from perguntations.tools import load_yaml
  14 +from .questions import QFactory, QuestionException, QDict
  15 +from .test import Test
  16 +from .tools import load_yaml
17 17  
18 18 # Logger configuration
19 19 logger = logging.getLogger(__name__)
... ...
setup.py
... ... @@ -28,8 +28,8 @@ setup(
28 28 'mistune<2.0',
29 29 'pyyaml>=5.1',
30 30 'pygments',
  31 + 'schema>=0.7',
31 32 'sqlalchemy>=1.4',
32   - # 'sqlalchemy[asyncio,mypy]>=1.4',
33 33 'bcrypt>=3.1'
34 34 ],
35 35 entry_points={
... ...