@@ -34,7 +34,7 @@ def __init__(self, problemdir, language=None, force_copy_cls=False, version="aut
3434 if glob .glob (os .path .join (stmtdir , 'problem.tex' )):
3535 langs .append ('' )
3636 for f in glob .glob (os .path .join (stmtdir , 'problem.[a-z][a-z].tex' )):
37- langs .append (re .search ("problem.([a-z][a-z]).tex$" , f ).group (1 ))
37+ langs .append (re .search ("problem.([a-z][a-z]).tex$" , f ).group (1 )) # type: ignore[union-attr]
3838 if len (langs ) == 0 :
3939 raise Exception ('No problem statements available' )
4040
@@ -69,10 +69,10 @@ def __init__(self, problemdir, language=None, force_copy_cls=False, version="aut
6969 templatepaths = [os .path .join (os .path .dirname (__file__ ), 'templates/latex' ),
7070 os .path .join (os .path .dirname (__file__ ), '../templates/latex' ),
7171 '/usr/lib/problemtools/templates/latex' ]
72- self . templatepath = next (( p for p in templatepaths
73- if os . path . isdir ( p ) and os . path . isfile ( os . path . join ( p , self . templatefile ))),
74- None )
75- if self . templatepath is None :
72+ try :
73+ self . templatepath = next (( p for p in templatepaths
74+ if os . path . isdir ( p ) and os . path . isfile ( os . path . join ( p , self . templatefile ))) )
75+ except StopIteration :
7676 raise Exception ('Could not find directory with latex template "%s"' % self .templatefile )
7777
7878 self .basedir = os .path .dirname (problemdir )
0 commit comments