File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 7878 python -m poetry run python scripts/fetch_core.py
7979 python -m poetry run python scripts/zip_templates.py
8080
81+ - name : Check types
82+ run : |
83+ python -m poetry run mypy --install-types --non-interactive
84+
8185 - name : Test with pytest
8286 run : |
8387 python -m poetry run pytest -v --cov
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ def latex_image(
2222 all_formats : bool = False ,
2323) -> None :
2424 # Dictionary of formats for images based on target
25- formats = {
25+ formats : Dict [ str , List [ str ]] = {
2626 "pdf" : [],
2727 "latex" : [],
2828 "html" : ["svg" ],
@@ -43,7 +43,7 @@ def latex_image(
4343 li := source_xml .xpath ("/pretext/*[not(docinfo)]//latex-image" ), List
4444 )
4545 and len (li ) > 0
46- and formats [target_format ] is not None
46+ and formats [target_format ] != []
4747 ):
4848 image_output = (output / "latex-image" ).resolve ()
4949 os .makedirs (image_output , exist_ok = True )
@@ -159,7 +159,7 @@ def asymptote(
159159 }
160160 # set overwrite formats to all when appropriate
161161 if all_formats :
162- formats [target_format ] = { key : ["all" ] for key in formats [ target_format ]}
162+ formats [target_format ] = ["all" ]
163163 # We assume passed paths are absolute.
164164 # parse source so we can check for asymptote.
165165 source_xml = ET .parse (ptxfile )
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ def resource_path(filename: str) -> AbstractContextManager:
1414 # Try except here is to use newer importlib function,
1515 # supported starting with 3.9, and required with 3.11
1616 try :
17- return ir .as_file (ir .files (resources ).joinpath (filename ))
17+ # TODO: remove the ignore when Python 3.8 support ends. This fails Python 3.8 type checks, since these functions depend on newer Python versions.
18+ return ir .as_file (ir .files (resources ).joinpath (filename )) # type: ignore[attr-defined]
1819 except AttributeError :
1920 return ir .path (resources , filename )
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ script_launch_mode = "subprocess"
8080[tool .mypy ]
8181# See `files <https://mypy.readthedocs.io/en/stable/config_file.html#confval-files>`_.
8282files = " pretext"
83- exclude = " ^pretext/core/pretext.py"
83+ exclude = " ^pretext/core/pretext\\ .py$ "
8484check_untyped_defs = true
8585disallow_untyped_defs = true
8686
You can’t perform that action at this time.
0 commit comments