11from glob import glob
22import re
33
4+ from nbformat import NotebookNode
45import pytest
56
67from .lib .nb_helper import get_tags , is_code_cell , read_notebook
1011lecture_notebooks .sort ()
1112
1213
13- def slide_type (cell ):
14+ def slide_type (cell : NotebookNode ):
1415 return cell .metadata .get ("slideshow" , {}).get ("slide_type" )
1516
1617
17- def is_slide (cell ):
18+ def is_slide (cell : NotebookNode ):
1819 SLIDE_TYPES = ["slide" , "subslide" ]
1920 return slide_type (cell ) in SLIDE_TYPES
2021
@@ -23,7 +24,7 @@ def is_exercise(source: str):
2324 return re .match ("#+.+(demo|exercise)" , source , re .IGNORECASE ) is not None
2425
2526
26- def num_slides (cells ):
27+ def num_slides (cells : list [ NotebookNode ] ):
2728 """Return a weighted number of slides"""
2829
2930 slides = [cell for cell in cells if is_slide (cell )]
@@ -51,12 +52,13 @@ def test_num_slides(file):
5152 if file == "lecture_6.ipynb" :
5253 pytest .xfail ("The various pieces of the lecture can be scaled appropriately" )
5354
54- num_columbia = num_slides_without_tag (notebook .cells , "nyu-only" )
55+ cells : list [NotebookNode ] = notebook .cells
56+ num_columbia = num_slides_without_tag (cells , "nyu-only" )
5557 print ("Number of slides for Columbia: " , num_columbia )
5658 assert num_columbia >= 42 , "Too few slides for Columbia"
5759 assert num_columbia <= 63 , "Too many slides for Columbia"
5860
59- num_nyu = num_slides_without_tag (notebook . cells , "columbia-only" )
61+ num_nyu = num_slides_without_tag (cells , "columbia-only" )
6062 print ("Number of slides for NYU: " , num_nyu )
6163 assert num_nyu >= 39 , "Too few slides for NYU"
6264 assert num_nyu <= 51 , "Too many slides for NYU"
0 commit comments