11from __future__ import absolute_import , division , unicode_literals
22
3- from gettext import gettext
4- _ = gettext
5-
63from . import _base
74from ..constants import cdataElements , rcdataElements , voidElements
85
@@ -23,24 +20,24 @@ def __iter__(self):
2320 if type in ("StartTag" , "EmptyTag" ):
2421 name = token ["name" ]
2522 if contentModelFlag != "PCDATA" :
26- raise LintError (_ ( "StartTag not in PCDATA content model flag: %(tag)s" ) % {"tag" : name })
23+ raise LintError ("StartTag not in PCDATA content model flag: %(tag)s" % {"tag" : name })
2724 if not isinstance (name , str ):
28- raise LintError (_ ( "Tag name is not a string: %(tag)r" ) % {"tag" : name })
25+ raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
2926 if not name :
30- raise LintError (_ ( "Empty tag name" ) )
27+ raise LintError ("Empty tag name" )
3128 if type == "StartTag" and name in voidElements :
32- raise LintError (_ ( "Void element reported as StartTag token: %(tag)s" ) % {"tag" : name })
29+ raise LintError ("Void element reported as StartTag token: %(tag)s" % {"tag" : name })
3330 elif type == "EmptyTag" and name not in voidElements :
34- raise LintError (_ ( "Non-void element reported as EmptyTag token: %(tag)s" ) % {"tag" : token ["name" ]})
31+ raise LintError ("Non-void element reported as EmptyTag token: %(tag)s" % {"tag" : token ["name" ]})
3532 if type == "StartTag" :
3633 open_elements .append (name )
3734 for name , value in token ["data" ]:
3835 if not isinstance (name , str ):
39- raise LintError (_ ( "Attribute name is not a string: %(name)r" ) % {"name" : name })
36+ raise LintError ("Attribute name is not a string: %(name)r" % {"name" : name })
4037 if not name :
41- raise LintError (_ ( "Empty attribute name" ) )
38+ raise LintError ("Empty attribute name" )
4239 if not isinstance (value , str ):
43- raise LintError (_ ( "Attribute value is not a string: %(value)r" ) % {"value" : value })
40+ raise LintError ("Attribute value is not a string: %(value)r" % {"value" : value })
4441 if name in cdataElements :
4542 contentModelFlag = "CDATA"
4643 elif name in rcdataElements :
@@ -51,43 +48,43 @@ def __iter__(self):
5148 elif type == "EndTag" :
5249 name = token ["name" ]
5350 if not isinstance (name , str ):
54- raise LintError (_ ( "Tag name is not a string: %(tag)r" ) % {"tag" : name })
51+ raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
5552 if not name :
56- raise LintError (_ ( "Empty tag name" ) )
53+ raise LintError ("Empty tag name" )
5754 if name in voidElements :
58- raise LintError (_ ( "Void element reported as EndTag token: %(tag)s" ) % {"tag" : name })
55+ raise LintError ("Void element reported as EndTag token: %(tag)s" % {"tag" : name })
5956 start_name = open_elements .pop ()
6057 if start_name != name :
61- raise LintError (_ ( "EndTag (%(end)s) does not match StartTag (%(start)s)" ) % {"end" : name , "start" : start_name })
58+ raise LintError ("EndTag (%(end)s) does not match StartTag (%(start)s)" % {"end" : name , "start" : start_name })
6259 contentModelFlag = "PCDATA"
6360
6461 elif type == "Comment" :
6562 if contentModelFlag != "PCDATA" :
66- raise LintError (_ ( "Comment not in PCDATA content model flag" ) )
63+ raise LintError ("Comment not in PCDATA content model flag" )
6764
6865 elif type in ("Characters" , "SpaceCharacters" ):
6966 data = token ["data" ]
7067 if not isinstance (data , str ):
71- raise LintError (_ ( "Attribute name is not a string: %(name)r" ) % {"name" : data })
68+ raise LintError ("Attribute name is not a string: %(name)r" % {"name" : data })
7269 if not data :
73- raise LintError (_ ( "%(type)s token with empty data" ) % {"type" : type })
70+ raise LintError ("%(type)s token with empty data" % {"type" : type })
7471 if type == "SpaceCharacters" :
7572 data = data .strip (spaceCharacters )
7673 if data :
77- raise LintError (_ ( "Non-space character(s) found in SpaceCharacters token: %(token)r" ) % {"token" : data })
74+ raise LintError ("Non-space character(s) found in SpaceCharacters token: %(token)r" % {"token" : data })
7875
7976 elif type == "Doctype" :
8077 name = token ["name" ]
8178 if contentModelFlag != "PCDATA" :
82- raise LintError (_ ( "Doctype not in PCDATA content model flag: %(name)s" ) % {"name" : name })
79+ raise LintError ("Doctype not in PCDATA content model flag: %(name)s" % {"name" : name })
8380 if not isinstance (name , str ):
84- raise LintError (_ ( "Tag name is not a string: %(tag)r" ) % {"tag" : name })
81+ raise LintError ("Tag name is not a string: %(tag)r" % {"tag" : name })
8582 # XXX: what to do with token["data"] ?
8683
8784 elif type in ("ParseError" , "SerializeError" ):
8885 pass
8986
9087 else :
91- raise LintError (_ ( "Unknown token type: %(type)s" ) % {"type" : type })
88+ raise LintError ("Unknown token type: %(type)s" % {"type" : type })
9289
9390 yield token
0 commit comments