@@ -126,10 +126,10 @@ def add_message(self, numline_msgid, msgfuzzy, msg):
126
126
if 'msgid' in msg and len (msg ['msgid' ]) == 0 :
127
127
# find file language/charset in properties
128
128
# (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 )
133
133
if self .args .spelling :
134
134
try :
135
135
d = enchant .DictWithPWL (self .props ['language' ],
@@ -152,10 +152,10 @@ def add_message(self, numline_msgid, msgfuzzy, msg):
152
152
'language ' ,
153
153
lang ,
154
154
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 )
159
159
self .msgs .append (PoMessage (msg , self .props ['charset' ], msgfuzzy ,
160
160
numline_msgid ,))
161
161
@@ -169,8 +169,8 @@ def read(self):
169
169
msg = {}
170
170
msgcurrent = ''
171
171
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 ():
174
174
numline += 1
175
175
line = line .strip ()
176
176
if len (line ) == 0 :
@@ -179,12 +179,13 @@ def read(self):
179
179
fuzzy = 'fuzzy' in line
180
180
continue
181
181
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 :
185
186
oldmsgcurrent = msgcurrent
186
- msgcurrent = m .group (1 )
187
- line = m .group (3 )
187
+ msgcurrent = match .group (1 )
188
+ line = match .group (3 )
188
189
if msgcurrent == 'msgid' :
189
190
if oldmsgcurrent .startswith ('msgstr' ):
190
191
self .add_message (numline_msgid ,
@@ -368,8 +369,8 @@ def check_spelling(self, msg):
368
369
misspelled = []
369
370
for err in self .checkers [0 ]:
370
371
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 ):
373
374
misspelled_word = False
374
375
break
375
376
if misspelled_word :
@@ -476,23 +477,23 @@ def main():
476
477
messages = []
477
478
for filename in args .file :
478
479
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 ()
482
483
if args .extract :
483
- po .display_translations ()
484
+ po_file .display_translations ()
484
485
else :
485
- errors = po .check ()
486
+ errors = po_file .check ()
486
487
if errors == 0 :
487
- messages .append ('{0}: OK' .format (po .filename ))
488
+ messages .append ('{0}: OK' .format (po_file .filename ))
488
489
else :
489
490
messages .append ('{0}: {1} errors ({2})'
490
- '' .format (po .filename ,
491
+ '' .format (po_file .filename ,
491
492
errors ,
492
493
'almost good!' if errors <= 10
493
494
else 'uh oh... try again!' ))
494
495
else :
495
- print (po .filename , ': compilation FAILED' , sep = '' )
496
+ print (po_file .filename , ': compilation FAILED' , sep = '' )
496
497
errors = 1
497
498
if errors > 0 :
498
499
files_with_errors += 1
0 commit comments