@@ -199,12 +199,11 @@ def __init__(self, name_, uri_):
199199 self .name = name_
200200 self .uri = uri_
201201
202- def getEntityString (self ):
203- txt = """ <!ENTITY %(perc)s %(name)s SYSTEM "%(uri)s">
204- %(perc)s%(name)s;
205- """ % {'perc' : perc , 'name' : self .name , 'uri' : self .uri }
206-
207- return txt
202+ def getEntityString (self ) -> str :
203+ return f"""\
204+ <!ENTITY % { self .name } SYSTEM "{ self .uri } ">
205+ %{ self .name } ;
206+ """
208207
209208
210209class DoctypeDeclaration :
@@ -417,8 +416,6 @@ def __del__(self):
417416 if self .xpath_context is not None :
418417 self .xpath_context .xpathFreeContext ()
419418
420- perc = "%"
421-
422419def validate_all_xml (dpaths , xsdfile = default_xsd ):
423420 xmlschema_context = etree .parse (xsdfile )
424421
@@ -438,10 +435,7 @@ def validate_all_xml(dpaths, xsdfile=default_xsd):
438435 fails = []
439436 fpaths = sorted (fpaths )
440437 for idx , fp in enumerate (fpaths ):
441- fpath = os .path .join (path , fp )
442- print ("%.2f%s (%d/%d) %s" % (float (idx + 1 ) * 100.0 / float (len (fpaths )),
443- perc , idx + 1 , len (fpaths ), fp ))
444-
438+ print (f"{ (idx + 1 ) / len (fpaths ):7.2%} ({ idx + 1 } /{ len (fpaths )} ) { fp } " )
445439 if not tf .validateXml (fp , xmlschema_context ):
446440 fails .append (fp )
447441 continue
0 commit comments