@@ -126,10 +126,10 @@ def add_message(self, numline_msgid, msgfuzzy, msg):
126126 if 'msgid' in msg and len (msg ['msgid' ]) == 0 :
127127 # find file language/charset in properties
128128 # (first string without msgid)
129- m = re .search (r'language: ([a-zA-Z-_]+)' , msg . get ( 'msgstr' , '' ) ,
130- re .IGNORECASE )
131- if m :
132- self .props ['language' ] = m .group (1 )
129+ match = re .search (r'language: ([a-zA-Z-_]+)' ,
130+ msg . get ( 'msgstr' , '' ), re .IGNORECASE )
131+ if match :
132+ self .props ['language' ] = match .group (1 )
133133 if self .args .spelling :
134134 try :
135135 d = enchant .DictWithPWL (self .props ['language' ],
@@ -152,10 +152,10 @@ def add_message(self, numline_msgid, msgfuzzy, msg):
152152 'language ' ,
153153 lang ,
154154 sep = '' )
155- m = re .search (r'charset=([a-zA-Z0-9-_]+)' , msg . get ( 'msgstr' , '' ) ,
156- re .IGNORECASE )
157- if m :
158- self .props ['charset' ] = m .group (1 )
155+ match = re .search (r'charset=([a-zA-Z0-9-_]+)' ,
156+ msg . get ( 'msgstr' , '' ), re .IGNORECASE )
157+ if match :
158+ self .props ['charset' ] = match .group (1 )
159159 self .msgs .append (PoMessage (msg , self .props ['charset' ], msgfuzzy ,
160160 numline_msgid ,))
161161
@@ -169,8 +169,8 @@ def read(self):
169169 msg = {}
170170 msgcurrent = ''
171171 try :
172- with open (self .filename , 'r' ) as f :
173- for line in f .readlines ():
172+ with open (self .filename , 'r' ) as _file :
173+ for line in _file .readlines ():
174174 numline += 1
175175 line = line .strip ()
176176 if len (line ) == 0 :
@@ -179,12 +179,13 @@ def read(self):
179179 fuzzy = 'fuzzy' in line
180180 continue
181181 if line .startswith ('msg' ):
182- m = re .match (r'([a-zA-Z0-9-_]+(\[\d+\])?)[ \t](.*)' ,
183- line )
184- if m :
182+ match = re .match (
183+ r'([a-zA-Z0-9-_]+(\[\d+\])?)[ \t](.*)' ,
184+ line )
185+ if match :
185186 oldmsgcurrent = msgcurrent
186- msgcurrent = m .group (1 )
187- line = m .group (3 )
187+ msgcurrent = match .group (1 )
188+ line = match .group (3 )
188189 if msgcurrent == 'msgid' :
189190 if oldmsgcurrent .startswith ('msgstr' ):
190191 self .add_message (numline_msgid ,
@@ -368,8 +369,8 @@ def check_spelling(self, msg):
368369 misspelled = []
369370 for err in self .checkers [0 ]:
370371 misspelled_word = True
371- for d in self .checkers [1 :]:
372- if d .check (err .word ):
372+ for spell_checker in self .checkers [1 :]:
373+ if spell_checker .check (err .word ):
373374 misspelled_word = False
374375 break
375376 if misspelled_word :
@@ -476,23 +477,23 @@ def main():
476477 messages = []
477478 for filename in args .file :
478479 errors = 0
479- po = PoFile (filename , args )
480- if args .no_compile or po .compile () == 0 :
481- po .read ()
480+ po_file = PoFile (filename , args )
481+ if args .no_compile or po_file .compile () == 0 :
482+ po_file .read ()
482483 if args .extract :
483- po .display_translations ()
484+ po_file .display_translations ()
484485 else :
485- errors = po .check ()
486+ errors = po_file .check ()
486487 if errors == 0 :
487- messages .append ('{0}: OK' .format (po .filename ))
488+ messages .append ('{0}: OK' .format (po_file .filename ))
488489 else :
489490 messages .append ('{0}: {1} errors ({2})'
490- '' .format (po .filename ,
491+ '' .format (po_file .filename ,
491492 errors ,
492493 'almost good!' if errors <= 10
493494 else 'uh oh... try again!' ))
494495 else :
495- print (po .filename , ': compilation FAILED' , sep = '' )
496+ print (po_file .filename , ': compilation FAILED' , sep = '' )
496497 errors = 1
497498 if errors > 0 :
498499 files_with_errors += 1
0 commit comments