@@ -110,7 +110,7 @@ class PoMessage(object):
110110    """ 
111111
112112    # pylint: disable=too-many-arguments 
113-     def  __init__ (self , filename , line , msg , charset , fuzzy , fmt ):
113+     def  __init__ (self , filename , line , msg , charset , fuzzy , fmt ,  noqa ):
114114        """Build a PO message.""" 
115115        self .filename  =  filename 
116116        self .line  =  line 
@@ -136,6 +136,7 @@ def __init__(self, filename, line, msg, charset, fuzzy, fmt):
136136            self .messages .append ((msg .get ('msgid' , '' ), msg .get ('msgstr' , '' )))
137137        self .fuzzy  =  fuzzy 
138138        self .fmt  =  fmt 
139+         self .noqa  =  noqa 
139140
140141    def  check_lines (self ):
141142        """ 
@@ -297,7 +298,8 @@ def __init__(self, filename):
297298        }
298299        self .msgs  =  []
299300
300-     def  _add_message (self , numline_msgid , fuzzy , fmt , msg ):
301+     # pylint: disable=too-many-arguments 
302+     def  _add_message (self , numline_msgid , fuzzy , fmt , noqa , msg ):
301303        """ 
302304        Add a message from PO file in list of messages. 
303305        """ 
@@ -314,7 +316,7 @@ def _add_message(self, numline_msgid, fuzzy, fmt, msg):
314316            if  match :
315317                self .props ['charset' ] =  match .group (1 )
316318        self .msgs .append (PoMessage (self .filename , numline_msgid , msg ,
317-                                    self .props ['charset' ], fuzzy , fmt ))
319+                                    self .props ['charset' ], fuzzy , fmt ,  noqa ))
318320
319321    def  read (self ):
320322        """ 
@@ -323,6 +325,7 @@ def read(self):
323325        self .msgs  =  []
324326        numline , numline_msgid  =  (0 , 0 )
325327        fuzzy , msgfuzzy  =  (False , False )
328+         noqa , msgnoqa  =  (False , False )
326329        fmt , msgfmt  =  (None , None )
327330        msg  =  {}
328331        msgcurrent  =  '' 
@@ -337,6 +340,7 @@ def read(self):
337340                    match  =  re .search (r'([a-z-]+)-format' , line , re .IGNORECASE )
338341                    fmt  =  match .group (1 ) if  match  else  None 
339342                if  line .startswith ('#' ):
343+                     noqa  =  'noqa'  in  line 
340344                    continue 
341345                if  line .startswith ('msg' ):
342346                    match  =  re .match (
@@ -351,9 +355,12 @@ def read(self):
351355                                self ._add_message (numline_msgid ,
352356                                                  msgfuzzy ,
353357                                                  msgfmt ,
358+                                                   msgnoqa ,
354359                                                  msg )
355360                            msgfuzzy  =  fuzzy 
361+                             msgnoqa  =  noqa 
356362                            fuzzy  =  False 
363+                             noqa  =  False 
357364                            msgfmt  =  fmt 
358365                            fmt  =  None 
359366                            msg  =  {}
@@ -364,6 +371,7 @@ def read(self):
364371                self ._add_message (numline_msgid ,
365372                                  msgfuzzy ,
366373                                  msgfmt ,
374+                                   msgnoqa ,
367375                                  msg )
368376
369377    def  compile (self ):
@@ -389,6 +397,7 @@ def __init__(self):
389397        self .checks  =  {
390398            'compile' : True ,
391399            'fuzzy' : False ,
400+             'skip_noqa' : False ,
392401            'lines' : True ,
393402            'punct' : True ,
394403            'whitespace' : True ,
@@ -478,7 +487,10 @@ def check_pofile(self, po_file):
478487
479488        # check all messages 
480489        check_fuzzy  =  self .checks ['fuzzy' ]
490+         skip_noqa  =  self .checks ['skip_noqa' ]
481491        for  msg  in  po_file .msgs :
492+             if  skip_noqa  and  msg .noqa :
493+                 continue 
482494            if  msg .fuzzy  and  not  check_fuzzy :
483495                continue 
484496            if  self .checks ['extract' ]:
0 commit comments